From abbea18f4b3747d738d05f36884dda3202128b65 Mon Sep 17 00:00:00 2001 Message-Id: From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Tue, 16 May 2017 10:44:52 +0200 Subject: [PATCH] conf: add to MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a new element with a driver attribute. Possible values are qemu and kvm. With 'qemu', the I/O APIC can be put in the userspace even for KVM domains. https://bugzilla.redhat.com/show_bug.cgi?id=1427005 (cherry picked from commit 8023b21a95f271e51810de7f1362e609eaadc1e4) Signed-off-by: Ján Tomko Signed-off-by: Jiri Denemark --- docs/formatdomain.html.in | 9 ++++++ docs/schemas/domaincommon.rng | 15 ++++++++++ src/conf/domain_conf.c | 33 +++++++++++++++++++++- src/conf/domain_conf.h | 11 ++++++++ .../qemuxml2argv-intel-iommu-ioapic.xml | 29 +++++++++++++++++++ .../qemuxml2xmlout-intel-iommu-ioapic.xml | 1 + tests/qemuxml2xmltest.c | 1 + 7 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-ioapic.xml create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-ioapic.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 7e55b0327..869c1f73e 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -1675,6 +1675,7 @@ </kvm> <pvspinlock state='on'/> <gic version='2'/> + <ioapic driver='qemu'/> </features> ... @@ -1836,6 +1837,14 @@ for hypervisor to decide. Since 2.1.0 +
ioapic
+
Tune the I/O APIC. Possible values for the + driver attribute are: + kvm (default for KVM domains) + and qemu which puts I/O APIC in userspace + which is also known as a split I/O APIC mode. + Since 3.4.0 (QEMU/KVM only) +

Time keeping

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 7271f0113..c72ba7e97 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -4515,6 +4515,9 @@ + + + @@ -4693,6 +4696,18 @@ + + + + + qemu + kvm + + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 4096b9caf..d5c4f6ddd 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -141,7 +141,8 @@ VIR_ENUM_IMPL(virDomainFeature, VIR_DOMAIN_FEATURE_LAST, "pmu", "vmport", "gic", - "smm") + "smm", + "ioapic") VIR_ENUM_IMPL(virDomainCapabilitiesPolicy, VIR_DOMAIN_CAPABILITIES_POLICY_LAST, "default", @@ -859,6 +860,11 @@ VIR_ENUM_IMPL(virDomainLoader, "rom", "pflash") +VIR_ENUM_IMPL(virDomainIOAPIC, + VIR_DOMAIN_IOAPIC_LAST, + "qemu", + "kvm") + /* Internal mapping: subset of block job types that can be present in * XML (remaining types are not two-phase). */ VIR_ENUM_DECL(virDomainBlockJob) @@ -17518,6 +17524,24 @@ virDomainDefParseXML(xmlDocPtr xml, ctxt->node = node; break; + case VIR_DOMAIN_FEATURE_IOAPIC: + node = ctxt->node; + ctxt->node = nodes[i]; + tmp = virXPathString("string(./@driver)", ctxt); + if (tmp) { + int value = virDomainIOAPICTypeFromString(tmp); + if (value < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unknown driver mode: %s"), + tmp); + goto error; + } + def->ioapic = value; + def->features[val] = VIR_TRISTATE_SWITCH_ON; + } + ctxt->node = node; + break; + /* coverity[dead_error_begin] */ case VIR_DOMAIN_FEATURE_LAST: break; @@ -24598,6 +24622,13 @@ virDomainDefFormatInternal(virDomainDefPtr def, } break; + case VIR_DOMAIN_FEATURE_IOAPIC: + if (def->features[i] == VIR_TRISTATE_SWITCH_ON) { + virBufferAsprintf(buf, "\n", + virDomainIOAPICTypeToString(def->ioapic)); + } + break; + /* coverity[dead_error_begin] */ case VIR_DOMAIN_FEATURE_LAST: break; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index f1e9fc2ba..4cb37b1fc 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1670,6 +1670,7 @@ typedef enum { VIR_DOMAIN_FEATURE_VMPORT, VIR_DOMAIN_FEATURE_GIC, VIR_DOMAIN_FEATURE_SMM, + VIR_DOMAIN_FEATURE_IOAPIC, VIR_DOMAIN_FEATURE_LAST } virDomainFeature; @@ -1809,6 +1810,15 @@ struct _virDomainLoaderDef { void virDomainLoaderDefFree(virDomainLoaderDefPtr loader); +typedef enum { + VIR_DOMAIN_IOAPIC_QEMU = 0, + VIR_DOMAIN_IOAPIC_KVM, + + VIR_DOMAIN_IOAPIC_LAST +} virDomainIOAPIC; + +VIR_ENUM_DECL(virDomainIOAPIC); + /* Operating system configuration data & machine / arch */ typedef struct _virDomainOSDef virDomainOSDef; typedef virDomainOSDef *virDomainOSDefPtr; @@ -2258,6 +2268,7 @@ struct _virDomainDef { unsigned int hyperv_spinlocks; virGICVersion gic_version; char *hyperv_vendor_id; + virDomainIOAPIC ioapic; /* These options are of type virTristateSwitch: ON = keep, OFF = drop */ int caps_features[VIR_DOMAIN_CAPS_FEATURE_LAST]; diff --git a/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-ioapic.xml b/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-ioapic.xml new file mode 100644 index 000000000..284d63a30 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-ioapic.xml @@ -0,0 +1,29 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + +
+ + + + + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-ioapic.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-ioapic.xml new file mode 120000 index 000000000..42d17b2c0 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-ioapic.xml @@ -0,0 +1 @@ +../qemuxml2argvdata/qemuxml2argv-intel-iommu-ioapic.xml \ No newline at end of file diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index ff533ab19..0482ad9cb 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1128,6 +1128,7 @@ mymain(void) DO_TEST("intel-iommu-machine", QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_MACHINE_IOMMU); + DO_TEST("intel-iommu-ioapic", NONE); DO_TEST("cpu-check-none", NONE); DO_TEST("cpu-check-partial", NONE); -- 2.13.0