https://bugzilla.redhat.com/show_bug.cgi?id=1427005
---
src/qemu/qemu_capabilities.c | 8
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c| 18
.../qemucapabilitiesdata/caps_2.4.0.x86_64.replies | 22 +++---
.../qemucapabilitiesdata/caps_2.5.0.x86_64.replies | 24 +++
.../qemucapabilitiesdata/caps_2.6.0.x86_64.replies | 24 +++
.../qemucapabilitiesdata/caps_2.7.0.x86_64.replies | 28 +
tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml | 1 +
.../qemucapabilitiesdata/caps_2.8.0.x86_64.replies | 37
tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml | 1 +
.../qemucapabilitiesdata/caps_2.9.0.x86_64.replies | 49 ++
tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 1 +
.../qemuxml2argv-intel-iommu-ioapic.args | 2 +-
tests/qemuxml2argvtest.c | 1 +
14 files changed, 173 insertions(+), 44 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 9c08912..8458a29 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -369,6 +369,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"kernel-irqchip", /* 255 */
"kernel-irqchip.split",
+ "intel-iommu.intremap",
);
@@ -1720,6 +1721,10 @@ static struct virQEMUCapsStringFlags
virQEMUCapsObjectPropsUSBNECXHCI[] = {
{ "p3", QEMU_CAPS_NEC_USB_XHCI_PORTS },
};
+static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsIntelIOMMU[] = {
+{ "intremap", QEMU_CAPS_INTEL_IOMMU_INTREMAP },
+};
+
/* see documentation for virQEMUCapsQMPSchemaGetByPath for the query format */
static struct virQEMUCapsStringFlags virQEMUCapsQMPSchemaQueries[] = {
{ "blockdev-add/arg-type/options/+gluster/debug-level",
QEMU_CAPS_GLUSTER_DEBUG_LEVEL},
@@ -1827,6 +1832,9 @@ static struct virQEMUCapsObjectTypeProps
virQEMUCapsObjectProps[] = {
{ "nec-usb-xhci", virQEMUCapsObjectPropsUSBNECXHCI,
ARRAY_CARDINALITY(virQEMUCapsObjectPropsUSBNECXHCI),
-1 },
+{ "intel-iommu", virQEMUCapsObjectPropsIntelIOMMU,
+ ARRAY_CARDINALITY(virQEMUCapsObjectPropsIntelIOMMU),
+ QEMU_CAPS_DEVICE_INTEL_IOMMU},
};
struct virQEMUCapsPropTypeObjects {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 61d3ae2..2810513 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -407,6 +407,7 @@ typedef enum {
/* 255 */
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_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 2b235c6..f162e0a 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6685,6 +6685,20 @@ qemuBuildIOMMUCommandLine(virCommandPtr cmd,
if (!iommu)
return 0;
+switch (iommu->model) {
+case VIR_DOMAIN_IOMMU_MODEL_INTEL:
+if (iommu->intremap != VIR_TRISTATE_SWITCH_ABSENT &&
+!virQEMUCapsGet(qemuCaps, QEMU_CAPS_INTEL_IOMMU_INTREMAP)) {
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("iommu: interrupt remapping is not supported "
+ "with this QEMU binary"));
+return -1;
+}
+break;
+case VIR_DOMAIN_IOMMU_MODEL_LAST:
+break;
+}
+
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_IOMMU))
return 0; /* Already handled via -machine */
@@ -6705,6 +6719,10 @@ qemuBuildIOMMUCommandLine(virCommandPtr cmd,
return -1;
}
virBufferAddLit(&opts, "intel-iommu");
+if (iommu->intremap != VIR_TRISTATE_SWITCH_ABSENT) {
+virBufferAsprintf(&opts, ",intremap=%s",
+ virTristateSwitchTypeToString(iommu->intremap));
+}
case VIR_DOMAIN_IOMMU_MODEL_LAST:
break;
}
diff --git a/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.replies
b/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.replies
index 6822181..9f256c4 100644
--- a/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.replies
+++ b/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.replies
@@ -3123,6 +3123,16 @@
{
"return": [
{
+ "name": "version",
+ "type": "uint32"
+}
+ ],
+ "id": "libvirt-41"
+}
+
+{
+ "return": [
+{
"name": "pc-i440fx-2.4",
"is-default": true,
"cpu-max": 255,
@@ -3246,7 +3256,7 @@
"cpu-max": 255
}
],
- "id": "libvirt-41"
+ "id": "libvirt-42"
}
{
@@ -3336,21 +3346,21 @@
"name": "qemu64"
}
],
- "id": "libvirt-42"
+ "id": "libvirt-43"
}
{
"return": [
"tpm-tis"
],
- "id": "libvirt-43"
+ "id": "libvirt-44"
}