[PATCHv3 08/11] Add virtio revision attribute to video

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



<video>
  <model type='virtio' heads='1' primary='yes'/>
  <virtio revision='1.0'/>
</video>

https://bugzilla.redhat.com/show_bug.cgi?id=1227354
---
 docs/formatdomain.html.in                                 | 10 ++++++++++
 docs/schemas/domaincommon.rng                             |  3 +++
 src/conf/domain_conf.c                                    | 15 +++++++++++++--
 src/conf/domain_conf.h                                    |  1 +
 tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml   |  1 +
 .../qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml |  1 +
 6 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 0f9fd78..8485e9b 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -5646,6 +5646,16 @@ qemu-kvm -net nic,model=? /dev/null
         The optional <code>address</code> sub-element can be used to
         tie the video device to a particular PCI slot.
       </dd>
+
+      <dt><code>virtio</code></dt>
+      <dd>
+        <p>
+          Optional <code>virtio</code> elements can be used to enforce a particular
+          virtio revision in QEMU. The valid values for the <code>revision</code>
+          are <code>0.9</code> and <code>1.0</code>.
+          <span class='since'>Since 2.2.0</span>
+        </p>
+      </dd>
     </dl>
 
     <h4><a name="elementsConsole">Consoles, serial, parallel &amp; channel devices</a></h4>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 2909edf..fb92f2e 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3150,6 +3150,9 @@
       <optional>
         <ref name="address"/>
       </optional>
+      <optional>
+        <ref name="virtioRevision"/>
+      </optional>
     </element>
   </define>
   <!--
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 700b2fc..fc344b2 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -12650,11 +12650,13 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node)
 
 static virDomainVideoDefPtr
 virDomainVideoDefParseXML(xmlNodePtr node,
+                          xmlXPathContextPtr ctxt,
                           const virDomainDef *dom,
                           unsigned int flags)
 {
     virDomainVideoDefPtr def;
     xmlNodePtr cur;
+    xmlNodePtr saved = ctxt->node;
     char *type = NULL;
     char *heads = NULL;
     char *vram = NULL;
@@ -12663,6 +12665,8 @@ virDomainVideoDefParseXML(xmlNodePtr node,
     char *vgamem = NULL;
     char *primary = NULL;
 
+    ctxt->node = node;
+
     if (VIR_ALLOC(def) < 0)
         return NULL;
 
@@ -12764,7 +12768,12 @@ virDomainVideoDefParseXML(xmlNodePtr node,
     if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0)
         goto error;
 
+    if (virDomainVirtioRevisionParseXML(ctxt, &def->virtio_rev) < 0)
+        goto error;
+
  cleanup:
+    ctxt->node = saved;
+
     VIR_FREE(type);
     VIR_FREE(ram);
     VIR_FREE(vram);
@@ -13459,7 +13468,7 @@ virDomainDeviceDefParse(const char *xmlStr,
             goto error;
         break;
     case VIR_DOMAIN_DEVICE_VIDEO:
-        if (!(dev->data.video = virDomainVideoDefParseXML(node, def, flags)))
+        if (!(dev->data.video = virDomainVideoDefParseXML(node, ctxt, def, flags)))
             goto error;
         break;
     case VIR_DOMAIN_DEVICE_HOSTDEV:
@@ -17125,7 +17134,7 @@ virDomainDefParseXML(xmlDocPtr xml,
         virDomainVideoDefPtr video;
         ssize_t insertAt = -1;
 
-        if (!(video = virDomainVideoDefParseXML(nodes[i], def, flags)))
+        if (!(video = virDomainVideoDefParseXML(nodes[i], ctxt, def, flags)))
             goto error;
 
         if (video->primary) {
@@ -21942,6 +21951,8 @@ virDomainVideoDefFormat(virBufferPtr buf,
     if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
         return -1;
 
+    virDomainVirtioRevisionFormatXML(buf, def->virtio_rev);
+
     virBufferAdjustIndent(buf, -2);
     virBufferAddLit(buf, "</video>\n");
     return 0;
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 6ff9d43..a80ac48 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1321,6 +1321,7 @@ struct _virDomainVideoDef {
     bool primary;
     virDomainVideoAccelDefPtr accel;
     virDomainDeviceInfo info;
+    virBitmapPtr virtio_rev;
 };
 
 /* graphics console modes */
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml b/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
index c3a4654..cfb8581 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
@@ -93,6 +93,7 @@
         <acceleration accel3d='yes'/>
       </model>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+      <virtio revision='1.0'/>
     </video>
     <memballoon model='virtio'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
index c3a4654..cfb8581 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
@@ -93,6 +93,7 @@
         <acceleration accel3d='yes'/>
       </model>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+      <virtio revision='1.0'/>
     </video>
     <memballoon model='virtio'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/>
-- 
2.7.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]