From nobody Sun Apr 5 16:33:02 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=1774355628; cv=none; d=zohomail.com; s=zohoarc; b=JamtDUl3AEXYkYPXqRknhgKwp60BTcXt2XHyx3jVeS7wviY8bmBXHrm/GQJUHW25szItsTIpMFehkgzoNuoPPCZDcXFng7DElhxtyLwI7MOnyCczvidVTaX7IhbCd1/rbWcSrwqkzmi4D0kgQgpy9WrK9I6U9SLuoCAb++cNOhU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1774355628; 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=SrzymXwHbUXEe2dOu5PysMxh5MkIpUIF3E7gng7syn4oaHb+mfkSa4JRGn+mBkA20ZeEmSwtqf5QFNMiT0lwcgwF7m2ue3rz7lXaEECtO3zq1D8HjXhI9OywjrrFRi0r55ItbioQrAegrfr0qgnRzpBF5JjJvN2iZRE5IdvKQXQ= 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 1774355628321228.0143469743715; Tue, 24 Mar 2026 05:33:48 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1260639.1553913 (Exim 4.92) (envelope-from ) id 1w50x0-0005gd-Rs; Tue, 24 Mar 2026 12:33:38 +0000 Received: by outflank-mailman (output) from mailman id 1260639.1553913; Tue, 24 Mar 2026 12:33:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w50x0-0005gS-OO; Tue, 24 Mar 2026 12:33:38 +0000 Received: by outflank-mailman (input) for mailman id 1260639; Tue, 24 Mar 2026 12:33:37 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w50wy-0005dz-UH for xen-devel@lists.xenproject.org; Tue, 24 Mar 2026 12:33:37 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1w50wy-006OfX-A7 for xen-devel@lists.xenproject.org; Tue, 24 Mar 2026 13:33:36 +0100 Received: from [10.42.69.5] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 69c2849b-bab6-0a2a0a5309dd-0a2a4505ea44-40 for ; Tue, 24 Mar 2026 13:33:36 +0100 Received: from [209.85.216.66] (helo=mail-pj1-f66.google.com) by tlsNG-c201ff.mxtls.expurgate.net with ESMTPS (eXpurgate 4.55.2) (envelope-from ) id 69c2849e-5aeb-0a2a45050019-d155d842a439-3 for ; Tue, 24 Mar 2026 13:33:36 +0100 Received: by mail-pj1-f66.google.com with SMTP id 98e67ed59e1d1-35a1d4a095bso3177885a91.0 for ; Tue, 24 Mar 2026 05:33:35 -0700 (PDT) Received: from fedora ([103.2.232.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-35c031ed04esm2215792a91.12.2026.03.24.05.33.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2026 05:33:33 -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=1774355614; x=1774960414; 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=gMIWUa7uwCC9TMeUOldNRKNCQ5mmAtOCr51KtRqFcKQPgOEaOwQWMir2feHE6bYBiX iOyppAN9vlFmomvhbjsG+qrsEOcWdaeuGqN+b1ItkHY/8zJvuJqKM1lnUN+8accZPnB1 21NRjtOOhCbA2KWwWSZKJX6pbRE5UvUhizfrQalnrFGIRU84LIV1STugqgIPqwqMo9cR DQANL1/iTIq5+2B+Ya9XosR03KdnJpAjvWLEpUiRF+NZJInRM5jHN+I1OfoSYIkWUpXS Fe+wc4ctNUeFu06V36xn1YYdbeUwFw0AMu8VuTgPikn8re+eYY9beJBHCuPinclJAcw8 BkEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774355614; x=1774960414; 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=Ev9D62IsymfQteD1zN1QMsOEBUwlezEpC4J6dhcYCQAmUXJ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ZouVao Au6KbZl4hWFGXBTDr/JRBVdI7BYc5Q/Z7vOU364UkjPMrMcsqBDQ37WNMiQJxDXKjvkayRaKQ== X-Received: by 2002:a17:90b:1e44:b0:34a:be93:72ee with SMTP id 98e67ed59e1d1-35c0083302cmr2487364a91.8.1774355613938; Tue, 24 Mar 2026 05:33:33 -0700 (PDT) From: Soumyajyotii Ssarkar To: sarkarsoumyajyoti23@gmail.com, xen-devel@lists.xenproject.org Cc: Andrew Cooper , Jan Beulich , "Daniel P . Smith" , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Soumyajyotii Ssarkar Subject: [PATCH v5 3/3] x86/efi: Add opt-out mechanism for BGRT preservation Date: Tue, 24 Mar 2026 18:03:12 +0530 Message-ID: <20260324123312.11076-4-soumyajyotisarkar23@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260324123312.11076-1-soumyajyotisarkar23@gmail.com> References: <20260324123312.11076-1-soumyajyotisarkar23@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-c201ff/1774355616-82759488-AE5003A6/0/0 X-purgate-type: clean X-purgate-size: 3800 X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1774355628720158500 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