]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Use pci_bus to identify multi-smmuv3 model
authorNathan Chen via Devel <devel@lists.libvirt.org>
Tue, 2 Dec 2025 19:59:47 +0000 (11:59 -0800)
committerJán Tomko <jtomko@redhat.com>
Fri, 5 Dec 2025 08:19:48 +0000 (09:19 +0100)
Use presence of non-negative pci_bus to identify multi-smmuv3
IOMMU model, instead of the niommus attribute. This allows for
specifying a single arm-smmuv3 on the qemu command line,
instead of both the virt-machine smmuv3 and arm-smmuv3
being specified at the same time.

Signed-off-by: Nathan Chen <nathanc@nvidia.com>
Fixes: e70c4d54d365 conf: Support multiple device-pluggable smmuv3 IOMMUs
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_command.c
src/qemu/qemu_postparse.c
tests/qemuxmlconfdata/iommu-smmuv3-pci-bus-single.aarch64-latest.args

index b69fe23236772edcc19daff58c188f8fe44beaf7..fb89dbec2726348d9597ecbcd8002ac25213e037 100644 (file)
@@ -7192,7 +7192,7 @@ qemuBuildMachineCommandLine(virCommand *cmd,
     if (qemuAppendDomainFeaturesMachineParam(&buf, def, qemuCaps) < 0)
         return -1;
 
-    if (def->niommus == 1) {
+    if (def->iommus && def->iommus[0]->pci_bus < 0) {
         switch (def->iommus[0]->model) {
         case VIR_DOMAIN_IOMMU_MODEL_SMMUV3:
             virBufferAddLit(&buf, ",iommu=smmuv3");
index dc5ade829a2775e69145a2a4c2da89ac75ff8245..840d6a117465e98ac2e1d25fee2cbcb490d9e2fd 100644 (file)
@@ -1559,7 +1559,7 @@ qemuDomainDefEnableDefaultFeatures(virDomainDef *def,
      * domain already has IOMMU without inremap. This will be fixed in
      * qemuDomainIOMMUDefPostParse() but there domain definition can't be
      * modified so change it now. */
-    if (def->iommus && def->niommus == 1 &&
+    if (def->iommus && def->iommus[0]->pci_bus < 0 &&
         (def->iommus[0]->intremap == VIR_TRISTATE_SWITCH_ON ||
          qemuDomainNeedsIOMMUWithEIM(def)) &&
         def->features[VIR_DOMAIN_FEATURE_IOAPIC] == VIR_DOMAIN_IOAPIC_NONE) {
index 976467e64147ea84d039802654b8598e738b0801..34e7bda1c59cbcb05671190a21c504583c0a363d 100644 (file)
@@ -10,7 +10,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
 -name guest=guest,debug-threads=on \
 -S \
 -object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \
--machine virt,usb=off,gic-version=2,iommu=smmuv3,dump-guest-core=off,memory-backend=mach-virt.ram,acpi=off \
+-machine virt,usb=off,gic-version=2,dump-guest-core=off,memory-backend=mach-virt.ram,acpi=off \
 -accel tcg \
 -cpu cortex-a15 \
 -m size=1048576k \