]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Add virtio-related options to controllers
authorJán Tomko <jtomko@redhat.com>
Mon, 6 Jun 2016 14:50:22 +0000 (16:50 +0200)
committerJán Tomko <jtomko@redhat.com>
Thu, 8 Jun 2017 14:32:33 +0000 (16:32 +0200)
https://bugzilla.redhat.com/show_bug.cgi?id=1283251

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
docs/formatdomain.html.in
docs/schemas/domaincommon.rng
src/conf/domain_conf.c
src/conf/domain_conf.h
tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml

index c867fb8a4776403c4543a400c74fb17b070c8b3a..77242f0339164ee3802e3897f1957e25e8ee8ba5 100644 (file)
         <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
index d106550542938488a60f3a1ea6ac5cf3bca7c132..1d4639227df7eb79e93e9060a8b3155ff849a490 100644 (file)
             <optional>
               <ref name="driverIOThread"/>
             </optional>
+            <ref name="virtioOptions"/>
           </element>
         </optional>
       </interleave>
index a03ed097cf052482c780171aa5bc58d9733fb64e..a3c06c95b5ff3eb15e50004175cc76f44db96e73 100644 (file)
@@ -1886,6 +1886,7 @@ void virDomainControllerDefFree(virDomainControllerDefPtr def)
         return;
 
     virDomainDeviceInfoClear(&def->info);
+    VIR_FREE(def->virtio);
 
     VIR_FREE(def);
 }
@@ -9064,6 +9065,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...
      */
@@ -19240,6 +19244,10 @@ virDomainControllerDefCheckABIStability(virDomainControllerDefPtr src,
         }
     }
 
+    if (src->virtio && dst->virtio &&
+        !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio))
+        return false;
+
     if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
         return false;
 
@@ -21557,6 +21565,8 @@ virDomainControllerDriverFormat(virBufferPtr buf,
     if (def->iothread)
         virBufferAsprintf(&driverBuf, " iothread='%u'", def->iothread);
 
+    virDomainVirtioOptionsFormat(&driverBuf, def->virtio);
+
     if (virBufferUse(&driverBuf)) {
         virBufferAddLit(buf, "<driver");
         virBufferAddBuffer(buf, &driverBuf);
index df64eb0cf28f8ffa57779b4d1a97cb51fd13d6e8..9795767ac498f44919367fb65c646ad1fe701810 100644 (file)
@@ -813,6 +813,7 @@ struct _virDomainControllerDef {
         virDomainUSBControllerOpts usbopts;
     } opts;
     virDomainDeviceInfo info;
+    virDomainVirtioOptionsPtr virtio;
 };
 
 
index 6dd82de64822d1a2b09ebd871fc2082a661f178e..867e56c107492d9d9bad36b9bb9c15c86018b437 100644 (file)
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
     </controller>
     <controller type='scsi' index='0' model='virtio-scsi'>
+      <driver iommu='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='on' ats='on'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
     </controller>
     <filesystem type='mount' accessmode='passthrough'>