virtio-iommu doesn't work without ACPI, so we need to make sure
the latter is enabled.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
src/qemu/qemu_validate.c | 6 ++++++
.../virtio-iommu-no-acpi.x86_64-latest.err | 1 +
tests/qemuxml2argvdata/virtio-iommu-no-acpi.xml | 15 +++++++++++++++
tests/qemuxml2argvtest.c | 1 +
4 files changed, 23 insertions(+)
create mode 100644 tests/qemuxml2argvdata/virtio-iommu-no-acpi.x86_64-latest.err
create mode 100644 tests/qemuxml2argvdata/virtio-iommu-no-acpi.xml
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 7bee9fa9b0..0250f3e537 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -4886,6 +4886,12 @@ qemuValidateDomainDeviceDefIOMMU(const virDomainIOMMUDef *iommu,
virDomainIOMMUModelTypeToString(iommu->model));
return -1;
}
+ if (def->features[VIR_DOMAIN_FEATURE_ACPI] != VIR_TRISTATE_SWITCH_ON) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("IOMMU device: '%s' requires ACPI"),
+ virDomainIOMMUModelTypeToString(iommu->model));
+ return -1;
+ }
break;
case VIR_DOMAIN_IOMMU_MODEL_LAST:
diff --git a/tests/qemuxml2argvdata/virtio-iommu-no-acpi.x86_64-latest.err
b/tests/qemuxml2argvdata/virtio-iommu-no-acpi.x86_64-latest.err
new file mode 100644
index 0000000000..6b598951bb
--- /dev/null
+++ b/tests/qemuxml2argvdata/virtio-iommu-no-acpi.x86_64-latest.err
@@ -0,0 +1 @@
+unsupported configuration: IOMMU device: 'virtio' requires ACPI
diff --git a/tests/qemuxml2argvdata/virtio-iommu-no-acpi.xml
b/tests/qemuxml2argvdata/virtio-iommu-no-acpi.xml
new file mode 100644
index 0000000000..36e5eb39b9
--- /dev/null
+++ b/tests/qemuxml2argvdata/virtio-iommu-no-acpi.xml
@@ -0,0 +1,15 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219100</memory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='q35'>hvm</type>
+ </os>
+ <devices>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <controller type='usb' model='none'/>
+ <memballoon model='none'/>
+ <iommu model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index ce57661d4c..8b13064e58 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -3256,6 +3256,7 @@ mymain(void)
DO_TEST_CAPS_VER_PARSE_ERROR("virtio-iommu-x86_64", "6.1.0");
DO_TEST_CAPS_ARCH_LATEST("virtio-iommu-aarch64", "aarch64");
DO_TEST_CAPS_LATEST_PARSE_ERROR("virtio-iommu-wrong-machine");
+ DO_TEST_CAPS_LATEST_PARSE_ERROR("virtio-iommu-no-acpi");
DO_TEST("cpu-hotplug-startup", QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS);
DO_TEST_PARSE_ERROR("cpu-hotplug-granularity",
--
2.31.1