public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu-server] qemu: viommu: small variable code cleanup
Date: Mon, 31 Aug 2026 13:25:37 +0200	[thread overview]
Message-ID: <20260831112543.2552200-1-d.csapak@proxmox.com> (raw)

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





             reply	other threads:[~2026-08-31 11:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31 11:25 Dominik Csapak [this message]
2026-09-01 12:46 ` applied: [PATCH qemu-server] qemu: viommu: small variable code cleanup Fiona Ebner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260831112543.2552200-1-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal