From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu-server v3 2/4] cpu config: use $version_guard rather than passing $machine_version
Date: Tue, 14 Jul 2026 12:41:49 +0200 [thread overview]
Message-ID: <20260714104201.71308-3-f.ebner@proxmox.com> (raw)
In-Reply-To: <20260714104201.71308-1-f.ebner@proxmox.com>
No functional change intended. This is in preparation for commit "cpu
config: enable hv-evmcs 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 <f.ebner@proxmox.com>
---
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
next prev parent reply other threads:[~2026-07-14 10:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 10:41 [PATCH-SERIES qemu-server v3 0/4] cpu config: enable hv-evmcs for Windows 11/2022/2025 to mitigate issues with VBS Fiona Ebner
2026-07-14 10:41 ` [PATCH qemu-server v3 1/4] cpu config: disable vmx-mbec flag for machine versions < 11.0 Fiona Ebner
2026-07-14 10:41 ` Fiona Ebner [this message]
2026-07-14 10:41 ` [PATCH qemu-server v3 3/4] cpu config: enable hv-evmcs for Windows 11/2022/2025 to mitigate issues with VBS Fiona Ebner
2026-07-14 10:41 ` [PATCH qemu-server v3 4/4] test: cfg2cmd: allow setting host CPU vendor for a given test 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=20260714104201.71308-3-f.ebner@proxmox.com \
--to=f.ebner@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