On Tue, May 28, 2019 at 05:29:02PM +0200, Andrea Bolognani wrote:
All current IOMMU features are specific to Intel IOMMU, so
understandably we check for the corresponding capabilities
inside the Intel-specific switch() branch; however, we want
to make sure SMMUv3 IOMMU users get an error if they try to
enable any of those features in their guest, and performing
the capability checks unconditionally is both the easiest
way to achieve that, as well as the one least likely to
result in us inadvertently letting users enable some new
Intel-specific IOMMU feature for ARM guests later on.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
src/qemu/qemu_domain.c | 63 +++++++++++++++++++++++-------------------
1 file changed, 35 insertions(+), 28 deletions(-)
@@ -6158,6 +6130,41 @@ qemuDomainDeviceDefValidateIOMMU(const virDomainIOMMUDef *iommu,
return -1;
}
+ /* These capability checks ensure we're not trying to use features
+ * of Intel IOMMU that the QEMU binary does not support, but they
+ * also make sure we report an error when trying to use features
+ * that are not implemented by SMMUv3,
so they must be here instead
+ * of inside the switch() statement above */
This part of the sentence is not really necessary.
+
+ if (iommu->intremap != VIR_TRISTATE_SWITCH_ABSENT &&
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_INTEL_IOMMU_INTREMAP)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("iommu: interrupt remapping is not supported "
+ "with this QEMU binary"));
+ return -1;
+ }
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
Jano