Add support for generating QEMU command line with 
'x-scalable-mode=on,x-flts=on'.

Signed-off-by: Zhenzhong Duan <[email protected]>
---
 src/qemu/qemu_command.c  |  2 ++
 src/qemu/qemu_validate.c | 12 ++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 99c310cf31..6cd07d6f53 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6338,6 +6338,8 @@ qemuBuildIOMMUCommandLine(virCommand *cmd,
                                       "T:device-iotlb", iommu->iotlb,
                                       "z:aw-bits", iommu->aw_bits,
                                       "T:dma-translation", 
iommu->dma_translation,
+                                      "T:x-scalable-mode", 
iommu->scalable_mode,
+                                      "T:x-flts", iommu->fsts,
                                       NULL) < 0)
                 return -1;
 
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index da08fd17cd..c3739ac4b3 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -5683,6 +5683,18 @@ qemuValidateDomainDeviceDefIOMMU(const virDomainIOMMUDef 
*iommu,
                        _("iommu: updating dma translation is not supported 
with this QEMU binary"));
         return -1;
     }
+    if (iommu->scalable_mode != VIR_TRISTATE_SWITCH_ABSENT &&
+        !virQEMUCapsGet(qemuCaps, QEMU_CAPS_INTEL_IOMMU_SCALABLE_MODE))  {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("iommu: x-scalable-mode is not supported with this 
QEMU binary"));
+        return -1;
+    }
+    if (iommu->fsts != VIR_TRISTATE_SWITCH_ABSENT &&
+        !virQEMUCapsGet(qemuCaps, QEMU_CAPS_INTEL_IOMMU_FIRST_STAGE))  {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("iommu: x-flts is not supported with this QEMU 
binary"));
+        return -1;
+    }
 
     return 0;
 }
-- 
2.47.3

Reply via email to