From: Christian Ludwig <christian_ludwig@genua.de>
To: <pve-devel@lists.proxmox.com>
Subject: [PATCH qemu-server 07/13] Add efi-firmware key to VM config schema
Date: Mon, 17 Aug 2026 13:59:29 +0200 [thread overview]
Message-ID: <aoL3ocEhTfJobX33@pc43.vpn.genua.de> (raw)
In-Reply-To: <e9670c8e-1101-4591-9534-09217632176b@pc43.vpn.genua.de>
[-- Attachment #1: Type: text/plain, Size: 3354 bytes --]
Add a new config key 'efi-firmware' to the VM config schema. That key
points to a firmware content type file.
It is restricted to OVMF bios settings. A custom efi-firmware image does
not make sense for VMs with legacy BIOS.
Signed-off-by: Christian Ludwig <christian_ludwig@genua.de>
---
src/PVE/QemuConfig.pm | 7 +++++++
src/PVE/QemuServer.pm | 30 ++++++++++++++++++++++++++++--
2 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/src/PVE/QemuConfig.pm b/src/PVE/QemuConfig.pm
index 26f0fda2..d25f2bbb 100644
--- a/src/PVE/QemuConfig.pm
+++ b/src/PVE/QemuConfig.pm
@@ -112,6 +112,13 @@ sub parse_volume {
die $err;
}
$volume = { 'file' => $volume_string };
+ } elsif ($key eq 'efi-firmware') {
+ eval { PVE::JSONSchema::check_format('pve-volume-id', $volume_string) };
+ if (my $err = $@) {
+ return if $noerr;
+ die $err;
+ }
+ $volume = { 'file' => $volume_string };
} else {
$volume = PVE::QemuServer::Drive::parse_drive($key, $volume_string);
}
diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index 2f43faa7..b95fcb8c 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])',
@@ -2078,6 +2086,21 @@ sub parse_vm_config {
$res->{pending} = {} if !defined($res->{pending});
+ # config sanity checks
+ if ($res->{'efi-firmware'}) {
+ if (!$res->{bios} || $res->{bios} ne 'ovmf') {
+ $handle_error->("vm $vmid - efi-firmware requires bios=ovmf\n");
+ } else {
+ my ($sid, $volname) = PVE::Storage::parse_volume_id($res->{'efi-firmware'}, 1);
+ if (!$sid || $volname !~ m!^efi-firmware/[^/]+$!) {
+ $handle_error->(
+ "vm $vmid - efi-firmware: invalid volid format,"
+ . " expected <storeid>:efi-firmware/<name>\n"
+ );
+ }
+ }
+ }
+
return $res;
}
@@ -4568,11 +4591,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 +6149,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-08-17 11:59 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-17 9:29 [PATCH storage/qemu 0/13]: Custom UEFI firmware in PVE Christian Ludwig
2026-08-17 11:59 ` Christian Ludwig
2026-08-17 9:29 ` [PATCH pve-storage 1/13] Add efi-firmware content type Christian Ludwig
2026-08-17 9:29 ` [PATCH pve-storage 2/13] Test for " Christian Ludwig
2026-08-17 9:29 ` [PATCH pve-storage 3/13] Allow efi-firmware in file-based storage Christian Ludwig
2026-08-17 9:29 ` [PATCH pve-storage 4/13] Extend storage API endpoints for efi-firmware Christian Ludwig
2026-08-17 9:29 ` [PATCH pve-storage 5/13] Volume access check test " Christian Ludwig
2026-08-17 9:29 ` [PATCH pve-storage 6/13] efi-firmware storage path to volume conversion test Christian Ludwig
2026-08-17 9:29 ` [PATCH qemu-server 07/13] Add efi-firmware key to VM config schema Christian Ludwig
2026-08-17 9:29 ` [PATCH qemu-server 08/13] Add efi-firmware support to the API Christian Ludwig
2026-08-17 9:29 ` [PATCH qemu-server 09/13] Generate efi-firmware Qemu command line Christian Ludwig
2026-08-17 9:29 ` [PATCH qemu-server 10/13] test: efi-firmware key in VM config Christian Ludwig
2026-08-17 9:29 ` [PATCH qemu-server 11/13] test: efi-firmware volumes replication Christian Ludwig
2026-08-17 9:29 ` [PATCH pve-docs 12/13] pvesm: Document efi-firmware content type Christian Ludwig
2026-08-17 9:29 ` [PATCH pve-docs 13/13] qm: Document efi-firmware VM option Christian Ludwig
2026-08-17 11:59 ` [PATCH pve-storage 1/13] Add efi-firmware content type Christian Ludwig
2026-08-17 11:59 ` [PATCH pve-storage 2/13] Test for " Christian Ludwig
2026-08-17 11:59 ` [PATCH pve-storage 3/13] Allow efi-firmware in file-based storage Christian Ludwig
2026-08-17 11:59 ` [PATCH pve-storage 4/13] Extend storage API endpoints for efi-firmware Christian Ludwig
2026-08-17 11:59 ` [PATCH pve-storage 5/13] Volume access check test " Christian Ludwig
2026-08-17 11:59 ` [PATCH pve-storage 6/13] efi-firmware storage path to volume conversion test Christian Ludwig
2026-08-17 11:59 ` Christian Ludwig [this message]
2026-08-17 11:59 ` [PATCH qemu-server 08/13] Add efi-firmware support to the API Christian Ludwig
2026-08-17 11:59 ` [PATCH qemu-server 09/13] Generate efi-firmware Qemu command line Christian Ludwig
2026-08-17 11:59 ` [PATCH qemu-server 10/13] test: efi-firmware key in VM config Christian Ludwig
2026-08-17 11:59 ` [PATCH qemu-server 11/13] test: efi-firmware volumes replication Christian Ludwig
2026-08-17 11:59 ` [PATCH pve-docs 12/13] pvesm: Document efi-firmware content type Christian Ludwig
2026-08-17 11:59 ` [PATCH pve-docs 13/13] qm: Document 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=aoL3ocEhTfJobX33@pc43.vpn.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.