BGRT preservation is now enabled by default to fix ACPI corruption
for desktop/workstation systems (similar to ESRT).
As described in the task:
https://github.com/QubesOS/qubes-issues/issues/10764
Add an opt-out parameter to allow disabling BGRT preservation on
systems where the ~1MB memory overhead is not desired.
The opt-out is implemented through two boot paths with early parsing
during the EFI boot phase before preservation runs:
1. xen.efi direct boot: '-nobgrt' command line option (parsed in
efi_start())
2. Multiboot2 (GRUB): 'efi=no-bgrt' peeked from mb2 cmdline tag
using get_option() in efi_multiboot2()
The flag is checked at the start of efi_preserve_bgrt_img() to
skip preservation entirely when disabled. Status logging indicates
whether preservation was disabled, succeeded, or failed.
Usage:
Default: BGRT preserved automatically
xen.efi: Add '-nobgrt' option
GRUB/MB2: Add 'efi=no-bgrt' to Xen command line
Signed-off-by: Soumyajyotii Ssarkar <soumyajyotisarkar23@gmail.com>
---
xen/arch/x86/efi/efi-boot.h | 3 +++
xen/common/efi/boot.c | 11 ++++++++++-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h
index 0547d845cd..6c986cf6c0 100644
--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -897,6 +897,9 @@ void __init efi_multiboot2(EFI_HANDLE ImageHandle,
efi_arch_edid(gop_handle);
}
+ if ( cmdline && get_option(cmdline, "efi=no-bgrt") )
+ opt_bgrt_disabled = true;
+
efi_arch_edd();
efi_arch_cpu();
diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index 68e06d707c..dc46e783f3 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -170,6 +170,7 @@ static SIMPLE_TEXT_OUTPUT_INTERFACE *__initdata StdErr;
static UINT32 __initdata mdesc_ver;
static bool __initdata map_bs;
+static bool __initdata opt_bgrt_disabled = false;
static struct file __initdata cfg;
static struct file __initdata kernel;
@@ -825,6 +826,9 @@ static void __init efi_preserve_bgrt_img(void)
bgrt_info.preserved = false;
+ if ( opt_bgrt_disabled )
+ return;
+
bgrt = efi_get_bgrt();
if ( !bgrt )
{
@@ -1582,6 +1586,8 @@ void EFIAPI __init noreturn efi_start(EFI_HANDLE ImageHandle,
base_video = true;
else if ( wstrcmp(ptr + 1, L"mapbs") == 0 )
map_bs = true;
+ else if ( wstrcmp(ptr + 1, L"nobgrt") == 0 )
+ opt_bgrt_disabled = true;
else if ( wstrncmp(ptr + 1, L"cfg=", 4) == 0 )
cfg_file_name = ptr + 5;
else if ( i + 1 < argc && wstrcmp(ptr + 1, L"cfg") == 0 )
@@ -1592,6 +1598,7 @@ void EFIAPI __init noreturn efi_start(EFI_HANDLE ImageHandle,
PrintStr(L"Xen EFI Loader options:\r\n");
PrintStr(L"-basevideo retain current video mode\r\n");
PrintStr(L"-mapbs map EfiBootServices{Code,Data}\r\n");
+ PrintStr(L"-nobgrt disable BGRT preservation\r\n");
PrintStr(L"-cfg=<file> specify configuration file\r\n");
PrintStr(L"-help, -? display this help\r\n");
blexit(NULL);
@@ -1916,7 +1923,9 @@ void __init efi_bgrt_status_info(void)
if ( !efi_enabled(EFI_BOOT) )
return;
- if ( bgrt_info.preserved )
+ if ( opt_bgrt_disabled )
+ printk(XENLOG_INFO "EFI: BGRT preservation disabled\n");
+ else if ( bgrt_info.preserved )
{
printk(XENLOG_INFO "EFI: BGRT image preserved: %lu KB\n",
bgrt_info.size / 1024);
--
2.53.0
© 2016 - 2026 Red Hat, Inc.