From: Christian Ludwig <christian_ludwig@genua.de>
To: <pve-devel@lists.proxmox.com>
Subject: [PATCH qemu-server v4 10/20] config: define bios schema as property-string
Date: Thu, 19 Nov 2026 15:14:20 +0100 [thread overview]
Message-ID: <896164aaf6d3ec7871a8df824ff9d9f4f63e7094.1795092172.git.christian_ludwig@genua.de> (raw)
In-Reply-To: <cover.1795092172.git.christian_ludwig@genua.de>
Convert the bios parameter to a property-string and use the BIOS type as
the default key for backward compatibility. This allows adding further
BIOS related options, like a custom firmware image, as sub-properties.
The 'seabios' default moves to the BIOS type accordingly.
Add helpers to parse and print the property-string and to query the
BIOS type, and use the latter everywhere the bios option was compared
directly. No functional change intended.
Signed-off-by: Christian Ludwig <christian_ludwig@genua.de>
---
src/PVE/QemuConfig.pm | 3 ++-
src/PVE/QemuServer.pm | 16 ++++++-------
src/PVE/QemuServer/BIOS.pm | 42 +++++++++++++++++++++++++++++++++
src/PVE/QemuServer/CPUConfig.pm | 5 ++--
src/PVE/QemuServer/Makefile | 1 +
src/PVE/QemuServer/PCI.pm | 3 ++-
6 files changed, 58 insertions(+), 12 deletions(-)
create mode 100644 src/PVE/QemuServer/BIOS.pm
diff --git a/src/PVE/QemuConfig.pm b/src/PVE/QemuConfig.pm
index 6656c137..0fbd312c 100644
--- a/src/PVE/QemuConfig.pm
+++ b/src/PVE/QemuConfig.pm
@@ -10,6 +10,7 @@ use PVE::INotify;
use PVE::JSONSchema;
use PVE::QemuMigrate::Helpers;
use PVE::QemuServer::Agent;
+use PVE::QemuServer::BIOS qw(get_bios_type);
use PVE::QemuServer::Blockdev;
use PVE::QemuServer::CPUConfig;
use PVE::QemuServer::Drive;
@@ -195,7 +196,7 @@ sub get_backup_volumes {
my $reason = "backup=";
$reason .= defined($drive->{backup}) ? 'no' : 'yes';
- if ($key =~ m/^efidisk/ && (!defined($conf->{bios}) || $conf->{bios} ne 'ovmf')) {
+ if ($key =~ m/^efidisk/ && get_bios_type($conf) ne 'ovmf') {
$included = 0;
$reason = "efidisk but no OVMF BIOS";
}
diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index 148052cb..a64c0ee9 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -54,6 +54,7 @@ use PVE::QemuConfig;
use PVE::QemuConfig::NoWrite;
use PVE::QemuMigrate::Helpers;
use PVE::QemuServer::Agent qw(get_qga_key parse_guest_agent qga_check_running);
+use PVE::QemuServer::BIOS qw(get_bios_type);
use PVE::QemuServer::Blockdev;
use PVE::QemuServer::BlockJob;
use PVE::QemuServer::Cfg2Cmd;
@@ -673,9 +674,8 @@ EODESCR
bios => {
optional => 1,
type => 'string',
- enum => [qw(seabios ovmf)],
+ format => 'pve-qm-bios',
description => "Select BIOS implementation.",
- default => 'seabios',
},
vmgenid => {
type => 'string',
@@ -1514,7 +1514,7 @@ sub print_vga_device {
my $edidoff = "";
if ($type eq 'VGA' && windows_version($conf->{ostype})) {
- $edidoff = ",edid=off" if (!defined($conf->{bios}) || $conf->{bios} ne 'ovmf');
+ $edidoff = ",edid=off" if get_bios_type($conf) ne 'ovmf';
}
my $q35 = PVE::QemuServer::Machine::machine_type_is_q35($conf);
@@ -3075,7 +3075,7 @@ my sub should_disable_smm {
return if $machine =~ m/^virt/; # there is no smm flag that could be disabled
return
- (!defined($conf->{bios}) || $conf->{bios} eq 'seabios')
+ get_bios_type($conf) eq 'seabios'
&& $vga->{type}
&& $vga->{type} =~ m/^(serial\d+|none)$/;
}
@@ -3258,7 +3258,7 @@ sub config_to_command {
push @$cmd, '-smbios', "type=1" . $smbios_string;
}
- if ($conf->{bios} && $conf->{bios} eq 'ovmf') {
+ if (get_bios_type($conf) eq 'ovmf') {
die "OVMF (UEFI) BIOS is not supported on 32-bit CPU types\n"
if !$forcecpu && get_cpu_bitness($conf->{cpu}, $arch) == 32;
@@ -3771,10 +3771,10 @@ sub config_to_command {
}
if ($conf->{'amd-sev'}) {
- push @$devices, '-object', get_amd_sev_object($conf->{'amd-sev'}, $conf->{bios});
+ push @$devices, '-object', get_amd_sev_object($conf->{'amd-sev'}, get_bios_type($conf));
push @$machineFlags, 'confidential-guest-support=sev0';
} elsif ($conf->{'intel-tdx'}) {
- my $tdx_object = get_intel_tdx_object($conf->{'intel-tdx'}, $conf->{bios});
+ my $tdx_object = get_intel_tdx_object($conf->{'intel-tdx'}, get_bios_type($conf));
push @$devices, '-object', to_json($tdx_object, { canonical => 1 });
push @$machineFlags, 'confidential-guest-support=tdx0';
push @$machineFlags, 'kernel_irqchip=split';
@@ -5564,7 +5564,7 @@ sub vm_start_nolock {
my $storage_hints = generate_storage_hints($conf, 1);
PVE::Storage::activate_volumes($storecfg, $vollist, undef, $storage_hints);
- check_efi_vars($storecfg, $vmid, $conf) if $conf->{bios} && $conf->{bios} eq 'ovmf';
+ check_efi_vars($storecfg, $vmid, $conf) if get_bios_type($conf) eq 'ovmf';
PVE::QemuServer::Drive::warn_about_virtio_win_issues_in_config($conf);
diff --git a/src/PVE/QemuServer/BIOS.pm b/src/PVE/QemuServer/BIOS.pm
new file mode 100644
index 00000000..aa160348
--- /dev/null
+++ b/src/PVE/QemuServer/BIOS.pm
@@ -0,0 +1,42 @@
+package PVE::QemuServer::BIOS;
+
+use v5.36;
+
+use PVE::JSONSchema qw(parse_property_string print_property_string);
+
+use base 'Exporter';
+
+our @EXPORT_OK = qw(
+ parse_bios
+ print_bios
+ get_bios_type
+);
+
+my $bios_fmt = {
+ type => {
+ type => 'string',
+ enum => [qw(seabios ovmf)],
+ default_key => 1,
+ description => "Select BIOS implementation.",
+ default => 'seabios',
+ },
+};
+PVE::JSONSchema::register_format('pve-qm-bios', $bios_fmt);
+
+sub parse_bios($value) {
+ return {} if !defined($value);
+
+ return parse_property_string($bios_fmt, $value);
+}
+
+sub print_bios($bios) {
+ return print_property_string($bios, $bios_fmt);
+}
+
+# Returns the configured BIOS implementation, 'seabios' or 'ovmf'.
+sub get_bios_type($conf) {
+ # SeaBIOS is the default if the bios option is not set
+ return parse_bios($conf->{bios})->{type} // 'seabios';
+}
+
+1;
diff --git a/src/PVE/QemuServer/CPUConfig.pm b/src/PVE/QemuServer/CPUConfig.pm
index 414682a6..51f075ae 100644
--- a/src/PVE/QemuServer/CPUConfig.pm
+++ b/src/PVE/QemuServer/CPUConfig.pm
@@ -11,6 +11,7 @@ use PVE::ProcFSTools;
use PVE::RESTEnvironment qw(log_warn);
use PVE::Tools qw(run_command);
+use PVE::QemuServer::BIOS qw(get_bios_type);
use PVE::QemuServer::Helpers qw(min_version get_host_arch);
use PVE::QemuServer::CPUFlags qw(cpu_flag_supported_re cpu_flag_any_re supported_cpu_flags_names);
@@ -911,7 +912,7 @@ sub get_cpu_options(
$hv_flags = get_hyperv_enlightenments(
$winversion,
$version_guard,
- $conf->{bios},
+ get_bios_type($conf),
$gpu_passthrough,
$hv_vendor_id,
);
@@ -992,7 +993,7 @@ sub get_cpu_options(
$cpu_str .= $phys_bits;
}
- check_phys_bits_above_40_compat($conf->{bios}, $cputype, $resolved_flags)
+ check_phys_bits_above_40_compat(get_bios_type($conf), $cputype, $resolved_flags)
if $using_phys_bits_above_40;
return ('-cpu', $cpu_str);
diff --git a/src/PVE/QemuServer/Makefile b/src/PVE/QemuServer/Makefile
index 61ed1a4e..8de09114 100644
--- a/src/PVE/QemuServer/Makefile
+++ b/src/PVE/QemuServer/Makefile
@@ -3,6 +3,7 @@ PREFIX=/usr
PERLDIR=$(PREFIX)/share/perl5
SOURCES=Agent.pm \
+ BIOS.pm \
Blockdev.pm \
BlockJob.pm \
Cfg2Cmd.pm \
diff --git a/src/PVE/QemuServer/PCI.pm b/src/PVE/QemuServer/PCI.pm
index d54cd8a0..9bdc9472 100644
--- a/src/PVE/QemuServer/PCI.pm
+++ b/src/PVE/QemuServer/PCI.pm
@@ -12,6 +12,7 @@ use PVE::Mapping::PCI;
use PVE::SysFSTools;
use PVE::Tools;
+use PVE::QemuServer::BIOS qw(get_bios_type);
use PVE::QemuServer::Helpers;
use PVE::QemuServer::Machine;
use PVE::QemuServer::PCI::Mdev;
@@ -668,7 +669,7 @@ sub print_hostpci_devices {
my $xvga = '';
if ($d->{'x-vga'}) {
- $xvga = ',x-vga=on' if !($conf->{bios} && $conf->{bios} eq 'ovmf');
+ $xvga = ',x-vga=on' if get_bios_type($conf) ne 'ovmf';
$kvm_off = 1;
$vga->{type} = 'none' if !defined($conf->{vga});
$gpu_passthrough = 1;
--
2.34.1
next prev parent reply other threads:[~2026-11-19 14:15 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 14:14 [PATCH v4 00/20] Support for custom EFI firmware Christian Ludwig
2026-11-19 14:14 ` [PATCH pve-storage v4 01/20] plugin: add efi-firmware content type Christian Ludwig
2026-11-19 14:14 ` [PATCH pve-storage v4 02/20] test: get_subdir: cover the " Christian Ludwig
2026-11-19 14:14 ` [PATCH pve-storage v4 03/20] plugins: allow the efi-firmware content type on file based storages Christian Ludwig
2026-11-19 14:14 ` [PATCH pve-storage v4 04/20] plugin: allow overriding the efi-firmware directory Christian Ludwig
2026-11-19 14:14 ` [PATCH pve-storage v4 05/20] plugin: support efi-firmware volumes in volume export and import Christian Ludwig
2026-11-19 14:14 ` [PATCH pve-storage v4 06/20] api: status: support efi-firmware in upload and download-url Christian Ludwig
2026-11-19 14:14 ` [PATCH pve-storage v4 07/20] test: volume access: cover efi-firmware volumes Christian Ludwig
2026-11-19 14:14 ` [PATCH pve-storage v4 08/20] test: list volumes: " Christian Ludwig
2026-11-19 14:14 ` [PATCH pve-storage v4 09/20] test: cover efi-firmware volumes in parse_volname and path_to_volume_id Christian Ludwig
2026-11-19 14:14 ` Christian Ludwig [this message]
2026-11-19 14:14 ` [PATCH qemu-server v4 11/20] bios: add a custom firmware sub-property Christian Ludwig
2026-11-19 14:14 ` [PATCH qemu-server v4 12/20] api: check the custom firmware of the bios option Christian Ludwig
2026-11-19 14:14 ` [PATCH qemu-server v4 13/20] test: custom firmware in " Christian Ludwig
2026-11-19 14:14 ` [PATCH qemu-server v4 14/20] test: custom firmware volumes in replication and migration Christian Ludwig
2026-11-19 14:14 ` [PATCH pve-manager v4 15/20] ui: storage: add efi-firmware content type support Christian Ludwig
2026-11-19 14:14 ` [PATCH pve-manager v4 16/20] ui: form: support other content types in the ISO selector Christian Ludwig
2026-11-19 14:14 ` [PATCH pve-manager v4 17/20] ui: qemu: allow selecting a custom EFI firmware image Christian Ludwig
2026-11-19 14:14 ` [PATCH pve-manager v4 18/20] ui: migrate: refuse migration with a local custom " Christian Ludwig
2026-11-19 14:14 ` [PATCH pve-docs v4 19/20] pvesm: document the efi-firmware content type Christian Ludwig
2026-11-19 14:14 ` [PATCH pve-docs v4 20/20] qm: document the custom firmware of the bios option Christian Ludwig
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=896164aaf6d3ec7871a8df824ff9d9f4f63e7094.1795092172.git.christian_ludwig@genua.de \
--to=christian_ludwig@genua.de \
--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.