From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 308C51FF09B for ; Mon, 31 Aug 2026 13:25:48 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 5974C212BA; Mon, 31 Aug 2026 13:25:47 +0200 (CEST) From: Dominik Csapak 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 Message-ID: <20260831112543.2552200-1-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.658 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: VKY5ANSWGZO3LV5QTQAJ73NNLQCQKMLF X-Message-ID-Hash: VKY5ANSWGZO3LV5QTQAJ73NNLQCQKMLF X-MailFrom: d.csapak@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- 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