]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: add eim attribute to <iommu><driver>
authorJán Tomko <jtomko@redhat.com>
Wed, 17 May 2017 15:22:30 +0000 (17:22 +0200)
committerJán Tomko <jtomko@redhat.com>
Fri, 26 May 2017 06:11:25 +0000 (08:11 +0200)
Add an attribute to control extended interrupt mode.

https://bugzilla.redhat.com/show_bug.cgi?id=1451282

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
docs/formatdomain.html.in
docs/schemas/domaincommon.rng
src/conf/domain_conf.c
src/conf/domain_conf.h
tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-eim.xml [new file with mode: 0644]
tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-eim.xml [new symlink]
tests/qemuxml2xmltest.c

index 3135db4a294eb5df8fd89af324aa27024ff453a5..07208eef89a88e29fd69f45722e82e8bbd19f152 100644 (file)
@@ -7436,6 +7436,19 @@ qemu-kvm -net nic,model=? /dev/null
               <span class="since">Since 3.4.0</span> (QEMU/KVM only)
             </p>
           </dd>
+          <dt><code>eim</code></dt>
+          <dd>
+            <p>
+              The <code>eim</code> attribute (with possible values
+              <code>on</code> and <code>off</code>) can be used to
+              configure Extended Interrupt Mode. A q35 domain with
+              split I/O APIC (as described in
+              <a href="#elementsFeatures">hypervisor features</a>),
+              and both interrupt remapping and EIM turned on for
+              the IOMMU, will be able to use more than 255 vCPUs.
+              <span class="since">Since 3.4.0</span> (QEMU/KVM only)
+            </p>
+          </dd>
         </dl>
       </dd>
     </dl>
index f88e84ab6bd239895f295447fc5a998a04ee6c9f..144c28159611fac3c83fdb4226fa6b64ffb46b5f 100644 (file)
               <ref name="virOnOff"/>
             </attribute>
           </optional>
+          <optional>
+            <attribute name="eim">
+              <ref name="virOnOff"/>
+            </attribute>
+          </optional>
         </element>
       </optional>
     </element>
index 43ffdd2164d90d8401abe8739e4189b3894965f9..c7e20b8ba13f5cf48eda3b80339b3824d9cb89e8 100644 (file)
@@ -14202,6 +14202,15 @@ virDomainIOMMUDefParseXML(xmlNodePtr node,
         iommu->caching_mode = val;
     }
 
+    VIR_FREE(tmp);
+    if ((tmp = virXPathString("string(./driver/@eim)", ctxt))) {
+        if ((val = virTristateSwitchTypeFromString(tmp)) < 0) {
+            virReportError(VIR_ERR_XML_ERROR, _("unknown eim value: %s"), tmp);
+            goto cleanup;
+        }
+        iommu->eim = val;
+    }
+
     ret = iommu;
     iommu = NULL;
 
@@ -19920,6 +19929,14 @@ virDomainIOMMUDefCheckABIStability(virDomainIOMMUDefPtr src,
                        virTristateSwitchTypeToString(src->caching_mode));
         return false;
     }
+    if (src->eim != dst->eim) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("Target domain IOMMU device eim value '%s' "
+                         "does not match source '%s'"),
+                       virTristateSwitchTypeToString(dst->eim),
+                       virTristateSwitchTypeToString(src->eim));
+        return false;
+    }
     return true;
 }
 
@@ -24238,6 +24255,10 @@ virDomainIOMMUDefFormat(virBufferPtr buf,
             virBufferAsprintf(&childBuf, " caching_mode='%s'",
                               virTristateSwitchTypeToString(iommu->caching_mode));
         }
+        if (iommu->eim != VIR_TRISTATE_SWITCH_ABSENT) {
+            virBufferAsprintf(&childBuf, " eim='%s'",
+                              virTristateSwitchTypeToString(iommu->eim));
+        }
         virBufferAddLit(&childBuf, "/>\n");
     }
 
index 34a35965b4bacd371d718d2a9c8e8d3ab3c0968b..83e0672691430b8272791633938c0ff1bb6bc866 100644 (file)
@@ -2211,6 +2211,7 @@ struct _virDomainIOMMUDef {
     virDomainIOMMUModel model;
     virTristateSwitch intremap;
     virTristateSwitch caching_mode;
+    virTristateSwitch eim;
 };
 /*
  * Guest VM main configuration
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-eim.xml b/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-eim.xml
new file mode 100644 (file)
index 0000000..8642ed3
--- /dev/null
@@ -0,0 +1,31 @@
+<domain type='kvm'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>288</vcpu>
+  <os>
+    <type arch='x86_64' machine='q35'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <features>
+    <ioapic driver='qemu'/>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <controller type='pci' index='0' model='pcie-root'/>
+    <controller type='sata' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
+    </controller>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <memballoon model='none'/>
+    <iommu model='intel'>
+      <driver intremap='on' eim='on'/>
+    </iommu>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-eim.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-eim.xml
new file mode 120000 (symlink)
index 0000000..9fbec36
--- /dev/null
@@ -0,0 +1 @@
+../qemuxml2argvdata/qemuxml2argv-intel-iommu-eim.xml
\ No newline at end of file
index fed74d075124d2a5e4a9caa51d0c2673d03feb27..fff13e2361326ee1806cc6bb2ff2693208d65b9a 100644 (file)
@@ -1127,6 +1127,7 @@ mymain(void)
             QEMU_CAPS_MACHINE_IOMMU);
     DO_TEST("intel-iommu-ioapic", NONE);
     DO_TEST("intel-iommu-caching-mode", NONE);
+    DO_TEST("intel-iommu-eim", NONE);
 
     DO_TEST("cpu-check-none", NONE);
     DO_TEST("cpu-check-partial", NONE);