]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Add IOMMU device alias to command line
authorAndrea Bolognani <abologna@redhat.com>
Thu, 21 Jul 2022 09:14:21 +0000 (11:14 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Fri, 22 Jul 2022 15:38:09 +0000 (17:38 +0200)
Note that we can only do this for intel-iommu and virtio-iommu,
which are configured using -device; smmuv3 is configured using
a machine type property, so there's no room on the command line
for an alias in that case.

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

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_command.c
tests/qemuxml2argvdata/intel-iommu-aw-bits.x86_64-latest.args
tests/qemuxml2argvdata/intel-iommu-caching-mode.x86_64-latest.args
tests/qemuxml2argvdata/intel-iommu-device-iotlb.x86_64-latest.args
tests/qemuxml2argvdata/intel-iommu-eim.x86_64-latest.args
tests/qemuxml2argvdata/intel-iommu.x86_64-latest.args
tests/qemuxml2argvdata/virtio-iommu-aarch64.aarch64-latest.args
tests/qemuxml2argvdata/virtio-iommu-x86_64.x86_64-latest.args

index 262fffe5fe40dc224cb42e76e022cb243443711a..30c9bbbf2ea6f9f2ecbac2dc6041b3261a915eff 100644 (file)
@@ -6441,6 +6441,7 @@ qemuBuildIOMMUCommandLine(virCommand *cmd,
     case VIR_DOMAIN_IOMMU_MODEL_INTEL:
         if (virJSONValueObjectAdd(&props,
                                   "s:driver", "intel-iommu",
+                                  "s:id", iommu->info.alias,
                                   "S:intremap", qemuOnOffAuto(iommu->intremap),
                                   "T:caching-mode", iommu->caching_mode,
                                   "S:eim", qemuOnOffAuto(iommu->eim),
@@ -6457,6 +6458,7 @@ qemuBuildIOMMUCommandLine(virCommand *cmd,
     case VIR_DOMAIN_IOMMU_MODEL_VIRTIO:
         if (virJSONValueObjectAdd(&props,
                                   "s:driver", "virtio-iommu",
+                                  "s:id", iommu->info.alias,
                                   NULL) < 0) {
             return -1;
         }
index f61ff3f8ff78095879f24d5db9e2a01c27ab3556..df11e3ddabc0a421e2cb02086e702d4d51ace2ac 100644 (file)
@@ -27,7 +27,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
 -no-shutdown \
 -no-acpi \
 -boot strict=on \
--device '{"driver":"intel-iommu","intremap":"on","aw-bits":48}' \
+-device '{"driver":"intel-iommu","id":"iommu0","intremap":"on","aw-bits":48}' \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on
index 083c6bfe4b7b2fb4a23df6dc77fa2d0d191119fb..47976fa6a772724d31c907f1c1dd94f46789245b 100644 (file)
@@ -27,7 +27,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
 -no-shutdown \
 -no-acpi \
 -boot strict=on \
--device '{"driver":"intel-iommu","intremap":"on","caching-mode":true}' \
+-device '{"driver":"intel-iommu","id":"iommu0","intremap":"on","caching-mode":true}' \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on
index fc06e15191b44e0392371a7155dfe2d05bfbe4af..af36c452928cb29f56c9a732a116012ecafeb497 100644 (file)
@@ -27,7 +27,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
 -no-shutdown \
 -no-acpi \
 -boot strict=on \
--device '{"driver":"intel-iommu","intremap":"on","device-iotlb":true}' \
+-device '{"driver":"intel-iommu","id":"iommu0","intremap":"on","device-iotlb":true}' \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on
index c8dd31c5fe50d45dfc692064dacf3ff2eec6f627..8e2b54d1f93f54b3a29ae56d0ae2800430940d83 100644 (file)
@@ -27,7 +27,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
 -no-shutdown \
 -no-acpi \
 -boot strict=on \
--device '{"driver":"intel-iommu","intremap":"on","eim":"on"}' \
+-device '{"driver":"intel-iommu","id":"iommu0","intremap":"on","eim":"on"}' \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on
index db69543298800b06d6e42f2a3a23edc73e9960a3..c99efd229ba44aba332df595ffab001bdc337ef4 100644 (file)
@@ -27,7 +27,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
 -no-shutdown \
 -no-acpi \
 -boot strict=on \
--device '{"driver":"intel-iommu"}' \
+-device '{"driver":"intel-iommu","id":"iommu0"}' \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on
index 9c1de8ae9b017001026960fb551ab5e91ba86714..54f069c350e6a8f83457da2511d60f44c377a95a 100644 (file)
@@ -30,7 +30,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-guest/.config \
 -rtc base=utc \
 -no-shutdown \
 -boot strict=on \
--device '{"driver":"virtio-iommu","bus":"pcie.0","addr":"0x1"}' \
+-device '{"driver":"virtio-iommu","id":"iommu0","bus":"pcie.0","addr":"0x1"}' \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on
index 7e0aa7192d0d952c6766a2489f31fd0a12608a92..744367c6c099fb7858ca9ddf4effbda29d2d2da2 100644 (file)
@@ -26,7 +26,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
 -rtc base=utc \
 -no-shutdown \
 -boot strict=on \
--device '{"driver":"virtio-iommu","bus":"pcie.0","addr":"0x1"}' \
+-device '{"driver":"virtio-iommu","id":"iommu0","bus":"pcie.0","addr":"0x1"}' \
 -audiodev '{"id":"audio1","driver":"none"}' \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on