From: Fiona Ebner <f.ebner@proxmox.com>
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 [thread overview]
Message-ID: <20260709134211.199744-2-f.ebner@proxmox.com> (raw)
In-Reply-To: <20260709134211.199744-1-f.ebner@proxmox.com>
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 <f.ebner@proxmox.com>
---
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
next prev parent reply other threads:[~2026-07-09 13:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 13:41 [PATCH-SERIES qemu-server 0/2] cpu config: disable APICv for Windows 11/2022/2025 to mitigate issues with VBS Fiona Ebner
2026-07-09 13:42 ` Fiona Ebner [this message]
2026-07-09 13:42 ` [PATCH qemu-server 2/2] " 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=20260709134211.199744-2-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.