[libvirt] [PATCH 8/8] qemu: Tweak Intel IOMMU command line generation

Andrea Bolognani posted 8 patches 6 years, 8 months ago
[libvirt] [PATCH 8/8] qemu: Tweak Intel IOMMU command line generation
Posted by Andrea Bolognani 6 years, 8 months ago
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>
---
 src/qemu/qemu_command.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index e16c748d31..73f570c419 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -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) {
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 8/8] qemu: Tweak Intel IOMMU command line generation
Posted by Ján Tomko 6 years, 8 months ago
On Mon, May 20, 2019 at 01:37:53PM +0200, Andrea Bolognani wrote:
>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>
>---
> src/qemu/qemu_command.c | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list