Signed-off-by: Andrea Bolognani <abologna(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 073f7bce58..fd08a84fd6 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -4806,6 +4806,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 72ffac5de3..75ea4d32f3 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -3239,6 +3239,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.31.1