Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
---
src/qemu/qemu_validate.c | 8 ++++++++
.../qemuxml2argvdata/virtio-iommu-x86_64.x86_64-6.1.0.err | 1 +
tests/qemuxml2argvtest.c | 1 +
3 files changed, 10 insertions(+)
create mode 100644 tests/qemuxml2argvdata/virtio-iommu-x86_64.x86_64-6.1.0.err
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 535fae92b0..e051ff6eb7 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -4867,6 +4867,14 @@ qemuValidateDomainDeviceDefIOMMU(const virDomainIOMMUDef *iommu,
virDomainIOMMUModelTypeToString(iommu->model));
return -1;
}
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_IOMMU_PCI) ||
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_IOMMU_BOOT_BYPASS)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("IOMMU device: '%s' is not supported with
"
+ "this QEMU binary"),
+ virDomainIOMMUModelTypeToString(iommu->model));
+ return -1;
+ }
break;
case VIR_DOMAIN_IOMMU_MODEL_LAST:
diff --git a/tests/qemuxml2argvdata/virtio-iommu-x86_64.x86_64-6.1.0.err
b/tests/qemuxml2argvdata/virtio-iommu-x86_64.x86_64-6.1.0.err
new file mode 100644
index 0000000000..e76e1540bc
--- /dev/null
+++ b/tests/qemuxml2argvdata/virtio-iommu-x86_64.x86_64-6.1.0.err
@@ -0,0 +1 @@
+unsupported configuration: IOMMU device: 'virtio' is not supported with this QEMU
binary
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index f4c5c5bb31..bc01d60e12 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -3248,6 +3248,7 @@ mymain(void)
DO_TEST_CAPS_LATEST_PARSE_ERROR("intel-iommu-wrong-machine");
DO_TEST_CAPS_ARCH_LATEST("iommu-smmuv3", "aarch64");
DO_TEST_CAPS_LATEST("virtio-iommu-x86_64");
+ 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");
--
2.35.1