|
|
6d3351 |
From 6abf3f12df5173dc12af69827fbee98811f83959 Mon Sep 17 00:00:00 2001
|
|
|
6d3351 |
Message-Id: <6abf3f12df5173dc12af69827fbee98811f83959@dist-git>
|
|
|
6d3351 |
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
|
|
6d3351 |
Date: Fri, 9 Jun 2017 12:49:06 +0200
|
|
|
6d3351 |
Subject: [PATCH] Add virtio-related options to video
|
|
|
6d3351 |
MIME-Version: 1.0
|
|
|
6d3351 |
Content-Type: text/plain; charset=UTF-8
|
|
|
6d3351 |
Content-Transfer-Encoding: 8bit
|
|
|
6d3351 |
|
|
|
6d3351 |
https://bugzilla.redhat.com/show_bug.cgi?id=1283251
|
|
|
6d3351 |
|
|
|
6d3351 |
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
6d3351 |
(cherry picked from commit f5384fb4029a59624e728a2e0d37e6a62efbdc52)
|
|
|
6d3351 |
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
|
|
6d3351 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
6d3351 |
---
|
|
|
6d3351 |
docs/formatdomain.html.in | 12 ++++++++++
|
|
|
6d3351 |
docs/schemas/domaincommon.rng | 5 ++++
|
|
|
6d3351 |
src/conf/domain_conf.c | 27 ++++++++++++++++++++--
|
|
|
6d3351 |
src/conf/domain_conf.h | 1 +
|
|
|
6d3351 |
.../qemuxml2argv-virtio-options.xml | 1 +
|
|
|
6d3351 |
5 files changed, 44 insertions(+), 2 deletions(-)
|
|
|
6d3351 |
|
|
|
6d3351 |
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
|
|
|
6d3351 |
index 2e5c669c4a..6be015f866 100644
|
|
|
6d3351 |
--- a/docs/formatdomain.html.in
|
|
|
6d3351 |
+++ b/docs/formatdomain.html.in
|
|
|
6d3351 |
@@ -6133,6 +6133,18 @@ qemu-kvm -net nic,model=? /dev/null
|
|
|
6d3351 |
The optional address sub-element can be used to
|
|
|
6d3351 |
tie the video device to a particular PCI slot.
|
|
|
6d3351 |
|
|
|
6d3351 |
+
|
|
|
6d3351 |
+ driver
|
|
|
6d3351 |
+
|
|
|
6d3351 |
+ The subelement driver can be used to tune the device:
|
|
|
6d3351 |
+
|
|
|
6d3351 |
+ virtio options
|
|
|
6d3351 |
+
|
|
|
6d3351 |
+ Virtio-specific options can also be
|
|
|
6d3351 |
+ set. (Since 3.5.0)
|
|
|
6d3351 |
+
|
|
|
6d3351 |
+
|
|
|
6d3351 |
+
|
|
|
6d3351 |
|
|
|
6d3351 |
|
|
|
6d3351 |
|
|
|
6d3351 |
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
|
|
|
6d3351 |
index 7e80275029..ee49d6eb58 100644
|
|
|
6d3351 |
--- a/docs/schemas/domaincommon.rng
|
|
|
6d3351 |
+++ b/docs/schemas/domaincommon.rng
|
|
|
6d3351 |
@@ -3165,6 +3165,11 @@
|
|
|
6d3351 |
<define name="video">
|
|
|
6d3351 |
<element name="video">
|
|
|
6d3351 |
<optional>
|
|
|
6d3351 |
+ <element name="driver">
|
|
|
6d3351 |
+ <ref name="virtioOptions"/>
|
|
|
6d3351 |
+ </element>
|
|
|
6d3351 |
+ </optional>
|
|
|
6d3351 |
+ <optional>
|
|
|
6d3351 |
<element name="model">
|
|
|
6d3351 |
<choice>
|
|
|
6d3351 |
<attribute name="type">
|
|
|
6d3351 |
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
|
6d3351 |
index 059c006b69..a0de639e51 100644
|
|
|
6d3351 |
--- a/src/conf/domain_conf.c
|
|
|
6d3351 |
+++ b/src/conf/domain_conf.c
|
|
|
6d3351 |
@@ -2339,6 +2339,7 @@ void virDomainVideoDefFree(virDomainVideoDefPtr def)
|
|
|
6d3351 |
virDomainDeviceInfoClear(&def->info);
|
|
|
6d3351 |
|
|
|
6d3351 |
VIR_FREE(def->accel);
|
|
|
6d3351 |
+ VIR_FREE(def->virtio);
|
|
|
6d3351 |
VIR_FREE(def);
|
|
|
6d3351 |
}
|
|
|
6d3351 |
|
|
|
6d3351 |
@@ -13499,11 +13500,13 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node)
|
|
|
6d3351 |
|
|
|
6d3351 |
static virDomainVideoDefPtr
|
|
|
6d3351 |
virDomainVideoDefParseXML(xmlNodePtr node,
|
|
|
6d3351 |
+ xmlXPathContextPtr ctxt,
|
|
|
6d3351 |
const virDomainDef *dom,
|
|
|
6d3351 |
unsigned int flags)
|
|
|
6d3351 |
{
|
|
|
6d3351 |
virDomainVideoDefPtr def;
|
|
|
6d3351 |
xmlNodePtr cur;
|
|
|
6d3351 |
+ xmlNodePtr saved = ctxt->node;
|
|
|
6d3351 |
char *type = NULL;
|
|
|
6d3351 |
char *heads = NULL;
|
|
|
6d3351 |
char *vram = NULL;
|
|
|
6d3351 |
@@ -13512,6 +13515,8 @@ virDomainVideoDefParseXML(xmlNodePtr node,
|
|
|
6d3351 |
char *vgamem = NULL;
|
|
|
6d3351 |
char *primary = NULL;
|
|
|
6d3351 |
|
|
|
6d3351 |
+ ctxt->node = node;
|
|
|
6d3351 |
+
|
|
|
6d3351 |
if (VIR_ALLOC(def) < 0)
|
|
|
6d3351 |
return NULL;
|
|
|
6d3351 |
|
|
|
6d3351 |
@@ -13613,7 +13618,12 @@ virDomainVideoDefParseXML(xmlNodePtr node,
|
|
|
6d3351 |
if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0)
|
|
|
6d3351 |
goto error;
|
|
|
6d3351 |
|
|
|
6d3351 |
+ if (virDomainVirtioOptionsParseXML(ctxt, &def->virtio) < 0)
|
|
|
6d3351 |
+ goto error;
|
|
|
6d3351 |
+
|
|
|
6d3351 |
cleanup:
|
|
|
6d3351 |
+ ctxt->node = saved;
|
|
|
6d3351 |
+
|
|
|
6d3351 |
VIR_FREE(type);
|
|
|
6d3351 |
VIR_FREE(ram);
|
|
|
6d3351 |
VIR_FREE(vram);
|
|
|
6d3351 |
@@ -14412,7 +14422,7 @@ virDomainDeviceDefParse(const char *xmlStr,
|
|
|
6d3351 |
goto error;
|
|
|
6d3351 |
break;
|
|
|
6d3351 |
case VIR_DOMAIN_DEVICE_VIDEO:
|
|
|
6d3351 |
- if (!(dev->data.video = virDomainVideoDefParseXML(node, def, flags)))
|
|
|
6d3351 |
+ if (!(dev->data.video = virDomainVideoDefParseXML(node, ctxt, def, flags)))
|
|
|
6d3351 |
goto error;
|
|
|
6d3351 |
break;
|
|
|
6d3351 |
case VIR_DOMAIN_DEVICE_HOSTDEV:
|
|
|
6d3351 |
@@ -18347,7 +18357,7 @@ virDomainDefParseXML(xmlDocPtr xml,
|
|
|
6d3351 |
virDomainVideoDefPtr video;
|
|
|
6d3351 |
ssize_t insertAt = -1;
|
|
|
6d3351 |
|
|
|
6d3351 |
- if (!(video = virDomainVideoDefParseXML(nodes[i], def, flags)))
|
|
|
6d3351 |
+ if (!(video = virDomainVideoDefParseXML(nodes[i], ctxt, def, flags)))
|
|
|
6d3351 |
goto error;
|
|
|
6d3351 |
|
|
|
6d3351 |
if (video->primary) {
|
|
|
6d3351 |
@@ -19414,6 +19424,10 @@ virDomainVideoDefCheckABIStability(virDomainVideoDefPtr src,
|
|
|
6d3351 |
}
|
|
|
6d3351 |
}
|
|
|
6d3351 |
|
|
|
6d3351 |
+ if (src->virtio && dst->virtio &&
|
|
|
6d3351 |
+ !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio))
|
|
|
6d3351 |
+ return false;
|
|
|
6d3351 |
+
|
|
|
6d3351 |
if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
|
|
|
6d3351 |
return false;
|
|
|
6d3351 |
|
|
|
6d3351 |
@@ -23332,6 +23346,7 @@ virDomainVideoDefFormat(virBufferPtr buf,
|
|
|
6d3351 |
unsigned int flags)
|
|
|
6d3351 |
{
|
|
|
6d3351 |
const char *model = virDomainVideoTypeToString(def->type);
|
|
|
6d3351 |
+ virBuffer driverBuf = VIR_BUFFER_INITIALIZER;
|
|
|
6d3351 |
|
|
|
6d3351 |
if (!model) {
|
|
|
6d3351 |
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
6d3351 |
@@ -23341,6 +23356,14 @@ virDomainVideoDefFormat(virBufferPtr buf,
|
|
|
6d3351 |
|
|
|
6d3351 |
virBufferAddLit(buf, "<video>\n");
|
|
|
6d3351 |
virBufferAdjustIndent(buf, 2);
|
|
|
6d3351 |
+ virDomainVirtioOptionsFormat(&driverBuf, def->virtio);
|
|
|
6d3351 |
+ if (virBufferCheckError(&driverBuf) < 0)
|
|
|
6d3351 |
+ return -1;
|
|
|
6d3351 |
+ if (virBufferUse(&driverBuf)) {
|
|
|
6d3351 |
+ virBufferAddLit(buf, "
|
|
|
6d3351 |
+ virBufferAddBuffer(buf, &driverBuf);
|
|
|
6d3351 |
+ virBufferAddLit(buf, "/>\n");
|
|
|
6d3351 |
+ }
|
|
|
6d3351 |
virBufferAsprintf(buf, "
|
|
|
6d3351 |
model);
|
|
|
6d3351 |
if (def->ram)
|
|
|
6d3351 |
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
|
|
6d3351 |
index 8cb9d5d0b1..b79fb50c79 100644
|
|
|
6d3351 |
--- a/src/conf/domain_conf.h
|
|
|
6d3351 |
+++ b/src/conf/domain_conf.h
|
|
|
6d3351 |
@@ -1376,6 +1376,7 @@ struct _virDomainVideoDef {
|
|
|
6d3351 |
bool primary;
|
|
|
6d3351 |
virDomainVideoAccelDefPtr accel;
|
|
|
6d3351 |
virDomainDeviceInfo info;
|
|
|
6d3351 |
+ virDomainVirtioOptionsPtr virtio;
|
|
|
6d3351 |
};
|
|
|
6d3351 |
|
|
|
6d3351 |
/* graphics console modes */
|
|
|
6d3351 |
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml b/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml
|
|
|
6d3351 |
index b7b95014cd..85d1145263 100644
|
|
|
6d3351 |
--- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml
|
|
|
6d3351 |
+++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml
|
|
|
6d3351 |
@@ -69,6 +69,7 @@
|
|
|
6d3351 |
<input type='mouse' bus='ps2'/>
|
|
|
6d3351 |
<input type='keyboard' bus='ps2'/>
|
|
|
6d3351 |
<video>
|
|
|
6d3351 |
+ <driver iommu='on' ats='on'/>
|
|
|
6d3351 |
<model type='virtio' heads='1' primary='yes'>
|
|
|
6d3351 |
<acceleration accel3d='yes'/>
|
|
|
6d3351 |
</model>
|
|
|
6d3351 |
--
|
|
|
6d3351 |
2.13.1
|
|
|
6d3351 |
|