From nobody Sun Apr 5 16:33:04 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1774347489; cv=none; d=zohomail.com; s=zohoarc; b=GkzOB0jIPow1BUiAsNIEKPPIGZhSJGkVb3Kakk8vT6gulCCzRE4VmnyoN4DPPsy3GcRIlI7AkwOEhSOvwdN29Be5l0U9MJUS3ZDqw2/rUf58aT9CXwt3OeAZim4skh88HCX9tVbOgcmOlvxhWsaSFnIG4Wc+AMSND6x1cEJvXB4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1774347489; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=6/EFfTLPPvtpKfYbDxMVwQU9jDgu7ScMy19tpR6gQjI=; b=awOF22Rlcp1TgiVvykFRKCtjzoY/WijkS2sY3qfs1M+8rJzONDbXN5/KB3VHd9V4f3Uvh0LWkQWofznP1o93FzCG1ZBiASh/AaAOW9QuNnL6oxdjdymtHblBGFHqekzR9+RtAnRGhzX5InbPso8BqUTaNQlaMoYg/9X5Kyqpw8I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1774347489915437.876080482461; Tue, 24 Mar 2026 03:18:09 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1260279.1553656 (Exim 4.92) (envelope-from ) id 1w4ypa-0005xz-P5; Tue, 24 Mar 2026 10:17:50 +0000 Received: by outflank-mailman (output) from mailman id 1260279.1553656; Tue, 24 Mar 2026 10:17:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w4ypa-0005xo-Jl; Tue, 24 Mar 2026 10:17:50 +0000 Received: by outflank-mailman (input) for mailman id 1260279; Tue, 24 Mar 2026 10:17:49 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w4ypZ-0005vq-Da for xen-devel@lists.xenproject.org; Tue, 24 Mar 2026 10:17:49 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1w4ypY-000XdF-Pa for xen-devel@lists.xenproject.org; Tue, 24 Mar 2026 11:17:48 +0100 Received: from [10.42.69.2] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 69c264bf-e002-0a2a0a5209dd-0a2a4502d2e4-36 for ; Tue, 24 Mar 2026 11:17:48 +0100 Received: from [209.85.216.65] (helo=mail-pj1-f65.google.com) by tlsNG-720697.mxtls.expurgate.net with ESMTPS (eXpurgate 4.55.2) (envelope-from ) id 69c264cb-63bb-0a2a45020019-d155d841b872-3 for ; Tue, 24 Mar 2026 11:17:48 +0100 Received: by mail-pj1-f65.google.com with SMTP id 98e67ed59e1d1-356337f058aso2947602a91.2 for ; Tue, 24 Mar 2026 03:17:48 -0700 (PDT) Received: from fedora ([103.2.232.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-35c031412f2sm1939382a91.7.2026.03.24.03.17.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2026 03:17:45 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=20251104 header.d=gmail.com header.i="@gmail.com" header.h="Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774347466; x=1774952266; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6/EFfTLPPvtpKfYbDxMVwQU9jDgu7ScMy19tpR6gQjI=; b=Q5oW//VJ43BNtn9crNw8gtsQ2S3M9YvHWAVYYYvaoKhXnwX80dGlZeisgCfadyqHfQ cIcvTI8b6L7DEP3Hprn/3lH1uO4qXAhs34+21CDJt8VqNwH6o2ZqBQpip5i4RbfFUsJa 4I77k9P3bzXMt29r0lLJ0xHn6U8T4PdMLu3MoZedN9rCSwJAMVP1V53LO7ExDkhlmEDz XeImNgXooMHqlbEh4eAzGACJsO5BZANiY2lJ4v0hNSRjyypZVlMtsWaTtAjsvlIr/0sC 8p6vYRRmpHFgQfsOf6+aRIRsleGEnoVIFbamejIRn6utsgYaY4YbjWRukfFF2OPn5wxa 7FvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774347466; x=1774952266; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=6/EFfTLPPvtpKfYbDxMVwQU9jDgu7ScMy19tpR6gQjI=; b=sfJpZSeVsMC3AI/vhrjHdtBUDTLupFJuskUpr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359:83d3:27d3 with SMTP id 98e67ed59e1d1-35bd2b937f5mr12836202a91.2.1774347466254; Tue, 24 Mar 2026 03:17:46 -0700 (PDT) From: Soumyajyotii Ssarkar To: xen-devel@lists.xenproject.org, sarkarsoumyajyoti23@gmail.com Cc: =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Andrew Cooper , Jan Beulich , "Daniel P . Smith" , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Soumyajyotii Ssarkar Subject: [PATCH v4 3/3] x86/efi: Add opt-out mechanism for BGRT preservation Date: Tue, 24 Mar 2026 15:47:26 +0530 Message-ID: <20260324101726.6929-4-soumyajyotisarkar23@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260324101726.6929-1-soumyajyotisarkar23@gmail.com> References: <20260324101726.6929-1-soumyajyotisarkar23@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-720697/1774347468-42099DB8-074385BD/0/0 X-purgate-type: clean X-purgate-size: 3800 X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1774347490572154100 Content-Type: text/plain; charset="utf-8" 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=3Dno-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=3Dno-bgrt' to Xen command line Signed-off-by: Soumyajyotii Ssarkar --- 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=3Dno-bgrt") ) + opt_bgrt_disabled =3D true; + efi_arch_edd(); efi_arch_cpu(); diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index e22a42c15b..a4db7ee516 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 =3D 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 =3D false; + if ( opt_bgrt_disabled ) + return; + bgrt =3D efi_get_bgrt(); if ( !bgrt ) { @@ -1582,6 +1586,8 @@ void EFIAPI __init noreturn efi_start(EFI_HANDLE Imag= eHandle, base_video =3D true; else if ( wstrcmp(ptr + 1, L"mapbs") =3D=3D 0 ) map_bs =3D true; + else if ( wstrcmp(ptr + 1, L"nobgrt") =3D=3D 0 ) + opt_bgrt_disabled =3D true; else if ( wstrncmp(ptr + 1, L"cfg=3D", 4) =3D=3D 0 ) cfg_file_name =3D ptr + 5; else if ( i + 1 < argc && wstrcmp(ptr + 1, L"cfg") =3D=3D = 0 ) @@ -1592,6 +1598,7 @@ void EFIAPI __init noreturn efi_start(EFI_HANDLE Imag= eHandle, 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=3D 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