From d7a019948e1c1f0400ee174ef60bf0cb32d181f9 Mon Sep 17 00:00:00 2001 Message-Id: From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Fri, 26 May 2017 08:52:56 +0200 Subject: [PATCH] conf: add eim attribute to MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add an attribute to control extended interrupt mode. https://bugzilla.redhat.com/show_bug.cgi?id=1451282 Reviewed-by: Andrea Bolognani (cherry picked from commit dc61d927589b2b122868e6abea86b73caa682226) Signed-off-by: Ján Tomko Also: https://bugzilla.redhat.com/show_bug.cgi?id=1289153 Signed-off-by: Jiri Denemark --- docs/formatdomain.html.in | 13 +++++++++ docs/schemas/domaincommon.rng | 5 ++++ src/conf/domain_conf.c | 21 +++++++++++++++ src/conf/domain_conf.h | 1 + .../qemuxml2argv-intel-iommu-eim.xml | 31 ++++++++++++++++++++++ .../qemuxml2xmlout-intel-iommu-eim.xml | 1 + tests/qemuxml2xmltest.c | 1 + 7 files changed, 73 insertions(+) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-eim.xml create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-eim.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 43a75c1ee..e886e4e17 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -7433,6 +7433,19 @@ qemu-kvm -net nic,model=? /dev/null Since 3.4.0 (QEMU/KVM only)

+
eim
+
+

+ The eim attribute (with possible values + on and off) can be used to + configure Extended Interrupt Mode. A q35 domain with + split I/O APIC (as described in + hypervisor features), + and both interrupt remapping and EIM turned on for + the IOMMU, will be able to use more than 255 vCPUs. + Since 3.4.0 (QEMU/KVM only) +

+
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 12ccbd4e2..af7824aa0 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3905,6 +3905,11 @@ + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 370916396..4404b8f73 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -14176,6 +14176,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; @@ -19847,6 +19856,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; } @@ -24170,6 +24187,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"); } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 825158a7d..980aafa66 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -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 index 000000000..8642ed349 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-eim.xml @@ -0,0 +1,31 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 288 + + hvm + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + +
+ + + + + + + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-eim.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-eim.xml new file mode 120000 index 000000000..9fbec36dc --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-eim.xml @@ -0,0 +1 @@ +../qemuxml2argvdata/qemuxml2argv-intel-iommu-eim.xml \ No newline at end of file diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index e1938421a..6283da409 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1130,6 +1130,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); -- 2.13.0