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 B12541FF0E1 for ; Mon, 13 Jul 2026 14:40:32 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 3743F2139E; Mon, 13 Jul 2026 14:40:32 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Subject: [PATCH qemu-server v2 2/3] cpu config: use $version_guard rather than passing $machine_version Date: Mon, 13 Jul 2026 14:40:16 +0200 Message-ID: <20260713124025.121154-3-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260713124025.121154-1-f.ebner@proxmox.com> References: <20260713124025.121154-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: 1783946413426 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.344 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_LOW -0.7 Sender listed at https://www.dnswl.org/, low 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: PSPJ7FYADJMI7Q3NOOZD6FKB2NET6URN X-Message-ID-Hash: PSPJ7FYADJMI7Q3NOOZD6FKB2NET6URN 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 --- Changes in v2: * Adapt new hunk from previous patch. src/PVE/QemuServer.pm | 2 +- src/PVE/QemuServer/CPUConfig.pm | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 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 5b243000..c322cebc 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( $arch eq 'x86_64' && min_version($qemu_binary_version, 11, 0) # The vmx-mbec flag got introduced in QEMU 11.0. && $cputype eq 'host' # Other QEMU CPU models did not expose the vmx-mbec flag in 11.0. - && !min_version($machine_version, 11, 0) + && !$version_guard->(11, 0) ) { $pve_flags->{'vmx-mbec'} = { op => '-', @@ -1071,7 +1071,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; @@ -1099,7 +1099,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'); @@ -1107,7 +1107,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'); @@ -1117,12 +1117,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