]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Tweak Intel IOMMU command line generation
authorAndrea Bolognani <abologna@redhat.com>
Mon, 20 May 2019 10:48:01 +0000 (12:48 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Thu, 23 May 2019 13:19:06 +0000 (15:19 +0200)
Mostly add comments explaining why there are two capabilites
for the same feature and how they interact.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_command.c

index e16c748d3115199908dbf618f46ebb5dfd8217f2..73f570c41962b0733b05ac9047eed3b0a4f47e9a 100644 (file)
@@ -6935,8 +6935,12 @@ qemuBuildIOMMUCommandLine(virCommandPtr cmd,
     if (!iommu)
         return 0;
 
-    if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_IOMMU))
-        return 0; /* Already handled via -machine */
+    /* qemuDomainDeviceDefValidate() 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;
 
     switch (iommu->model) {
     case VIR_DOMAIN_IOMMU_MODEL_INTEL:
@@ -7594,7 +7598,10 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
         }
     }
 
-    /* We don't report errors on missing cap here - -device code will do that */
+    /* qemuDomainDeviceDefValidate() 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 (def->iommu &&
         virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_IOMMU)) {
         switch (def->iommu->model) {