As described in the task, BGRT preservation is now enabled by default to fix ACPI corruption
for desktop/workstation systems (similar to ESRT).
Add an opt-out parameter 'efi=no-bgrt' to allow disabling BGRT
preservation on systems where the ~1MB memory overhead is not
desired.
The parameter is parsed during normal Xen boot (not during EFI
phase), so it only affects diagnostic logging. The opt-out flag
is checked at the start of efi_preserve_bgrt_img().
Usage:
Default: BGRT preserved automatically
Opt-out: Add 'efi=no-bgrt' to Xen command line
Signed-off-by: Soumyajyotii Ssarkar <soumyajyotisarkar23@gmail.com>
---
xen/common/efi/boot.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index 1e3489e902..b735eac6b2 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -167,6 +167,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;
@@ -868,6 +869,9 @@ static void __init efi_preserve_bgrt_img(EFI_SYSTEM_TABLE *SystemTable)
bgrt_debug_info.preserved = false;
bgrt_debug_info.failure_reason = NULL;
+ if ( opt_bgrt_disabled )
+ return;
+
bgrt = find_bgrt_table(SystemTable);
if ( !bgrt )
{
@@ -1873,6 +1877,10 @@ static int __init cf_check parse_efi_param(const char *s)
else
__clear_bit(EFI_RS, &efi_flags);
}
+ else if ( (ss - s) == 7 && !memcmp(s, "no-bgrt", 7) )
+ {
+ opt_bgrt_disabled = true;
+ }
else if ( (ss - s) > 5 && !memcmp(s, "attr=", 5) )
{
if ( !cmdline_strcmp(s + 5, "uc") )
@@ -1968,7 +1976,11 @@ void __init efi_init_memory(void)
if ( !efi_enabled(EFI_BOOT) )
return;
- if ( bgrt_debug_info.preserved )
+ if ( opt_bgrt_disabled )
+ {
+ printk(XENLOG_INFO "EFI: BGRT preservation disabled\n");
+ }
+ else if ( bgrt_debug_info.preserved )
{
printk(XENLOG_INFO "EFI: BGRT image preserved: %u KB\n",
bgrt_debug_info.size / 1024);
--
2.53.0
On 06.03.2026 14:29, Soumyajyotii Ssarkar wrote:
> As described in the task, BGRT preservation is now enabled by default to fix ACPI corruption
> for desktop/workstation systems (similar to ESRT).
What's "the task"?
> Add an opt-out parameter 'efi=no-bgrt' to allow disabling BGRT
> preservation on systems where the ~1MB memory overhead is not
> desired.
This looks to contradict ...
> The parameter is parsed during normal Xen boot (not during EFI
> phase), so it only affects diagnostic logging.
... this. For xen.efi you want to add code to the command line parsing
near the top of efi_start(). What to do for the MB2 boot path perhaps
the only thing there is to peek into the command line (see
arch/x86/boot/cmdline.c).
> @@ -1873,6 +1877,10 @@ static int __init cf_check parse_efi_param(const char *s)
> else
> __clear_bit(EFI_RS, &efi_flags);
> }
> + else if ( (ss - s) == 7 && !memcmp(s, "no-bgrt", 7) )
No "no-" prefixes please; you want to use parse_boolean().
> @@ -1968,7 +1976,11 @@ void __init efi_init_memory(void)
> if ( !efi_enabled(EFI_BOOT) )
> return;
>
> - if ( bgrt_debug_info.preserved )
> + if ( opt_bgrt_disabled )
> + {
> + printk(XENLOG_INFO "EFI: BGRT preservation disabled\n");
> + }
No need for figure braces here.
Jan
On Tue, Mar 10, 2026 at 12:41:40PM +0100, Jan Beulich wrote: > On 06.03.2026 14:29, Soumyajyotii Ssarkar wrote: > > As described in the task, BGRT preservation is now enabled by default to fix ACPI corruption > > for desktop/workstation systems (similar to ESRT). > > What's "the task"? I asked him to work on this, but I don't think there is a gitlab issue created, so reference to "the task" is not relevant here. > > Add an opt-out parameter 'efi=no-bgrt' to allow disabling BGRT > > preservation on systems where the ~1MB memory overhead is not > > desired. > > This looks to contradict ... > > > The parameter is parsed during normal Xen boot (not during EFI > > phase), so it only affects diagnostic logging. > > ... this. For xen.efi you want to add code to the command line parsing > near the top of efi_start(). What to do for the MB2 boot path perhaps > the only thing there is to peek into the command line (see > arch/x86/boot/cmdline.c). See also my response on v1 - for MB2 path, look at efi_multiboot2(). -- Best Regards, Marek Marczykowski-Górecki Invisible Things Lab
© 2016 - 2026 Red Hat, Inc.