all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH qemu-server] qemu: viommu: small variable code cleanup
@ 2026-08-31 11:25 Dominik Csapak
  2026-09-01 12:46 ` applied: " Fiona Ebner
  0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2026-08-31 11:25 UTC (permalink / raw)
  To: pve-devel

Reusing a variable the way done here reads not very nice and is easily
missable and possibly misunderstood. Instead use a dedicated variable
for the aw-bits additional and directly use that when pushing the
devices to the list.

No functionality change intended.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/PVE/QemuServer.pm | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index 63d8c135..d2f569b5 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -3777,9 +3777,9 @@ sub config_to_command {
     PVE::QemuServer::Machine::assert_valid_machine_property($machine_conf);
 
     if (my $viommu = $machine_conf->{viommu}) {
-        my $viommu_devstr = '';
+        my $aw_bits = '';
         if ($machine_conf->{'aw-bits'}) {
-            $viommu_devstr .= ",aw-bits=$machine_conf->{'aw-bits'}";
+            $aw_bits .= ",aw-bits=$machine_conf->{'aw-bits'}";
 
             # TODO remove message once this gets properly checked/warned about in QEMU itself.
             print "vIOMMU 'aw-bits' set to $machine_conf->{'aw-bits'}. Sometimes it is necessary to"
@@ -3787,12 +3787,10 @@ sub config_to_command {
         }
 
         if ($viommu eq 'intel') {
-            $viommu_devstr = "intel-iommu,intremap=on,caching-mode=on$viommu_devstr";
-            unshift @$devices, '-device', $viommu_devstr;
+            unshift @$devices, '-device', "intel-iommu,intremap=on,caching-mode=on$aw_bits";
             push @$machineFlags, 'kernel-irqchip=split';
         } elsif ($viommu eq 'virtio') {
-            $viommu_devstr = "virtio-iommu-pci$viommu_devstr";
-            push @$devices, '-device', $viommu_devstr;
+            push @$devices, '-device', "virtio-iommu-pci$aw_bits";
         }
     }
 
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-01 12:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-31 11:25 [PATCH qemu-server] qemu: viommu: small variable code cleanup Dominik Csapak
2026-09-01 12:46 ` applied: " Fiona Ebner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal