From: Michal Privoznik <[email protected]> Just like with other features, check whether QEMU supports them based on capabilities. Now, instead of inventing a new QEMU capability, an existing one can be used: QEMU_CAPS_VIRTIO_IOMMU_AW_BITS.
This is because the aw-bits and granule attributes were introduced into QEMU in close succession (v9.0.0-rc0~9^2~7 v9.0.0-rc0~9^2~11), neither can be disabled at compile time and backporting just one without the other makes almost no sense. Signed-off-by: Michal Privoznik <[email protected]> --- src/qemu/qemu_validate.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index ab8a1938c1..f5072941c5 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -5684,6 +5684,12 @@ qemuValidateDomainDeviceDefIOMMU(const virDomainIOMMUDef *iommu, _("iommu: updating dma translation is not supported with this QEMU binary")); return -1; } + if (iommu->granule_mode != VIR_DOMAIN_IOMMU_GRANULE_MODE_NONE && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_IOMMU_AW_BITS)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("iommu: page granule is not supported with this QEMU binary")); + return -1; + } return 0; } -- 2.52.0
