qemu: Validate capabilities for virtio-iommu

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Andrea Bolognani 2021-10-07 19:35:45 +02:00
parent d8072c0015
commit 28ddd917be
3 changed files with 10 additions and 0 deletions

View File

@ -4874,6 +4874,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:

View File

@ -0,0 +1 @@
unsupported configuration: IOMMU device: 'virtio' is not supported with this QEMU binary

View File

@ -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");