From: Christian Ludwig <christian_ludwig@genua.de>
To: <pve-devel@lists.proxmox.com>
Subject: [PATCH v2 qemu-server 07/16] config: add the efi-firmware option
Date: Mon, 28 Sep 2026 07:48:06 +0200 [thread overview]
Message-ID: <819dba534c9f906bad8d34de900e7ca1028eca8b.1790337726.git@genua.de> (raw)
In-Reply-To: <cover.1790337423.git@genua.de>
Add the 'efi-firmware' config key, pointing to a volume of the
efi-firmware content type. A custom firmware image does not make sense
for a legacy BIOS, so require bios=ovmf when generating the command
line.
Include the volume when activating a VM's volumes. Firmware images are
content and not owned by the VM, like ISO images, so refuse migration
unless they are on a shared storage.
Signed-off-by: Christian Ludwig <christian_ludwig@genua.de>
---
src/PVE/QemuConfig.pm | 2 +-
src/PVE/QemuMigrate.pm | 2 ++
src/PVE/QemuServer.pm | 18 ++++++++++++++++--
3 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/src/PVE/QemuConfig.pm b/src/PVE/QemuConfig.pm
index 26f0fda2..1d73048a 100644
--- a/src/PVE/QemuConfig.pm
+++ b/src/PVE/QemuConfig.pm
@@ -105,7 +105,7 @@ sub parse_volume {
my ($class, $key, $volume_string, $noerr) = @_;
my $volume;
- if ($key eq 'vmstate') {
+ if ($key eq 'vmstate' || $key eq 'efi-firmware') {
eval { PVE::JSONSchema::check_format('pve-volume-id', $volume_string) };
if (my $err = $@) {
return if $noerr;
diff --git a/src/PVE/QemuMigrate.pm b/src/PVE/QemuMigrate.pm
index 8da6f15d..1ccdffab 100644
--- a/src/PVE/QemuMigrate.pm
+++ b/src/PVE/QemuMigrate.pm
@@ -440,6 +440,8 @@ sub scan_local_volumes {
$self->target_storage_check_available($storecfg, $targetsid, $volid);
return if $scfg->{shared} && !$self->{opts}->{remote};
+ die "local efi-firmware image\n" if $attr->{is_firmware};
+
$local_volumes->{$volid}->{ref} = 'pending' if $attr->{referenced_in_pending};
$local_volumes->{$volid}->{ref} = 'snapshot' if $attr->{referenced_in_snapshot};
$local_volumes->{$volid}->{ref} = 'unused' if $attr->{is_unused};
diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index 63d8c135..53b35b22 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -663,6 +663,14 @@ EODESCR
description => "Select BIOS implementation.",
default => 'seabios',
},
+ 'efi-firmware' => {
+ optional => 1,
+ type => 'string',
+ format => 'pve-volume-id',
+ description => "Custom EFI firmware code image (pflash0). Must be a volid "
+ . "referencing a 'efi-firmware' content type volume (e.g. "
+ . "'local:efi-firmware/custom.fd'). Requires bios=ovmf.",
+ },
vmgenid => {
type => 'string',
pattern => '(?:[a-fA-F0-9]{8}(?:-[a-fA-F0-9]{4}){3}-[a-fA-F0-9]{12}|[01])',
@@ -3255,6 +3263,9 @@ sub config_to_command {
push @$cmd, '-smbios', "type=1" . $smbios_string;
}
+ die "efi-firmware requires bios=ovmf\n"
+ if $conf->{'efi-firmware'} && (!$conf->{bios} || $conf->{bios} ne 'ovmf');
+
if ($conf->{bios} && $conf->{bios} eq 'ovmf') {
die "OVMF (UEFI) BIOS is not supported on 32-bit CPU types\n"
if !$forcecpu && get_cpu_bitness($conf->{cpu}, $arch) == 32;
@@ -4568,11 +4579,14 @@ sub foreach_volid {
$volhash->{$volid}->{is_tpmstate} //= 0;
$volhash->{$volid}->{is_tpmstate} = 1 if $key eq 'tpmstate0';
+ $volhash->{$volid}->{is_firmware} //= 0;
+ $volhash->{$volid}->{is_firmware} = 1 if $key eq 'efi-firmware';
+
$volhash->{$volid}->{drivename} = $key if is_valid_drivename($key);
};
my $include_opts = {
- extra_keys => ['vmstate'],
+ extra_keys => ['vmstate', 'efi-firmware'],
include_unused => 1,
};
@@ -6123,7 +6137,7 @@ sub get_current_vm_volumes {
PVE::QemuConfig->foreach_volume_full(
$conf,
- { extra_keys => ['vmstate'] },
+ { extra_keys => ['vmstate', 'efi-firmware'] },
sub {
my ($ds, $drive) = @_;
--
2.34.1
next prev parent reply other threads:[~2026-09-28 5:49 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 5:47 [PATCH v2 0/16] Support for custom EFI firmware Christian Ludwig
2026-09-28 5:47 ` [PATCH v2 pve-storage 1/16] plugin: add efi-firmware content type Christian Ludwig
2026-09-28 5:47 ` [PATCH v2 pve-storage 2/16] test: get_subdir: cover the " Christian Ludwig
2026-09-28 5:48 ` [PATCH v2 pve-storage 3/16] plugins: allow the efi-firmware content type on file based storages Christian Ludwig
2026-09-28 5:48 ` [PATCH v2 pve-storage 4/16] api: status: support efi-firmware in upload and download-url Christian Ludwig
2026-09-28 5:48 ` [PATCH v2 pve-storage 5/16] test: volume access: cover efi-firmware volumes Christian Ludwig
2026-09-28 5:48 ` [PATCH v2 pve-storage 6/16] test: list volumes: " Christian Ludwig
2026-09-28 5:48 ` Christian Ludwig [this message]
2026-09-28 5:48 ` [PATCH v2 qemu-server 08/16] api: allow setting the efi-firmware option Christian Ludwig
2026-09-28 5:48 ` [PATCH v2 qemu-server 09/16] ovmf: use a custom firmware image if configured Christian Ludwig
2026-09-28 5:48 ` [PATCH v2 qemu-server 10/16] test: efi-firmware key in VM config Christian Ludwig
2026-09-28 5:48 ` [PATCH v2 qemu-server 11/16] test: efi-firmware volumes replication Christian Ludwig
2026-09-28 5:48 ` [PATCH v2 pve-manager 12/16] ui: storage: add efi-firmware content type support Christian Ludwig
2026-09-28 5:48 ` [PATCH v2 pve-manager 13/16] ui: form: support other content types in the ISO selector Christian Ludwig
2026-09-28 5:48 ` [PATCH v2 pve-manager 14/16] ui: qemu: allow selecting a custom EFI firmware image Christian Ludwig
2026-09-28 5:48 ` [PATCH v2 pve-docs 15/16] pvesm: document the efi-firmware content type Christian Ludwig
2026-09-28 5:48 ` [PATCH v2 pve-docs 16/16] qm: document the efi-firmware VM 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=819dba534c9f906bad8d34de900e7ca1028eca8b.1790337726.git@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox