|
|
3e5111 |
From 6fa4cae7c760c804c601735a4eba91e72e2e756b Mon Sep 17 00:00:00 2001
|
|
|
3e5111 |
Message-Id: <6fa4cae7c760c804c601735a4eba91e72e2e756b@dist-git>
|
|
|
3e5111 |
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
|
|
3e5111 |
Date: Fri, 9 Jun 2017 12:48:57 +0200
|
|
|
3e5111 |
Subject: [PATCH] qemu: format device-iotlb on intel-iommu command line
|
|
|
3e5111 |
MIME-Version: 1.0
|
|
|
3e5111 |
Content-Type: text/plain; charset=UTF-8
|
|
|
3e5111 |
Content-Transfer-Encoding: 8bit
|
|
|
3e5111 |
|
|
|
3e5111 |
Format the device-iotlb attribute.
|
|
|
3e5111 |
|
|
|
3e5111 |
https://bugzilla.redhat.com/show_bug.cgi?id=1283251
|
|
|
3e5111 |
|
|
|
3e5111 |
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
3e5111 |
(cherry picked from commit 240e443afdac0df342bb462ac2754a46e6efbc23)
|
|
|
3e5111 |
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
|
|
3e5111 |
|
|
|
3e5111 |
Conflicts:
|
|
|
3e5111 |
tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
|
|
|
3e5111 |
that QEMU version again
|
|
|
3e5111 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
3e5111 |
---
|
|
|
3e5111 |
src/qemu/qemu_capabilities.c | 3 +++
|
|
|
3e5111 |
src/qemu/qemu_capabilities.h | 3 +++
|
|
|
3e5111 |
src/qemu/qemu_command.c | 11 +++++++++++
|
|
|
3e5111 |
tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 1 +
|
|
|
3e5111 |
.../qemuxml2argv-intel-iommu-device-iotlb.args | 19 +++++++++++++++++++
|
|
|
3e5111 |
tests/qemuxml2argvtest.c | 7 +++++++
|
|
|
3e5111 |
6 files changed, 44 insertions(+)
|
|
|
3e5111 |
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-device-iotlb.args
|
|
|
3e5111 |
|
|
|
3e5111 |
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
|
|
|
3e5111 |
index 29bb9949af..d8f3079083 100644
|
|
|
3e5111 |
--- a/src/qemu/qemu_capabilities.c
|
|
|
3e5111 |
+++ b/src/qemu/qemu_capabilities.c
|
|
|
3e5111 |
@@ -372,6 +372,8 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
|
|
|
3e5111 |
"intel-iommu.intremap",
|
|
|
3e5111 |
"intel-iommu.caching-mode",
|
|
|
3e5111 |
"intel-iommu.eim",
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+ "intel-iommu.device-iotlb", /* 260 */
|
|
|
3e5111 |
);
|
|
|
3e5111 |
|
|
|
3e5111 |
|
|
|
3e5111 |
@@ -1728,6 +1730,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsIntelIOMMU[] = {
|
|
|
3e5111 |
{ "intremap", QEMU_CAPS_INTEL_IOMMU_INTREMAP },
|
|
|
3e5111 |
{ "caching-mode", QEMU_CAPS_INTEL_IOMMU_CACHING_MODE },
|
|
|
3e5111 |
{ "eim", QEMU_CAPS_INTEL_IOMMU_EIM },
|
|
|
3e5111 |
+ { "device-iotlb", QEMU_CAPS_INTEL_IOMMU_DEVICE_IOTLB },
|
|
|
3e5111 |
};
|
|
|
3e5111 |
|
|
|
3e5111 |
/* see documentation for virQEMUCapsQMPSchemaGetByPath for the query format */
|
|
|
3e5111 |
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
|
|
|
3e5111 |
index 1c64364af4..e0f81711fe 100644
|
|
|
3e5111 |
--- a/src/qemu/qemu_capabilities.h
|
|
|
3e5111 |
+++ b/src/qemu/qemu_capabilities.h
|
|
|
3e5111 |
@@ -411,6 +411,9 @@ typedef enum {
|
|
|
3e5111 |
QEMU_CAPS_INTEL_IOMMU_CACHING_MODE, /* intel-iommu.caching-mode */
|
|
|
3e5111 |
QEMU_CAPS_INTEL_IOMMU_EIM, /* intel-iommu.eim */
|
|
|
3e5111 |
|
|
|
3e5111 |
+ /* 260 */
|
|
|
3e5111 |
+ QEMU_CAPS_INTEL_IOMMU_DEVICE_IOTLB, /* intel-iommu.device-iotlb */
|
|
|
3e5111 |
+
|
|
|
3e5111 |
QEMU_CAPS_LAST /* this must always be the last item */
|
|
|
3e5111 |
} virQEMUCapsFlags;
|
|
|
3e5111 |
|
|
|
3e5111 |
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
|
|
3e5111 |
index 9c0d151da1..9c5639b036 100644
|
|
|
3e5111 |
--- a/src/qemu/qemu_command.c
|
|
|
3e5111 |
+++ b/src/qemu/qemu_command.c
|
|
|
3e5111 |
@@ -6694,6 +6694,13 @@ qemuBuildIOMMUCommandLine(virCommandPtr cmd,
|
|
|
3e5111 |
"with this QEMU binary"));
|
|
|
3e5111 |
return -1;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
+ if (iommu->iotlb != VIR_TRISTATE_SWITCH_ABSENT &&
|
|
|
3e5111 |
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_INTEL_IOMMU_DEVICE_IOTLB)) {
|
|
|
3e5111 |
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
|
3e5111 |
+ _("iommu: device IOTLB is not supported "
|
|
|
3e5111 |
+ "with this QEMU binary"));
|
|
|
3e5111 |
+ return -1;
|
|
|
3e5111 |
+ }
|
|
|
3e5111 |
break;
|
|
|
3e5111 |
case VIR_DOMAIN_IOMMU_MODEL_LAST:
|
|
|
3e5111 |
break;
|
|
|
3e5111 |
@@ -6731,6 +6738,10 @@ qemuBuildIOMMUCommandLine(virCommandPtr cmd,
|
|
|
3e5111 |
virBufferAsprintf(&opts, ",eim=%s",
|
|
|
3e5111 |
virTristateSwitchTypeToString(iommu->eim));
|
|
|
3e5111 |
}
|
|
|
3e5111 |
+ if (iommu->iotlb != VIR_TRISTATE_SWITCH_ABSENT) {
|
|
|
3e5111 |
+ virBufferAsprintf(&opts, ",device-iotlb=%s",
|
|
|
3e5111 |
+ virTristateSwitchTypeToString(iommu->iotlb));
|
|
|
3e5111 |
+ }
|
|
|
3e5111 |
case VIR_DOMAIN_IOMMU_MODEL_LAST:
|
|
|
3e5111 |
break;
|
|
|
3e5111 |
}
|
|
|
3e5111 |
diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
|
|
|
3e5111 |
index 2002dc7c0d..29a483d123 100644
|
|
|
3e5111 |
--- a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
|
|
|
3e5111 |
+++ b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
|
|
|
3e5111 |
@@ -214,6 +214,7 @@
|
|
|
3e5111 |
<flag name='intel-iommu.intremap'/>
|
|
|
3e5111 |
<flag name='intel-iommu.caching-mode'/>
|
|
|
3e5111 |
<flag name='intel-iommu.eim'/>
|
|
|
3e5111 |
+ <flag name='intel-iommu.device-iotlb'/>
|
|
|
3e5111 |
<version>2008090</version>
|
|
|
3e5111 |
<kvmVersion>0</kvmVersion>
|
|
|
3e5111 |
<package> (v2.9.0-rc0-142-g940a8ce)</package>
|
|
|
3e5111 |
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-device-iotlb.args b/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-device-iotlb.args
|
|
|
3e5111 |
new file mode 100644
|
|
|
3e5111 |
index 0000000000..6d8f8e2188
|
|
|
3e5111 |
--- /dev/null
|
|
|
3e5111 |
+++ b/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-device-iotlb.args
|
|
|
3e5111 |
@@ -0,0 +1,19 @@
|
|
|
3e5111 |
+LC_ALL=C \
|
|
|
3e5111 |
+PATH=/bin \
|
|
|
3e5111 |
+HOME=/home/test \
|
|
|
3e5111 |
+USER=test \
|
|
|
3e5111 |
+LOGNAME=test \
|
|
|
3e5111 |
+QEMU_AUDIO_DRV=none \
|
|
|
3e5111 |
+/usr/bin/qemu-system-x86_64 \
|
|
|
3e5111 |
+-name QEMUGuest1 \
|
|
|
3e5111 |
+-S \
|
|
|
3e5111 |
+-machine q35,accel=kvm,kernel_irqchip=split \
|
|
|
3e5111 |
+-m 214 \
|
|
|
3e5111 |
+-smp 1,sockets=1,cores=1,threads=1 \
|
|
|
3e5111 |
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
|
|
|
3e5111 |
+-nographic \
|
|
|
3e5111 |
+-nodefaults \
|
|
|
3e5111 |
+-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \
|
|
|
3e5111 |
+-no-acpi \
|
|
|
3e5111 |
+-boot c \
|
|
|
3e5111 |
+-device intel-iommu,intremap=on,device-iotlb=on
|
|
|
3e5111 |
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
|
|
|
3e5111 |
index 9e0d4d7141..bff32200d7 100644
|
|
|
3e5111 |
--- a/tests/qemuxml2argvtest.c
|
|
|
3e5111 |
+++ b/tests/qemuxml2argvtest.c
|
|
|
3e5111 |
@@ -2541,6 +2541,13 @@ mymain(void)
|
|
|
3e5111 |
QEMU_CAPS_INTEL_IOMMU_INTREMAP,
|
|
|
3e5111 |
QEMU_CAPS_INTEL_IOMMU_EIM,
|
|
|
3e5111 |
QEMU_CAPS_DEVICE_INTEL_IOMMU);
|
|
|
3e5111 |
+ DO_TEST("intel-iommu-device-iotlb",
|
|
|
3e5111 |
+ QEMU_CAPS_MACHINE_OPT,
|
|
|
3e5111 |
+ QEMU_CAPS_MACHINE_KERNEL_IRQCHIP,
|
|
|
3e5111 |
+ QEMU_CAPS_MACHINE_KERNEL_IRQCHIP_SPLIT,
|
|
|
3e5111 |
+ QEMU_CAPS_INTEL_IOMMU_INTREMAP,
|
|
|
3e5111 |
+ QEMU_CAPS_INTEL_IOMMU_DEVICE_IOTLB,
|
|
|
3e5111 |
+ QEMU_CAPS_DEVICE_INTEL_IOMMU);
|
|
|
3e5111 |
|
|
|
3e5111 |
DO_TEST("cpu-hotplug-startup", QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS);
|
|
|
3e5111 |
|
|
|
3e5111 |
--
|
|
|
3e5111 |
2.13.1
|
|
|
3e5111 |
|