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

[libvirt] [PATCH 12/18] Add virtio-related options to controllers



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

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 6852f49..86e0bf8 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -3600,6 +3600,12 @@
         <code>iothread</code> value. The <code>iothread</code> value
         must be within the range 1 to the domain iothreads value.
       </dd>
+      <dt>virtio options</dt>
+      <dd>
+        For virtio controllers,
+        <a href="#elementsVirtio">Virtio-specific options</a> can also be
+        set. (<span class="since">Since 3.5.0</span>)
+      </dd>
     </dl>
     <p>
       USB companion controllers have an optional
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index a77a04f..01c35ae 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2073,6 +2073,7 @@
             <optional>
               <ref name="driverIOThread"/>
             </optional>
+            <ref name="virtioOptions"/>
           </element>
         </optional>
       </interleave>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b81743e..e4b5ca1 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1865,6 +1865,7 @@ void virDomainControllerDefFree(virDomainControllerDefPtr def)
         return;
 
     virDomainDeviceInfoClear(&def->info);
+    VIR_FREE(def->virtio);
 
     VIR_FREE(def);
 }
@@ -9010,6 +9011,9 @@ virDomainControllerDefParseXML(xmlNodePtr node,
         cur = cur->next;
     }
 
+    if (virDomainVirtioOptionsParseXML(ctxt, &def->virtio) < 0)
+        goto error;
+
     /* node is parsed differently from target attributes because
      * someone thought it should be a subelement instead...
      */
@@ -21463,6 +21467,10 @@ virDomainControllerDriverFormat(virBufferPtr buf,
     if (def->iothread)
         virBufferAsprintf(&driverBuf, " iothread='%u'", def->iothread);
 
+    virBufferAddLit(&driverBuf, " ");
+    virDomainVirtioOptionsFormat(&driverBuf, def->virtio);
+    virBufferTrim(&driverBuf, " ", -1);
+
     if (virBufferUse(&driverBuf)) {
         virBufferAddLit(buf, "<driver");
         virBufferAddBuffer(buf, &driverBuf);
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 78a1b06..c6ef95f 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -820,6 +820,7 @@ struct _virDomainControllerDef {
         virDomainUSBControllerOpts usbopts;
     } opts;
     virDomainDeviceInfo info;
+    virDomainVirtioOptionsPtr virtio;
 };
 
 
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml b/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml
index 25a524a..dd84ecd 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml
@@ -33,10 +33,12 @@
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
     </controller>
     <controller type='scsi' index='0' model='virtio-scsi'>
+      <driver iommu_platform='on' ats='on'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
     </controller>
     <controller type='pci' index='0' model='pci-root'/>
     <controller type='virtio-serial' index='0'>
+      <driver iommu_platform='on' ats='on'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
     </controller>
     <filesystem type='mount' accessmode='passthrough'>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-options.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-options.xml
index 25a524a..dd84ecd 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-options.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-options.xml
@@ -33,10 +33,12 @@
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
     </controller>
     <controller type='scsi' index='0' model='virtio-scsi'>
+      <driver iommu_platform='on' ats='on'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
     </controller>
     <controller type='pci' index='0' model='pci-root'/>
     <controller type='virtio-serial' index='0'>
+      <driver iommu_platform='on' ats='on'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
     </controller>
     <filesystem type='mount' accessmode='passthrough'>
-- 
2.10.2


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