From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 26A671FF136 for ; Mon, 23 Mar 2026 14:28:51 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id ACD2719608; Mon, 23 Mar 2026 14:29:06 +0100 (CET) From: Fiona Ebner To: pve-devel@lists.proxmox.com Subject: [PATCH qemu-server 4/4] cpu config: warn that OVMF might limit phys-bits to 40 without pdpe1gb CPU flag Date: Mon, 23 Mar 2026 14:27:24 +0100 Message-ID: <20260323132857.125747-5-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260323132857.125747-1-f.ebner@proxmox.com> References: <20260323132857.125747-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: 1774272495095 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.003 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. 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: FLCAMHXYQSFRC72ADGBNPM2LMANP6IZW X-Message-ID-Hash: FLCAMHXYQSFRC72ADGBNPM2LMANP6IZW 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: OVMF limits phys-bits to 40 if no 1 GiB pages are available. When built in debug mode, OVMF logs a debug message about this. But otherwise, there is no user-visible log of this happening. In practice, VMs with a lot of memory or VMs with GPU passthrough with a lot of vRAM might not boot when the pdpe1gb CPU flag is not present. In particular, this is the case for the built-in x86-64-vX models that are based on the qemu64 model as well as the backend default kvm64. It can't be expected that Proxmox VE users check the EDK II source code to figure this out, so log a warning. The warning is limited to CPU models based on the qemu64 and kvm64 models, since checking for other models would require the CPU model expansion which is currently not cheap to get. This should cover most problematic scenarios. Signed-off-by: Fiona Ebner --- src/PVE/QemuServer/CPUConfig.pm | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/PVE/QemuServer/CPUConfig.pm b/src/PVE/QemuServer/CPUConfig.pm index 8da9010e..fb9af277 100644 --- a/src/PVE/QemuServer/CPUConfig.pm +++ b/src/PVE/QemuServer/CPUConfig.pm @@ -879,6 +879,21 @@ sub parse_cpuflag_list { return $res; } +my sub check_phys_bits_above_40_compat { + my ($bios, $cpu_type, $cpu_flags) = @_; + + # Would need to check CPU model expansion for others, but that information is not cheap to get + # right now. Checking with 'qemu64' and 'kvm64' should cover most problematic scenarios. + return if $cpu_type ne 'qemu64' && $cpu_type ne 'kvm64'; + + return if !$bios || $bios ne 'ovmf'; + + if (!$cpu_flags->{pdpe1gb} || $cpu_flags->{pdpe1gb}->{op} eq '-') { + log_warn("OVMF firmware might limit CPU 'phys-bits' to 40" + . " - enable the 'pdpe1gb' CPU flag to avoid this"); + } +} + # Calculate QEMU's '-cpu' argument from a given VM configuration sub get_cpu_options { my ($conf, $arch, $kvm, $kvm_off, $machine_version, $winversion, $gpu_passthrough) = @_; @@ -973,6 +988,8 @@ sub get_cpu_options { ); $cpu_str .= print_cpu_flags($resolved_flags); + my $using_phys_bits_above_40; + for my $phys_bits_opt (qw(guest-phys-bits phys-bits)) { my $phys_bits = ''; for my $cpu_conf ($custom_cpu, $cpu) { @@ -982,14 +999,23 @@ sub get_cpu_options { if ($conf_val eq 'host') { die "unexpected value 'host' for guest-phys-bits" if $phys_bits_opt eq 'guest-phys-bits'; + $phys_bits = ",host-phys-bits=true"; + + my $host_phys_bits = PVE::QemuServer::Helpers::get_host_phys_address_bits(); + $using_phys_bits_above_40 = 1 if defined($host_phys_bits) && $host_phys_bits > 40; } else { $phys_bits = ",${phys_bits_opt}=${conf_val}"; + + $using_phys_bits_above_40 = 1 if $phys_bits_opt eq 'phys-bits' && $conf_val > 40; } } $cpu_str .= $phys_bits; } + check_phys_bits_above_40_compat($conf->{bios}, $cputype, $resolved_flags) + if $using_phys_bits_above_40; + return ('-cpu', $cpu_str); } -- 2.47.3