+@@ -7407,6 +7409,26 @@ qemu-kvm -net nic,model=? /dev/null
+ Currently only the intel model is supported.
+
+
++
driver
++
++
++ The driver subelement can be used to configure
++ additional options:
++
++
++
intremap
++
++
++ The intremap attribute with possible values
++ on and off can be used to
++ turn on interrupt remapping, a part of the VT-d functionality.
++ Currently this requires split I/O APIC
++ (<ioapic driver='qemu'/>).
++ Since 3.4.0 (QEMU/KVM only)
++
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)
++
+diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
+index 281309ec0..64f718b70 100644
+--- a/docs/schemas/domaincommon.rng
++++ b/docs/schemas/domaincommon.rng
+@@ -4569,6 +4569,9 @@
+
+
+
++
++
++
+
+
+
+@@ -4747,6 +4750,18 @@
+
+
+
++
++
++
++
++ qemu
++ kvm
++
++
++
++
++
++
+
+
+
+diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
+index 0ff216e3a..29b04d362 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)
+@@ -17527,6 +17533,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;
+@@ -24627,6 +24651,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 09fb7aada..82b4785a6 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 2dccde746..0f00b20d3 100644
+--- a/tests/qemuxml2xmltest.c
++++ b/tests/qemuxml2xmltest.c
+@@ -1122,6 +1122,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);
diff --git a/935d927a-conf-iommu-ABI-stability-check.patch b/935d927a-conf-iommu-ABI-stability-check.patch
new file mode 100644
index 0000000..6c6d7c3
--- /dev/null
+++ b/935d927a-conf-iommu-ABI-stability-check.patch
@@ -0,0 +1,52 @@
+commit 935d927aa881753fff30f6236eedcf9680bca638
+Author: Ján Tomko
+Date: Fri May 12 16:59:45 2017 +0200
+
+ conf: add ABI stability checks for IOMMU options
+
+ https://bugzilla.redhat.com/show_bug.cgi?id=1427005
+
+Index: libvirt-3.3.0/src/conf/domain_conf.c
+===================================================================
+--- libvirt-3.3.0.orig/src/conf/domain_conf.c
++++ libvirt-3.3.0/src/conf/domain_conf.c
+@@ -19691,6 +19691,16 @@ virDomainDefFeaturesCheckABIStability(vi
+ }
+ }
+
++ /* ioapic */
++ if (src->ioapic != dst->ioapic) {
++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
++ _("State of ioapic differs: "
++ "source: '%s', destination: '%s'"),
++ virDomainIOAPICTypeToString(src->ioapic),
++ virDomainIOAPICTypeToString(dst->ioapic));
++ return false;
++ }
++
+ return true;
+ }
+
+@@ -19830,6 +19840,22 @@ virDomainIOMMUDefCheckABIStability(virDo
+ virDomainIOMMUModelTypeToString(src->model));
+ return false;
+ }
++ if (src->intremap != dst->intremap) {
++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
++ _("Target domain IOMMU device intremap value '%s' "
++ "does not match source '%s'"),
++ virTristateSwitchTypeToString(dst->intremap),
++ virTristateSwitchTypeToString(src->intremap));
++ return false;
++ }
++ if (src->caching_mode != dst->caching_mode) {
++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
++ _("Target domain IOMMU device caching mode '%s' "
++ "does not match source '%s'"),
++ virTristateSwitchTypeToString(dst->caching_mode),
++ virTristateSwitchTypeToString(src->caching_mode));
++ return false;
++ }
+ return true;
+ }
+
diff --git a/a5691448-qemu-iommu-cache-mode.patch b/a5691448-qemu-iommu-cache-mode.patch
new file mode 100644
index 0000000..3ba73fb
--- /dev/null
+++ b/a5691448-qemu-iommu-cache-mode.patch
@@ -0,0 +1,136 @@
+commit a56914486ca67f921ee6e3ce26b5787fccb47155
+Author: Ján Tomko
+Date: Fri Mar 17 08:28:04 2017 +0100
+
+ qemu: format caching-mode on iommu command line
+
+ Format the caching-mode option for the intel-iommu device,
+ based on its attribute value.
+
+ https://bugzilla.redhat.com/show_bug.cgi?id=1427005
+
+Index: libvirt-3.3.0/src/qemu/qemu_capabilities.c
+===================================================================
+--- libvirt-3.3.0.orig/src/qemu/qemu_capabilities.c
++++ libvirt-3.3.0/src/qemu/qemu_capabilities.c
+@@ -370,6 +370,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAS
+ "kernel-irqchip", /* 255 */
+ "kernel-irqchip.split",
+ "intel-iommu.intremap",
++ "intel-iommu.caching-mode",
+ );
+
+
+@@ -1723,6 +1724,7 @@ static struct virQEMUCapsStringFlags vir
+
+ static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsIntelIOMMU[] = {
+ { "intremap", QEMU_CAPS_INTEL_IOMMU_INTREMAP },
++ { "caching-mode", QEMU_CAPS_INTEL_IOMMU_CACHING_MODE },
+ };
+
+ /* see documentation for virQEMUCapsQMPSchemaGetByPath for the query format */
+Index: libvirt-3.3.0/src/qemu/qemu_capabilities.h
+===================================================================
+--- libvirt-3.3.0.orig/src/qemu/qemu_capabilities.h
++++ libvirt-3.3.0/src/qemu/qemu_capabilities.h
+@@ -408,6 +408,7 @@ typedef enum {
+ QEMU_CAPS_MACHINE_KERNEL_IRQCHIP, /* -machine kernel_irqchip */
+ QEMU_CAPS_MACHINE_KERNEL_IRQCHIP_SPLIT, /* -machine kernel_irqchip=split */
+ QEMU_CAPS_INTEL_IOMMU_INTREMAP, /* intel-iommu.intremap */
++ QEMU_CAPS_INTEL_IOMMU_CACHING_MODE, /* intel-iommu.caching-mode */
+
+ QEMU_CAPS_LAST /* this must always be the last item */
+ } virQEMUCapsFlags;
+Index: libvirt-3.3.0/src/qemu/qemu_command.c
+===================================================================
+--- libvirt-3.3.0.orig/src/qemu/qemu_command.c
++++ libvirt-3.3.0/src/qemu/qemu_command.c
+@@ -6694,6 +6694,13 @@ qemuBuildIOMMUCommandLine(virCommandPtr
+ "with this QEMU binary"));
+ return -1;
+ }
++ if (iommu->caching_mode != VIR_TRISTATE_SWITCH_ABSENT &&
++ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_INTEL_IOMMU_CACHING_MODE)) {
++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
++ _("iommu: caching mode is not supported "
++ "with this QEMU binary"));
++ return -1;
++ }
+ break;
+ case VIR_DOMAIN_IOMMU_MODEL_LAST:
+ break;
+@@ -6723,6 +6730,10 @@ qemuBuildIOMMUCommandLine(virCommandPtr
+ virBufferAsprintf(&opts, ",intremap=%s",
+ virTristateSwitchTypeToString(iommu->intremap));
+ }
++ if (iommu->caching_mode != VIR_TRISTATE_SWITCH_ABSENT) {
++ virBufferAsprintf(&opts, ",caching-mode=%s",
++ virTristateSwitchTypeToString(iommu->caching_mode));
++ }
+ case VIR_DOMAIN_IOMMU_MODEL_LAST:
+ break;
+ }
+Index: libvirt-3.3.0/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
+===================================================================
+--- libvirt-3.3.0.orig/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
++++ libvirt-3.3.0/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
+@@ -213,6 +213,7 @@
+
+
+
++
+ 2009000
+ 0
+ (v2.9.0)
+Index: libvirt-3.3.0/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-caching-mode.args
+===================================================================
+--- /dev/null
++++ libvirt-3.3.0/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-caching-mode.args
+@@ -0,0 +1,25 @@
++LC_ALL=C \
++PATH=/bin \
++HOME=/home/test \
++USER=test \
++LOGNAME=test \
++QEMU_AUDIO_DRV=none \
++/usr/bin/qemu-system-x86_64 \
++-name QEMUGuest1 \
++-S \
++-machine q35,accel=tcg \
++-m 214 \
++-smp 1,sockets=1,cores=1,threads=1 \
++-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
++-nographic \
++-nodefaults \
++-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \
++-no-acpi \
++-boot c \
++-device intel-iommu,intremap=on,caching-mode=on \
++-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \
++-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x0 \
++-device ioh3420,port=0x10,chassis=3,id=pci.3,bus=pcie.0,addr=0x2 \
++-device ich9-usb-ehci1,id=usb,bus=pci.2,addr=0x2.0x7 \
++-device rtl8139,vlan=0,id=net0,mac=52:54:00:ab:0c:5c,bus=pci.2,addr=0x1 \
++-net user,vlan=0,name=hostnet0
+Index: libvirt-3.3.0/tests/qemuxml2argvtest.c
+===================================================================
+--- libvirt-3.3.0.orig/tests/qemuxml2argvtest.c
++++ libvirt-3.3.0/tests/qemuxml2argvtest.c
+@@ -2515,6 +2515,17 @@ mymain(void)
+ QEMU_CAPS_MACHINE_KERNEL_IRQCHIP_SPLIT,
+ QEMU_CAPS_INTEL_IOMMU_INTREMAP,
+ QEMU_CAPS_DEVICE_INTEL_IOMMU);
++ DO_TEST("intel-iommu-caching-mode",
++ QEMU_CAPS_MACHINE_OPT,
++ QEMU_CAPS_DEVICE_PCI_BRIDGE,
++ QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE,
++ QEMU_CAPS_DEVICE_IOH3420,
++ QEMU_CAPS_ICH9_AHCI,
++ QEMU_CAPS_PCI_MULTIFUNCTION,
++ QEMU_CAPS_ICH9_USB_EHCI1,
++ QEMU_CAPS_DEVICE_INTEL_IOMMU,
++ QEMU_CAPS_INTEL_IOMMU_INTREMAP,
++ QEMU_CAPS_INTEL_IOMMU_CACHING_MODE);
+
+ DO_TEST("cpu-hotplug-startup", QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS);
+
diff --git a/aeda1b8c-qemu-no-error-shutdown.patch b/aeda1b8c-qemu-no-error-shutdown.patch
new file mode 100644
index 0000000..6d86655
--- /dev/null
+++ b/aeda1b8c-qemu-no-error-shutdown.patch
@@ -0,0 +1,55 @@
+commit aeda1b8c56dc58b0a413acc61bbea938b40499e1
+Author: Christian Ehrhardt
+Date: Thu Mar 9 10:54:32 2017 +0100
+
+ qemu: monitor: do not report error on shutdown
+
+ If a shutdown is expected because it was triggered via libvirt we can
+ also expect the monitor to close. In those cases do not report an
+ internal error like:
+ "internal error: End of file from qemu monitor"
+
+ Signed-off-by: Christian Ehrhardt
+
+Index: libvirt-3.3.0/src/qemu/qemu_monitor.c
+===================================================================
+--- libvirt-3.3.0.orig/src/qemu/qemu_monitor.c
++++ libvirt-3.3.0/src/qemu/qemu_monitor.c
+@@ -63,6 +63,7 @@ struct _qemuMonitor {
+ int fd;
+ int watch;
+ int hasSendFD;
++ int willhangup;
+
+ virDomainObjPtr vm;
+
+@@ -693,8 +694,10 @@ qemuMonitorIO(int watch, int fd, int eve
+ if (events & VIR_EVENT_HANDLE_HANGUP) {
+ hangup = true;
+ if (!error) {
+- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+- _("End of file from qemu monitor"));
++ if (!mon->willhangup) {
++ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
++ _("End of file from qemu monitor"));
++ }
+ eof = true;
+ events &= ~VIR_EVENT_HANDLE_HANGUP;
+ }
+@@ -733,7 +736,7 @@ qemuMonitorIO(int watch, int fd, int eve
+ if (mon->lastError.code != VIR_ERR_OK) {
+ /* Already have an error, so clear any new error */
+ virResetLastError();
+- } else {
++ } else if (!mon->willhangup) {
+ virErrorPtr err = virGetLastError();
+ if (!err)
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+@@ -1327,6 +1330,7 @@ qemuMonitorEmitShutdown(qemuMonitorPtr m
+ {
+ int ret = -1;
+ VIR_DEBUG("mon=%p", mon);
++ mon->willhangup = 1;
+
+ QEMU_MONITOR_CALLBACK(mon, ret, domainShutdown, mon->vm);
+ return ret;
diff --git a/d12781b4-conf-iommu-cache-mode-attr.patch b/d12781b4-conf-iommu-cache-mode-attr.patch
new file mode 100644
index 0000000..f5526a0
--- /dev/null
+++ b/d12781b4-conf-iommu-cache-mode-attr.patch
@@ -0,0 +1,222 @@
+commit d12781b47eb0c9f3a498d88b632c327aa08aaf8a
+Author: Ján Tomko
+Date: Fri Mar 17 08:27:49 2017 +0100
+
+ conf: add caching_mode attribute to iommu device
+
+ Add a new attribute to control the caching mode.
+
+ https://bugzilla.redhat.com/show_bug.cgi?id=1427005
+
+Index: libvirt-3.3.0/docs/formatdomain.html.in
+===================================================================
+--- libvirt-3.3.0.orig/docs/formatdomain.html.in
++++ libvirt-3.3.0/docs/formatdomain.html.in
+@@ -7427,6 +7427,15 @@ qemu-kvm -net nic,model=? /dev/null
+ Since 3.4.0 (QEMU/KVM only)
+
+
++
caching_mode
++
++
++ The caching_mode attribute with possible values
++ on and off can be used to
++ turn on the VT-d caching mode (useful for assigned devices).
++ Since 3.4.0 (QEMU/KVM only)
++
++
+
+
+
+Index: libvirt-3.3.0/docs/schemas/domaincommon.rng
+===================================================================
+--- libvirt-3.3.0.orig/docs/schemas/domaincommon.rng
++++ libvirt-3.3.0/docs/schemas/domaincommon.rng
+@@ -3954,6 +3954,11 @@
+
+
+
++
++
++
++
++
+
+
+
+Index: libvirt-3.3.0/src/conf/domain_conf.c
+===================================================================
+--- libvirt-3.3.0.orig/src/conf/domain_conf.c
++++ libvirt-3.3.0/src/conf/domain_conf.c
+@@ -14176,6 +14176,15 @@ virDomainIOMMUDefParseXML(xmlNodePtr nod
+ iommu->intremap = val;
+ }
+
++ VIR_FREE(tmp);
++ if ((tmp = virXPathString("string(./driver/@caching_mode)", ctxt))) {
++ if ((val = virTristateSwitchTypeFromString(tmp)) < 0) {
++ virReportError(VIR_ERR_XML_ERROR, _("unknown caching_mode value: %s"), tmp);
++ goto cleanup;
++ }
++ iommu->caching_mode = val;
++ }
++
+ ret = iommu;
+ iommu = NULL;
+
+@@ -24143,9 +24152,18 @@ virDomainIOMMUDefFormat(virBufferPtr buf
+
+ virBufferAdjustIndent(&childBuf, virBufferGetIndent(buf, false) + 2);
+
+- if (iommu->intremap != VIR_TRISTATE_SWITCH_ABSENT) {
+- virBufferAsprintf(&childBuf, "\n",
+- virTristateSwitchTypeToString(iommu->intremap));
++ if (iommu->intremap != VIR_TRISTATE_SWITCH_ABSENT ||
++ iommu->caching_mode != VIR_TRISTATE_SWITCH_ABSENT) {
++ virBufferAddLit(&childBuf, "intremap != VIR_TRISTATE_SWITCH_ABSENT) {
++ virBufferAsprintf(&childBuf, " intremap='%s'",
++ virTristateSwitchTypeToString(iommu->intremap));
++ }
++ if (iommu->caching_mode != VIR_TRISTATE_SWITCH_ABSENT) {
++ virBufferAsprintf(&childBuf, " caching_mode='%s'",
++ virTristateSwitchTypeToString(iommu->caching_mode));
++ }
++ virBufferAddLit(&childBuf, "/>\n");
+ }
+
+ virBufferAsprintf(buf, "
++ QEMUGuest1
++ c7a5fdbd-edaf-9455-926a-d65c16db1809
++ 219100
++ 219100
++ 1
++
++ hvm
++
++
++
++ destroy
++ restart
++ destroy
++
++ /usr/bin/qemu-system-x86_64
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+Index: libvirt-3.3.0/tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-caching-mode.xml
+===================================================================
+--- /dev/null
++++ libvirt-3.3.0/tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-caching-mode.xml
+@@ -0,0 +1,50 @@
++
++ QEMUGuest1
++ c7a5fdbd-edaf-9455-926a-d65c16db1809
++ 219100
++ 219100
++ 1
++
++ hvm
++
++
++
++ destroy
++ restart
++ destroy
++
++ /usr/bin/qemu-system-x86_64
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
++
+Index: libvirt-3.3.0/tests/qemuxml2xmltest.c
+===================================================================
+--- libvirt-3.3.0.orig/tests/qemuxml2xmltest.c
++++ libvirt-3.3.0/tests/qemuxml2xmltest.c
+@@ -1123,6 +1123,7 @@ mymain(void)
+ QEMU_CAPS_MACHINE_OPT,
+ QEMU_CAPS_MACHINE_IOMMU);
+ DO_TEST("intel-iommu-ioapic", NONE);
++ DO_TEST("intel-iommu-caching-mode", NONE);
+
+ DO_TEST("cpu-check-none", NONE);
+ DO_TEST("cpu-check-partial", NONE);
diff --git a/libvirt-3.3.0.tar.xz b/libvirt-3.3.0.tar.xz
index cc28606..95770b1 100644
--- a/libvirt-3.3.0.tar.xz
+++ b/libvirt-3.3.0.tar.xz
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:ad7af06eca75aee2e347618157fd392f1fef3f4eec275110a6cf1b61b5ca446f
-size 13985032
+oid sha256:29e00984174e33cf2183b478382c017de26860452ffee17b73871051264ebb1b
+size 14043384
diff --git a/libvirt-3.3.0.tar.xz.asc b/libvirt-3.3.0.tar.xz.asc
index 3defb0c..ae4c8f9 100644
--- a/libvirt-3.3.0.tar.xz.asc
+++ b/libvirt-3.3.0.tar.xz.asc
@@ -1,11 +1,10 @@
-----BEGIN PGP SIGNATURE-----
-iQEzBAABCAAdFiEEjUiKECNx2wGgDcvNZNVaFdrgLsAFAlkDS5gACgkQZNVaFdrg
-LsDmOwf/eajUbk983Ka+iLGHgCul13X3u90UeOkCeqF1Ek95/driVMTOrY9sAHLP
-luBavdmsCUQS3y3mzv5h/pJMt9IQq7NSA01PxLExEJWbULIzULr7ac+SoNZe6l9v
-DPKmW9x/Zg0C5G4i0AFfq6exitjPKOA/p+kukHEHCQ5r1jkgSv09zxch9nEfa0PU
-VuJ/nQga/ePLpW2Kk8yvawY0JjCaU6FTdk5u+iHAY+U4Z/ryYqe+35cbDQHSkgbg
-jHgY0WZC22fxq+BIyBNO/bxawdIeDQcv66HYJodLZxM4HdvcpNuBF67zEO7vF0XF
-lKFyN94x5uBpqjT0JVbhkHbWENkp9w==
-=0rmS
+iQEcBAABAgAGBQJZDNY6AAoJEBVYiyZZa+pdBgEIAKfTozMEi/ZI2NTtpjoZXzDn
+gGcSEAZUJj3Chp9LkY/daAgL8RCNKU3c9Y/QgmTflJYEsAZsIRW9rJ3zsCHfPnC1
+rty3NulfCujrsLsZEqXHADjbmiTQ/H7WUoStIPBYLkERxrZ+qQ0egsA6qSqe8hy5
+6u/cXm8Yav9QvIfp8ikdKcJl+SUQT/yGXXzR7udr/ra8rCfqgvJqKkg+NDLNXB17
+kAz4guvjivfAOEel1RASoTyvnXjLzMtG4InfTz0+8cGomLDS1sWmCW+gW519juPm
+6TaHbQ1hDnLZvCy3h7TmeUJxLgvyV8Ul2VlZRCytXlJ//IcVlvgDq2+7SpBvjgA=
+=fQOM
-----END PGP SIGNATURE-----
diff --git a/libvirt.changes b/libvirt.changes
index 8627c04..21b209c 100644
--- a/libvirt.changes
+++ b/libvirt.changes
@@ -1,3 +1,34 @@
+-------------------------------------------------------------------
+Mon May 15 21:21:56 UTC 2017 - jfehlig@suse.com
+
+- qemu: add support for 288 VCPUS
+ aeda1b8c-qemu-no-error-shutdown.patch,
+ 8023b21a-conf-ioapic.patch,
+ 6b5c6314-qemu-irqchip.patch,
+ 2020e2c6-conf-intremap.patch,
+ 04028a9d-qemu-intremap.patch,
+ d12781b4-conf-iommu-cache-mode-attr.patch,
+ a5691448-qemu-iommu-cache-mode.patch,
+ 3a276c65-conf-iommu-def-stability-check.patch,
+ 935d927a-conf-iommu-ABI-stability-check.patch
+ FATE#321335
+- revert commit 2841e675: qemu: propagate bridge MTU into qemu
+ "host_mtu"
+ revert-2841e675-mtu.patch
+ bsc#1037774
+
+-------------------------------------------------------------------
+Mon May 8 16:44:59 UTC 2017 - jfehlig@suse.com
+
+- Update to libvirt 3.3.0
+ - Many incremental improvements and bug fixes, see
+ http://libvirt.org/news.html
+ - Bug fixes:
+ bsc#978121, bsc#1017017, bsc#1032863, bsc#1033117, bsc#1034024,
+ bsc#1034146, bsc#1035995
+- libxl: updated libxl-def-usbctrl.patch
+ bsc#1031056
+
-------------------------------------------------------------------
Fri Apr 28 03:30:51 UTC 2017 - jfehlig@suse.com
diff --git a/libvirt.spec b/libvirt.spec
index 0c05610..f8ea60a 100644
--- a/libvirt.spec
+++ b/libvirt.spec
@@ -317,6 +317,15 @@ Source4: libvirtd-relocation-server.fw
Source99: baselibs.conf
Source100: %{name}-rpmlintrc
# Upstream patches
+Patch0: aeda1b8c-qemu-no-error-shutdown.patch
+Patch1: 8023b21a-conf-ioapic.patch
+Patch2: 6b5c6314-qemu-irqchip.patch
+Patch3: 2020e2c6-conf-intremap.patch
+Patch4: 04028a9d-qemu-intremap.patch
+Patch5: d12781b4-conf-iommu-cache-mode-attr.patch
+Patch6: a5691448-qemu-iommu-cache-mode.patch
+Patch7: 3a276c65-conf-iommu-def-stability-check.patch
+Patch8: 935d927a-conf-iommu-ABI-stability-check.patch
# Patches pending upstream review
Patch100: libxl-dom-reset.patch
Patch101: network-don-t-use-dhcp-authoritative-on-static-netwo.patch
@@ -329,6 +338,7 @@ Patch153: ppc64le-canonical-name.patch
Patch154: libxl-set-migration-constraints.patch
Patch155: libxl-set-cach-mode.patch
Patch156: apparmor-fixes.patch
+Patch157: revert-2841e675-mtu.patch
# Our patches
Patch200: libvirtd-defaults.patch
Patch201: libvirtd-init-script.patch
@@ -886,6 +896,15 @@ libvirt plugin for NSS for translating domain names into IP addresses.
%prep
%setup -q
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
+%patch5 -p1
+%patch6 -p1
+%patch7 -p1
+%patch8 -p1
%patch100 -p1
%patch101 -p1
%patch102 -p1
@@ -896,6 +915,7 @@ libvirt plugin for NSS for translating domain names into IP addresses.
%patch154 -p1
%patch155 -p1
%patch156 -p1
+%patch157 -p1
%patch200 -p1
%patch201 -p1
%patch202 -p1
diff --git a/libxl-def-usbctrl.patch b/libxl-def-usbctrl.patch
index 7cd43e6..e2d1a54 100644
--- a/libxl-def-usbctrl.patch
+++ b/libxl-def-usbctrl.patch
@@ -1,29 +1,33 @@
-commit b020800a3930aa2bd40855548c442846716d88f1
-Author: Jim Fehlig
-Date: Tue Mar 28 17:34:16 2017 -0600
+From c55c2ba0a26b0074e73f281810ad3e4a70bc4910 Mon Sep 17 00:00:00 2001
+From: Jim Fehlig
+Date: Tue, 28 Mar 2017 17:34:16 -0600
+Subject: [PATCH] libxl: add default controllers for USB devices
- libxl: add default controllers for USB devices
-
- Attempting to start a domain with USB hostdevs but no USB controllers
- fails with the rather cryptic error
-
- libxl: error: libxl_qmp.c:287:qmp_handle_error_response: received an
- error message from QMP server: Bus 'xenusb-0.0' not found
-
- This can be fixed by creating default USB controllers. When no USB
- controllers are defined, create the number of 8 port controllers
- necessary to accommodate the number of defined USB devices.
-
- Note that USB controllers are already created as needed in the
- domainAttachDevice code path. E.g. a USB controller will be created,
- if necessary, when attaching a USB device with
- 'virsh attach-device dom usbdev.xml'.
+Attempting to start a domain with USB hostdevs but no USB controllers
+fails with the rather cryptic error
+
+libxl: error: libxl_qmp.c:287:qmp_handle_error_response: received an
+error message from QMP server: Bus 'xenusb-0.0' not found
+
+This can be fixed by creating default USB controllers. When no USB
+controllers are defined, create the number of 8 port controllers
+necessary to accommodate the number of defined USB devices.
+
+Note that USB controllers are already created as needed in the
+domainAttachDevice code path. E.g. a USB controller will be created,
+if necessary, when attaching a USB device with
+'virsh attach-device dom usbdev.xml'.
+
+Signed-off-by: Jim Fehlig
+---
+ src/libxl/libxl_conf.c | 82 +++++++++++++++++++++++++++++++++++++++++++-------
+ 1 file changed, 71 insertions(+), 11 deletions(-)
Index: libvirt-3.3.0/src/libxl/libxl_conf.c
===================================================================
--- libvirt-3.3.0.orig/src/libxl/libxl_conf.c
+++ libvirt-3.3.0/src/libxl/libxl_conf.c
-@@ -1822,34 +1822,92 @@ libxlMakeUSBController(virDomainControll
+@@ -1822,34 +1822,94 @@ libxlMakeUSBController(virDomainControll
}
static int
@@ -64,7 +68,9 @@ Index: libvirt-3.3.0/src/libxl/libxl_conf.c
+ if (libxlMakeUSBController(l_controller, &x_controllers[i]) < 0)
+ goto error;
+
-+ virDomainControllerInsertPreAlloced(def, l_controller);
++ if (virDomainControllerInsert(def, l_controller) < 0)
++ goto error;
++
+ l_controller = NULL;
+ }
+
diff --git a/libxl-set-migration-constraints.patch b/libxl-set-migration-constraints.patch
index f89a218..ed34f55 100644
--- a/libxl-set-migration-constraints.patch
+++ b/libxl-set-migration-constraints.patch
@@ -378,7 +378,7 @@ Index: libvirt-3.3.0/tools/virsh.pod
===================================================================
--- libvirt-3.3.0.orig/tools/virsh.pod
+++ libvirt-3.3.0/tools/virsh.pod
-@@ -1752,6 +1752,14 @@ compression. I<--comp-mt-threads> and I<
+@@ -1753,6 +1753,14 @@ compression. I<--comp-mt-threads> and I<
of compress threads on source and the number of decompress threads on target
respectively. I<--comp-xbzrle-cache> sets size of page cache in bytes.
diff --git a/revert-2841e675-mtu.patch b/revert-2841e675-mtu.patch
new file mode 100644
index 0000000..ee9a714
--- /dev/null
+++ b/revert-2841e675-mtu.patch
@@ -0,0 +1,181 @@
+From 306b412857870d1952850b511011909066089af7 Mon Sep 17 00:00:00 2001
+From: Jim Fehlig
+Date: Mon, 15 May 2017 09:47:39 -0600
+Subject: [PATCH] Revert "qemu: propagate bridge MTU into qemu "host_mtu"
+ option"
+
+This reverts commit 2841e6756d5807a4119e004bc5fb8e7d70806458.
+
+The change causes a guest ABI change. See following bugs for details
+
+https://bugzilla.suse.com/show_bug.cgi?id=1037774
+https://bugzilla.redhat.com/show_bug.cgi?id=1449346
+Signed-off-by: Jim Fehlig
+---
+ src/qemu/qemu_command.c | 32 ++++++++++----------------------
+ src/qemu/qemu_command.h | 3 +--
+ src/qemu/qemu_hotplug.c | 5 ++---
+ src/qemu/qemu_interface.c | 5 ++---
+ src/qemu/qemu_interface.h | 3 +--
+ 5 files changed, 16 insertions(+), 32 deletions(-)
+
+Index: libvirt-3.3.0/src/qemu/qemu_command.c
+===================================================================
+--- libvirt-3.3.0.orig/src/qemu/qemu_command.c
++++ libvirt-3.3.0/src/qemu/qemu_command.c
+@@ -3633,8 +3633,7 @@ qemuBuildNicDevStr(virDomainDefPtr def,
+ int vlan,
+ unsigned int bootindex,
+ size_t vhostfdSize,
+- virQEMUCapsPtr qemuCaps,
+- unsigned int mtu)
++ virQEMUCapsPtr qemuCaps)
+ {
+ virBuffer buf = VIR_BUFFER_INITIALIZER;
+ const char *nic = net->model;
+@@ -3758,23 +3757,13 @@ qemuBuildNicDevStr(virDomainDefPtr def,
+ virBufferAsprintf(&buf, ",rx_queue_size=%u", net->driver.virtio.rx_queue_size);
+ }
+
+- if (usingVirtio && mtu) {
+- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_HOST_MTU)) {
+-
+- virBufferAsprintf(&buf, ",host_mtu=%u", mtu);
+-
+- } else {
+- /* log an error if mtu was requested specifically for this
+- * interface, otherwise, if it's just what was reported by
+- * the attached network, ignore it.
+- */
+- if (net->mtu) {
+- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+- _("setting MTU is not supported with "
+- "this QEMU binary"));
+- goto error;
+- }
++ if (usingVirtio && net->mtu) {
++ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_HOST_MTU)) {
++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
++ _("setting MTU is not supported with this QEMU binary"));
++ goto error;
+ }
++ virBufferAsprintf(&buf, ",host_mtu=%u", net->mtu);
+ }
+
+ if (vlan == -1)
+@@ -8320,7 +8309,7 @@ qemuBuildVhostuserCommandLine(virQEMUDri
+ VIR_FREE(netdev);
+
+ if (!(nic = qemuBuildNicDevStr(def, net, -1, bootindex,
+- queues, qemuCaps, net->mtu))) {
++ queues, qemuCaps))) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("Error generating NIC -device string"));
+ goto error;
+@@ -8366,7 +8355,6 @@ qemuBuildInterfaceCommandLine(virQEMUDri
+ virDomainNetType actualType = virDomainNetGetActualType(net);
+ virNetDevBandwidthPtr actualBandwidth;
+ size_t i;
+- unsigned int mtu = net->mtu;
+
+
+ if (!bootindex)
+@@ -8421,7 +8409,7 @@ qemuBuildInterfaceCommandLine(virQEMUDri
+ memset(tapfd, -1, tapfdSize * sizeof(tapfd[0]));
+
+ if (qemuInterfaceBridgeConnect(def, driver, net,
+- tapfd, &tapfdSize, &mtu) < 0)
++ tapfd, &tapfdSize) < 0)
+ goto cleanup;
+ break;
+
+@@ -8601,7 +8589,7 @@ qemuBuildInterfaceCommandLine(virQEMUDri
+ }
+ if (qemuDomainSupportsNicdev(def, net)) {
+ if (!(nic = qemuBuildNicDevStr(def, net, vlan, bootindex,
+- vhostfdSize, qemuCaps, mtu)))
++ vhostfdSize, qemuCaps)))
+ goto cleanup;
+ virCommandAddArgList(cmd, "-device", nic, NULL);
+ } else {
+Index: libvirt-3.3.0/src/qemu/qemu_command.h
+===================================================================
+--- libvirt-3.3.0.orig/src/qemu/qemu_command.h
++++ libvirt-3.3.0/src/qemu/qemu_command.h
+@@ -101,8 +101,7 @@ char *qemuBuildNicDevStr(virDomainDefPtr
+ int vlan,
+ unsigned int bootindex,
+ size_t vhostfdSize,
+- virQEMUCapsPtr qemuCaps,
+- unsigned int mtu);
++ virQEMUCapsPtr qemuCaps);
+
+ char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk);
+
+Index: libvirt-3.3.0/src/qemu/qemu_hotplug.c
+===================================================================
+--- libvirt-3.3.0.orig/src/qemu/qemu_hotplug.c
++++ libvirt-3.3.0/src/qemu/qemu_hotplug.c
+@@ -968,7 +968,6 @@ qemuDomainAttachNetDevice(virQEMUDriverP
+ bool charDevPlugged = false;
+ bool netdevPlugged = false;
+ bool hostPlugged = false;
+- unsigned int mtu = net->mtu;
+
+ /* preallocate new slot for device */
+ if (VIR_REALLOC_N(vm->def->nets, vm->def->nnets + 1) < 0)
+@@ -1025,7 +1024,7 @@ qemuDomainAttachNetDevice(virQEMUDriverP
+ goto cleanup;
+ memset(vhostfd, -1, sizeof(*vhostfd) * vhostfdSize);
+ if (qemuInterfaceBridgeConnect(vm->def, driver, net,
+- tapfd, &tapfdSize, &mtu) < 0)
++ tapfd, &tapfdSize) < 0)
+ goto cleanup;
+ iface_connected = true;
+ if (qemuInterfaceOpenVhostNet(vm->def, net, priv->qemuCaps,
+@@ -1239,7 +1238,7 @@ qemuDomainAttachNetDevice(virQEMUDriverP
+ VIR_FORCE_CLOSE(vhostfd[i]);
+
+ if (!(nicstr = qemuBuildNicDevStr(vm->def, net, vlan, 0,
+- queueSize, priv->qemuCaps, mtu)))
++ queueSize, priv->qemuCaps)))
+ goto try_remove;
+
+ qemuDomainObjEnterMonitor(driver, vm);
+Index: libvirt-3.3.0/src/qemu/qemu_interface.c
+===================================================================
+--- libvirt-3.3.0.orig/src/qemu/qemu_interface.c
++++ libvirt-3.3.0/src/qemu/qemu_interface.c
+@@ -503,8 +503,7 @@ qemuInterfaceBridgeConnect(virDomainDefP
+ virQEMUDriverPtr driver,
+ virDomainNetDefPtr net,
+ int *tapfd,
+- size_t *tapfdSize,
+- unsigned int *mtu)
++ size_t *tapfdSize)
+ {
+ const char *brname;
+ int ret = -1;
+@@ -545,7 +544,7 @@ qemuInterfaceBridgeConnect(virDomainDefP
+ def->uuid, tunpath, tapfd, *tapfdSize,
+ virDomainNetGetActualVirtPortProfile(net),
+ virDomainNetGetActualVlan(net),
+- net->coalesce, net->mtu, mtu,
++ NULL, 0, NULL,
+ tap_create_flags) < 0) {
+ virDomainAuditNetDevice(def, net, tunpath, false);
+ goto cleanup;
+Index: libvirt-3.3.0/src/qemu/qemu_interface.h
+===================================================================
+--- libvirt-3.3.0.orig/src/qemu/qemu_interface.h
++++ libvirt-3.3.0/src/qemu/qemu_interface.h
+@@ -51,8 +51,7 @@ int qemuInterfaceBridgeConnect(virDomain
+ virQEMUDriverPtr driver,
+ virDomainNetDefPtr net,
+ int *tapfd,
+- size_t *tapfdSize,
+- unsigned int *mtu)
++ size_t *tapfdSize)
+ ATTRIBUTE_NONNULL(2);
+
+ int qemuInterfaceOpenVhostNet(virDomainDefPtr def,