From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 608781FF0E0 for ; Thu, 09 Jul 2026 15:42:24 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 3D9DF21501; Thu, 09 Jul 2026 15:42:19 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Subject: [PATCH qemu-server 1/2] cpu config: use $version_guard rather than passing $machine_version Date: Thu, 9 Jul 2026 15:42:00 +0200 Message-ID: <20260709134211.199744-2-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260709134211.199744-1-f.ebner@proxmox.com> References: <20260709134211.199744-1-f.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1783604524526 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.029 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) 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: LBHEIH36P2HSO4RXPR5UXS7AHDYPHAZ4 X-Message-ID-Hash: LBHEIH36P2HSO4RXPR5UXS7AHDYPHAZ4 X-MailFrom: f.ebner@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: No functional change intended. This is in preparation for commit "cpu config: disable APICv for Windows 11/2022/2025 to mitigate issues with VBS" so that the 11.0+pve2 version is correctly used. Signed-off-by: Fiona Ebner --- src/PVE/QemuServer.pm | 2 +- src/PVE/QemuServer/CPUConfig.pm | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm index 59a37098..191ae549 100644 --- a/src/PVE/QemuServer.pm +++ b/src/PVE/QemuServer.pm @@ -3418,7 +3418,7 @@ sub config_to_command { $arch, $kvm, $kvm_off, - $machine_version, + $version_guard, $winversion, $gpu_passthrough, $kvmver, diff --git a/src/PVE/QemuServer/CPUConfig.pm b/src/PVE/QemuServer/CPUConfig.pm index df3e2b92..4f409528 100644 --- a/src/PVE/QemuServer/CPUConfig.pm +++ b/src/PVE/QemuServer/CPUConfig.pm @@ -862,7 +862,7 @@ my sub check_phys_bits_above_40_compat($bios, $cpu_type, $cpu_flags) { # Calculate QEMU's '-cpu' argument from a given VM configuration sub get_cpu_options( - $conf, $arch, $kvm, $kvm_off, $machine_version, $winversion, $gpu_passthrough, + $conf, $arch, $kvm, $kvm_off, $version_guard, $winversion, $gpu_passthrough, $qemu_binary_version, ) { @@ -902,14 +902,14 @@ sub get_cpu_options( if !defined(get_cpu_models_by_arch($arch)->{$cputype}); my $pve_flags = get_pve_cpu_flags( - $conf, $kvm, $cputype, $arch, $machine_version, $winversion, $qemu_binary_version, + $conf, $kvm, $cputype, $arch, $version_guard, $winversion, $qemu_binary_version, ); my $hv_flags; if ($kvm && $arch eq 'x86_64') { $hv_flags = get_hyperv_enlightenments( $winversion, - $machine_version, + $version_guard, $conf->{bios}, $gpu_passthrough, $hv_vendor_id, @@ -999,7 +999,7 @@ sub get_cpu_options( # Some hardcoded flags required by certain configurations sub get_pve_cpu_flags( - $conf, $kvm, $cputype, $arch, $machine_version, $winversion, $qemu_binary_version, + $conf, $kvm, $cputype, $arch, $version_guard, $winversion, $qemu_binary_version, ) { my $pve_flags = {}; @@ -1033,7 +1033,7 @@ sub get_pve_cpu_flags( }; } - if (min_version($machine_version, 2, 3) && $kvm && $arch eq 'x86_64') { + if ($version_guard->(2, 3) && $kvm && $arch eq 'x86_64') { $pve_flags->{'kvm_pv_unhalt'} = { op => '+', reason => "$pve_msg to improve Linux guest spinlock performance", @@ -1059,7 +1059,7 @@ sub get_pve_cpu_flags( } sub get_hyperv_enlightenments( - $winversion, $machine_version, $bios, $gpu_passthrough, $hv_vendor_id = undef, + $winversion, $version_guard, $bios, $gpu_passthrough, $hv_vendor_id = undef, ) { return if $winversion < 6; @@ -1087,7 +1087,7 @@ sub get_hyperv_enlightenments( ); } - if (min_version($machine_version, 2, 3)) { + if ($version_guard->(2, 3)) { $flagfn->('hv_spinlocks', '0x1fff'); $flagfn->('hv_vapic'); $flagfn->('hv_time'); @@ -1095,7 +1095,7 @@ sub get_hyperv_enlightenments( $flagfn->('hv_spinlocks', '0xffff'); } - if (min_version($machine_version, 2, 6)) { + if ($version_guard->(2, 6)) { $flagfn->('hv_reset'); $flagfn->('hv_vpindex'); $flagfn->('hv_runtime'); @@ -1105,12 +1105,12 @@ sub get_hyperv_enlightenments( my $win7_reason = $default_reason . " 7 and higher"; $flagfn->('hv_relaxed', undef, $win7_reason); - if (min_version($machine_version, 2, 12)) { + if ($version_guard->(2, 12)) { $flagfn->('hv_synic', undef, $win7_reason); $flagfn->('hv_stimer', undef, $win7_reason); } - if (min_version($machine_version, 3, 1)) { + if ($version_guard->(3, 1)) { $flagfn->('hv_ipi', undef, $win7_reason); } } -- 2.47.3