[PATCH 31/38] qemu: capabilities: Retire QEMU_CAPS_MACHINE_IOMMU

Peter Krempa pkrempa at redhat.com
Mon Apr 19 12:35:35 UTC 2021


The feature is no longer asserted. Remove the checks related to it and
make the code work properly with QEMU_CAPS_DEVICE_INTEL_IOMMU.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_capabilities.h |  2 +-
 src/qemu/qemu_command.c      | 19 +++----------------
 src/qemu/qemu_validate.c     |  3 +--
 3 files changed, 5 insertions(+), 19 deletions(-)

diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index b47fbbaf54..4e9c3c55f3 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -373,7 +373,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
     QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY, /* virtio-*pci.disable-legacy */
     QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS, /* qmp command query-hotpluggable-cpus */
     QEMU_CAPS_VIRTIO_NET_RX_QUEUE_SIZE, /* virtio-net-*.rx_queue_size */
-    QEMU_CAPS_MACHINE_IOMMU, /* -machine iommu=on */
+    X_QEMU_CAPS_MACHINE_IOMMU, /* -machine iommu=on */

     /* 235 */
     QEMU_CAPS_DEVICE_VIRTIO_VGA, /* -device virtio-vga */
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 05d074e1f0..beccd128db 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6235,8 +6235,7 @@ qemuBuildBootCommandLine(virCommand *cmd,

 static int
 qemuBuildIOMMUCommandLine(virCommand *cmd,
-                          const virDomainDef *def,
-                          virQEMUCaps *qemuCaps)
+                          const virDomainDef *def)
 {
     const virDomainIOMMUDef *iommu = def->iommu;

@@ -6247,13 +6246,6 @@ qemuBuildIOMMUCommandLine(virCommand *cmd,
     case VIR_DOMAIN_IOMMU_MODEL_INTEL: {
         g_auto(virBuffer) opts = VIR_BUFFER_INITIALIZER;

-        /* qemuValidateDomainDeviceDefIOMMU() already made sure we have
-         * one of QEMU_CAPS_DEVICE_INTEL_IOMMU or QEMU_CAPS_MACHINE_IOMMU:
-         * here we handle the former case, while the latter is taken care
-         * of in qemuBuildMachineCommandLine() */
-        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_INTEL_IOMMU))
-            return 0;
-
         virBufferAddLit(&opts, "intel-iommu");
         if (iommu->intremap != VIR_TRISTATE_SWITCH_ABSENT) {
             virBufferAsprintf(&opts, ",intremap=%s",
@@ -6893,12 +6885,7 @@ qemuBuildMachineCommandLine(virCommand *cmd,
     if (def->iommu) {
         switch (def->iommu->model) {
         case VIR_DOMAIN_IOMMU_MODEL_INTEL:
-            /* qemuValidateDomainDeviceDefIOMMU() already made sure we have
-             * one of QEMU_CAPS_DEVICE_INTEL_IOMMU or QEMU_CAPS_MACHINE_IOMMU:
-             * here we handle the latter case, while the former is taken care
-             * of in qemuBuildIOMMUCommandLine() */
-            if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_IOMMU))
-                virBufferAddLit(&buf, ",iommu=on");
+            /* The 'intel' IOMMu is formatted in qemuBuildIOMMUCommandLine */
             break;

         case VIR_DOMAIN_IOMMU_MODEL_SMMUV3:
@@ -10478,7 +10465,7 @@ qemuBuildCommandLine(virQEMUDriver *driver,
     if (qemuBuildBootCommandLine(cmd, def, qemuCaps) < 0)
         return NULL;

-    if (qemuBuildIOMMUCommandLine(cmd, def, qemuCaps) < 0)
+    if (qemuBuildIOMMUCommandLine(cmd, def) < 0)
         return NULL;

     if (qemuBuildGlobalControllerCommandLine(cmd, def) < 0)
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 18c851d693..53dadfe68a 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -4713,8 +4713,7 @@ qemuValidateDomainDeviceDefIOMMU(const virDomainIOMMUDef *iommu,
                            virDomainIOMMUModelTypeToString(iommu->model));
             return -1;
         }
-        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_INTEL_IOMMU) &&
-            !virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_IOMMU)) {
+        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_INTEL_IOMMU)) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("IOMMU device: '%s' is not supported with "
                              "this QEMU binary"),
-- 
2.30.2




More information about the libvir-list mailing list