[libvirt PATCH v2 20/22] qemu: Generate command line for virtio-iommu

Andrea Bolognani abologna at redhat.com
Wed Oct 20 13:02:55 UTC 2021


https://bugzilla.redhat.com/show_bug.cgi?id=1653327

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 src/qemu/qemu_command.c                              | 12 +++++++++++-
 .../virtio-iommu-aarch64.aarch64-latest.args         |  1 +
 .../virtio-iommu-x86_64.x86_64-latest.args           |  1 +
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 41e487d056..97be569892 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -953,6 +953,7 @@ qemuBuildVirtioDevGetConfigDev(const virDomainDeviceDef *device,
             break;
 
         case VIR_DOMAIN_DEVICE_IOMMU:
+            *baseName = "virtio-iommu";
             break;
 
         case VIR_DOMAIN_DEVICE_LEASE:
@@ -6565,7 +6566,16 @@ qemuBuildIOMMUCommandLine(virCommand *cmd,
         return 0;
 
     case VIR_DOMAIN_IOMMU_MODEL_VIRTIO:
-        break;
+        if (!(props = qemuBuildVirtioDevProps(VIR_DOMAIN_DEVICE_IOMMU, iommu, qemuCaps)))
+            return -1;
+
+        if (qemuBuildDeviceAddressProps(props, def, &iommu->info) < 0)
+            return -1;
+
+        if (qemuBuildDeviceCommandlineFromJSON(cmd, props, qemuCaps) < 0)
+            return -1;
+
+        return 0;
 
     case VIR_DOMAIN_IOMMU_MODEL_SMMUV3:
         /* There is no -device for SMMUv3, so nothing to be done here */
diff --git a/tests/qemuxml2argvdata/virtio-iommu-aarch64.aarch64-latest.args b/tests/qemuxml2argvdata/virtio-iommu-aarch64.aarch64-latest.args
index 0363b0370d..343af7b2a1 100644
--- a/tests/qemuxml2argvdata/virtio-iommu-aarch64.aarch64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-iommu-aarch64.aarch64-latest.args
@@ -29,6 +29,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-guest/.config \
 -rtc base=utc \
 -no-shutdown \
 -boot strict=on \
+-device '{"driver":"virtio-iommu-pci","bus":"pcie.0","addr":"0x1"}' \
 -audiodev id=audio1,driver=none \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-iommu-x86_64.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-iommu-x86_64.x86_64-latest.args
index 8a1413d33d..9fcc76f7b3 100644
--- a/tests/qemuxml2argvdata/virtio-iommu-x86_64.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-iommu-x86_64.x86_64-latest.args
@@ -25,6 +25,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
 -rtc base=utc \
 -no-shutdown \
 -boot strict=on \
+-device '{"driver":"virtio-iommu-pci","bus":"pcie.0","addr":"0x1"}' \
 -audiodev id=audio1,driver=none \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on
-- 
2.31.1




More information about the libvir-list mailing list