[PATCH] domain_validate: Validate dma_translation for iommu models

Han Han posted 1 patch 1 week, 3 days ago
There is a newer version of this series
src/conf/domain_validate.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH] domain_validate: Validate dma_translation for iommu models
Posted by Han Han 1 week, 3 days ago
The attribute dma_translation is only supported by intel-iommu device.
Report an error when it is used for the other iommu devices.

Fixes: 6866f958c1

Signed-off-by: Han Han <hhan@redhat.com>
---
 src/conf/domain_validate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index eddb4a5e74..b8ae9ed79d 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -2980,7 +2980,8 @@ virDomainIOMMUDefValidate(const virDomainIOMMUDef *iommu)
             iommu->caching_mode != VIR_TRISTATE_SWITCH_ABSENT ||
             iommu->eim != VIR_TRISTATE_SWITCH_ABSENT ||
             iommu->iotlb != VIR_TRISTATE_SWITCH_ABSENT ||
-            iommu->aw_bits != 0) {
+            iommu->aw_bits != 0 ||
+            iommu->dma_translation != VIR_TRISTATE_SWITCH_ABSENT) {
             virReportError(VIR_ERR_XML_ERROR,
                            _("iommu model '%1$s' doesn't support additional attributes"),
                            virDomainIOMMUModelTypeToString(iommu->model));
-- 
2.46.1