[PATCHv2 09/11] Add virtio revision attribute to input devices

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

 



<input type='mouse' bus='virtio'>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x0e' function='0x0'/>
  <virtio revision='1.0'/>
</input>
<input type='keyboard' bus='virtio'>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x10' function='0x0'/>
  <virtio revision='1.0'/>
</input>
<input type='tablet' bus='virtio'>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x11' function='0x0'/>
  <virtio revision='1.0'/>
</input>
<input type='passthrough' bus='virtio'>
  <source evdev='/dev/input/event1234'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x12' function='0x0'/>
  <virtio revision='1.0'/>
</input>

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

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 606b56c..8c71b8f 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -5235,6 +5235,14 @@ qemu-kvm -net nic,model=? /dev/null
       event device passed through to guests. (KVM only)
     </p>
 
+    <p>
+      For virtio input devices, an optional <code>virtio</code> element
+      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>
+
     <h4><a name="elementsHub">Hub devices</a></h4>
 
     <p>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index fb92f2e..2b4fa7c 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3828,6 +3828,9 @@
       <optional>
         <ref name="address"/>
       </optional>
+      <optional>
+        <ref name="virtioRevision"/>
+      </optional>
     </element>
   </define>
   <define name="hub">
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index fc344b2..cef024c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -10775,6 +10775,9 @@ virDomainInputDefParseXML(const virDomainDef *dom,
         goto error;
     }
 
+    if (virDomainVirtioRevisionParseXML(ctxt, &def->virtio_rev) < 0)
+        goto error;
+
  cleanup:
     VIR_FREE(evdev);
     VIR_FREE(type);
@@ -21992,6 +21995,7 @@ virDomainInputDefFormat(virBufferPtr buf,
     virBufferEscapeString(&childbuf, "<source evdev='%s'/>\n", def->source.evdev);
     if (virDomainDeviceInfoFormat(&childbuf, &def->info, flags) < 0)
         return -1;
+    virDomainVirtioRevisionFormatXML(&childbuf, def->virtio_rev);
 
     if (!virBufferUse(&childbuf)) {
         virBufferAddLit(buf, "/>\n");
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 254d3db..c864810 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1228,6 +1228,7 @@ struct _virDomainInputDef {
         char *evdev;
     } source;
     virDomainDeviceInfo info;
+    virBitmapPtr virtio_rev;
 };
 
 typedef enum {
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml b/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
index cfb8581..2bdfe82 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-revision.xml
@@ -75,16 +75,20 @@
     </interface>
     <input type='mouse' bus='virtio'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x0e' function='0x0'/>
+      <virtio revision='1.0'/>
     </input>
     <input type='keyboard' bus='virtio'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x10' function='0x0'/>
+      <virtio revision='1.0'/>
     </input>
     <input type='tablet' bus='virtio'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x11' function='0x0'/>
+      <virtio revision='1.0'/>
     </input>
     <input type='passthrough' bus='virtio'>
       <source evdev='/dev/input/event1234'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x12' function='0x0'/>
+      <virtio revision='1.0'/>
     </input>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
index cfb8581..2bdfe82 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-revision.xml
@@ -75,16 +75,20 @@
     </interface>
     <input type='mouse' bus='virtio'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x0e' function='0x0'/>
+      <virtio revision='1.0'/>
     </input>
     <input type='keyboard' bus='virtio'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x10' function='0x0'/>
+      <virtio revision='1.0'/>
     </input>
     <input type='tablet' bus='virtio'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x11' function='0x0'/>
+      <virtio revision='1.0'/>
     </input>
     <input type='passthrough' bus='virtio'>
       <source evdev='/dev/input/event1234'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x12' function='0x0'/>
+      <virtio revision='1.0'/>
     </input>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
-- 
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]