From nobody Sun Apr 5 13:12:31 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=1774346977; cv=none; d=zohomail.com; s=zohoarc; b=Hcl7Ji9t4vDK+w53BfavgH5cJ1UHfI86ssqtlkQnOIE0OBhR3cJrsp5N5dX0yJLODfH2q//V2c7Acbt+CV1tY5hqsc5EWmEt5gj7rRn1HS4WEv7rWCwNUQxJULOYQgRnD3SAqqyLcnn/c3QCM7iprQOiylOXN+hMQcGRYsefKfo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1774346977; 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=XGPFnQj+ZfxS749Q3Ej0R3DfJ8ti7lsuy4AI2HhbQr5jXlAhk+oASHX5yQSxhPavG4+lLd7HV+QercDimDLm4YFHjZqsc0TC8VpcpG5qT9Qp9jJf6IaNP/6FiIH+MsV5H/u+YN65q8WGVfFhOhUKcKHqijUJ8AMLPoURh/paCsE= 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 177434697767558.00880317978135; Tue, 24 Mar 2026 03:09:37 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1260233.1553611 (Exim 4.92) (envelope-from ) id 1w4yhO-00028D-TQ; Tue, 24 Mar 2026 10:09:22 +0000 Received: by outflank-mailman (output) from mailman id 1260233.1553611; Tue, 24 Mar 2026 10:09:22 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w4yhO-00027y-PI; Tue, 24 Mar 2026 10:09:22 +0000 Received: by outflank-mailman (input) for mailman id 1260233; Tue, 24 Mar 2026 10:09:21 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w4yhN-00026j-QF for xen-devel@lists.xenproject.org; Tue, 24 Mar 2026 10:09:21 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1w4yhN-00DoZ0-5o for xen-devel@lists.xenproject.org; Tue, 24 Mar 2026 11:09:21 +0100 Received: from [10.42.69.1] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 69c262cc-5cb7-0a2a0a5109dd-0a2a4501c010-38 for ; Tue, 24 Mar 2026 11:09:21 +0100 Received: from [209.85.215.195] (helo=mail-pg1-f195.google.com) by tlsNG-d62444.mxtls.expurgate.net with ESMTPS (eXpurgate 4.55.2) (envelope-from ) id 69c262cf-6400-0a2a45010019-d155d7c3b9bd-3 for ; Tue, 24 Mar 2026 11:09:20 +0100 Received: by mail-pg1-f195.google.com with SMTP id 41be03b00d2f7-b6ce6d1d3dcso1718830a12.3 for ; Tue, 24 Mar 2026 03:09:20 -0700 (PDT) Received: from fedora ([103.2.232.250]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c74665ca206sm11377434a12.18.2026.03.24.03.09.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2026 03:09:18 -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=1774346958; x=1774951758; 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=iO+M95tGN3SrZhIKEBrDAqOk/orMML6o2EbcUwCf/L1IM34n6/fZWyf5ow4qI+4QNa ZFCBdM0aSHOKHX/FxfnQ2uEHkdBoaelXzCqT8oT0gbq6bjvLV+JF+1dgGnXkVfNHshND O97Lj6vvvG0jH+9e+vVAspUyQs58xolJ2Jef6DmjnhtGO2M1XhCRhf2tWJD9GMRYEbj3 qFLDmtBvKQgsf0Mh0j+CYnHsZZIPTxC/Z3kkr75TqXQnTMOGwsXNOj+2HtMmagEC9Uw/ RXDRh2/guUl2liKb2ypyGe0spXpgIqCG8hG8NGcfSmHK2tTkAQW8AYjyIAcBYWzB7kqN +B6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774346958; x=1774951758; 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=sjTXw13tI9AVwLnexsBk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 2002:a05:6a20:431c:b0:398:9ae9:710f with SMTP id adf61e73a8af0-39bce9b4fecmr13718713637.13.1774346958490; Tue, 24 Mar 2026 03:09:18 -0700 (PDT) From: Soumyajyotii Ssarkar To: xen-devel@lists.xenproject.org, sarkarsoumyajyoti23@gmail.com Cc: "Daniel P . Smith" , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Andrew Cooper , Jan Beulich , =?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:38:56 +0530 Message-ID: <20260324100856.6691-4-soumyajyotisarkar23@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260324100856.6691-1-soumyajyotisarkar23@gmail.com> References: <20260324100856.6691-1-soumyajyotisarkar23@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-d62444/1774346961-204F7DF3-C8C0A6EB/0/0 X-purgate-type: clean X-purgate-size: 3800 X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1774346981764154100 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