From nobody Mon Apr 13 02:10:52 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=1772738337; cv=none; d=zohomail.com; s=zohoarc; b=gzdTNZkQLfr8vCbzQQUO8se2GI4lq1hjrX4DcFUT8RvAM2Musenxkso1qsPGaPfhevHKt6c3cNbnRqIdpw80QPHek52gO8Ms1xcS5eDiFkqKMOCba4SgBIdMo2O831U5+Tem7yRrO9JHPX05hGsQp6rknu0Qgvd30V2zOWMWZ0Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772738337; 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=OwGP8ee4LidY7BRMCtYUVmJPzJVamR1lF04CTiEUcS8=; b=Ba7y45FJQHVBo+hb7MlK5IBpmU8TRDGH+KAV/aRSUxeSFyT0iVPRSMtSVcGunk56RtRUC5k08Pm1pYTdF6Wd7LoyjbSTpV+5QGC46nirNK4318pIqzXZSj3fd8w1Z4qLH2yjgor012RbG1WP6/b2nPXvA4WPQLp5++koIv6MQlY= 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 1772738337297440.5782180572638; Thu, 5 Mar 2026 11:18:57 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1247047.1545941 (Exim 4.92) (envelope-from ) id 1vyEDJ-00049O-LQ; Thu, 05 Mar 2026 19:18:25 +0000 Received: by outflank-mailman (output) from mailman id 1247047.1545941; Thu, 05 Mar 2026 19:18:25 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vyEDJ-00049H-Ic; Thu, 05 Mar 2026 19:18:25 +0000 Received: by outflank-mailman (input) for mailman id 1247047; Thu, 05 Mar 2026 19:18:24 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vyEDI-00048o-Ks for xen-devel@lists.xenproject.org; Thu, 05 Mar 2026 19:18:24 +0000 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [2607:f8b0:4864:20::641]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 13a29844-18c8-11f1-b164-2bf370ae4941; Thu, 05 Mar 2026 20:18:23 +0100 (CET) Received: by mail-pl1-x641.google.com with SMTP id d9443c01a7336-2addb31945aso61081585ad.1 for ; Thu, 05 Mar 2026 11:18:23 -0800 (PST) Received: from fedora ([103.2.232.250]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2ae4d3113e0sm142965715ad.79.2026.03.05.11.18.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2026 11:18:21 -0800 (PST) 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" X-Inumbo-ID: 13a29844-18c8-11f1-b164-2bf370ae4941 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772738301; x=1773343101; 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=OwGP8ee4LidY7BRMCtYUVmJPzJVamR1lF04CTiEUcS8=; b=mVj/HPLH59ySa0qeybCGo8aweuZ9xWgK7HiIqoTHs93KCxnD/2VkGlS8lvHcxLk7Jq MvAim8d3kAKxrDDEM8oS703uzFhNrO3S6zJ+hYENZJTMvtHUm6yrbiBcKJ7ybzTrl+rf fDtkaAiNJMrtxtQzRMI0YQ9VhSgKQ6UZE8uGlzumoYjiQX1SXeeRcM3IjrA1nc8sTkB7 P6NZMbEPQTNG+6BbysgdfyhS2NEltH1KSGL2EhWQRaX6VU+nLRQsJgyUibDNWDKpZm12 O7FrexFPwr2vAaseBoHsQsn0NDyIpHa+qJSUmOH742te63LIa93+X71cPKLkg2Z5oQ++ BAsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772738301; x=1773343101; 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=OwGP8ee4LidY7BRMCtYUVmJPzJVamR1lF04CTiEUcS8=; b=K6FSGe94V8qADGoMhrOFMAKHRZEN9qwjqwgpisG1vNRQIgDFiODRCRbIZXTAE73ghr vqxN3XsJAqCj5NfBL2Zxky1c2uFMwHAimMFwQBnjd66BQG/rPqOznd7Zau96/gGJ0Gjf qdb3qVRRTOfCXu//LPZq8zsitV6OXGOGmu94qQa3bUH8lif3s4MQ0NufWxKXjI3ysrnY QPYPQccvy6r/fSjgE2ejBIl12FwgDZmeSQKsuSy5mj8VyRYs4uafBaUEY1pZNVAbTSaT ofeEVnnwyBgZ1Z2gyuoeqdjpu/CyBtIesslQS/WFLC4ddgtoQTNrPUeByCrM4i2T8tSg 0rTw== X-Gm-Message-State: AOJu0Yz3VEP/emR705QWaDHelpsjbbDwYlm97xYud3HzC+I+0i7y4kDz ON1yXoW88rMy3FB0V8JITM9jK3EkRVshWBtuB0eHFliwqb+ttDlCBwaCH1Vn845y X-Gm-Gg: ATEYQzztpCTLf0LcoIHOLgJbCn3B+iJrStgzicq/A8wY6oq4xXHN00b1kST5hD0zOCf mZLh3x8nrar7Rn8Wd14+eRKrJPx8JMMm4hHFdG5PgjOGB3fCvCpcUrBMNJx9ydjdez0Y0n14AnF cMbXUNu1TV8Kv+WJ0dPfmgd9w6S/DSqmDZjPudw/klt2F+zvab/Yoqt0ABhMG9TUZr/dY1GtKeG jKNF2LrXHtrOCoD/9d4SSjPviwM+rQIayMgXVKUIQgvPJybu7hSU/oi5OPbCRRYCUBm+Qs/BBXx MlT+oK04aF1YDbcq5KmzrkqJY8gxssbE0hWfu2Gk3nTrpouBocgBznxZH30KPNuE1iyu1zQo0Lv vN+QOIE47+W4wRJj87h7K51UuVul7UUmeon2gg0UqcLppbbQAULYGNe+Nhkr16Inz14UfGQljVp 3S8DJhVzJtvfG5+CkGlTnwRs4PF7z7u6h6q/qci/IrVEGbgCxRBksS7FzmR1QuHzhy6L9w+vvLs HL7DactnZfDDbOgk38lzFAAt/LHmb3ioZzm8NDjTa8MJ8a678grpX0zUlJi+c1C1NCX9wTHMw== X-Received: by 2002:a17:903:2445:b0:2ae:588a:f3e5 with SMTP id d9443c01a7336-2ae6aaae636mr70140825ad.30.1772738301473; Thu, 05 Mar 2026 11:18:21 -0800 (PST) From: Soumyajyotii Ssarkar To: xen-devel@lists.xenproject.org, sarkarsoumyajyoti23@gmail.com Cc: Jan Beulich , "Daniel P . Smith" , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Andrew Cooper , Soumyajyotii Ssarkar Subject: [PATCH 1/3] x86/efi: Add BGRT image preservation during boot Date: Fri, 6 Mar 2026 00:48:08 +0530 Message-ID: <20260305191810.31033-2-soumyajyotisarkar23@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260305191810.31033-1-soumyajyotisarkar23@gmail.com> References: <20260305191810.31033-1-soumyajyotisarkar23@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1772738339362158500 Content-Type: text/plain; charset="utf-8" The ACPI BGRT (Boot Graphics Resource Table) contains a pointer to a boot logo image stored in BootServicesData memory. When Xen reclaims this memory during boot, the image is lost and the BGRT table becomes invalid, causing Linux dom0 to report ACPI checksum errors. Add preservation logic similar to ESRT table handling: - Locate BGRT table via XSDT during EFI boot services phase - Validate BMP image signature and size (max 16 MB) - Copy image to EfiACPIReclaimMemory (safe from reclamation) - Update BGRT table with new image address - Recalculate ACPI table checksum The preservation runs automatically during efi_exit_boot() before Boot Services are terminated. This ensures the image remains accessible to dom0. Open coded ACPI parsing is used because Xen's ACPI subsystem is not available during the EFI boot phase. The RSDP is obtained from the EFI System Table, and the XSDT is walked manually to find BGRT. Signed-off-by: Soumyajyotii Ssarkar --- xen/arch/x86/efi/efi-boot.h | 2 + xen/common/efi/boot.c | 187 ++++++++++++++++++++++++++++++++++++ 2 files changed, 189 insertions(+) diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h index 42a2c46b5e..27792a56ff 100644 --- a/xen/arch/x86/efi/efi-boot.h +++ b/xen/arch/x86/efi/efi-boot.h @@ -910,6 +910,8 @@ void __init efi_multiboot2(EFI_HANDLE ImageHandle, efi_relocate_esrt(SystemTable); + efi_preserve_bgrt_img(SystemTable); + efi_exit_boot(ImageHandle, SystemTable); } diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index 967094994d..1e3489e902 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -173,6 +174,14 @@ static struct file __initdata ramdisk; static struct file __initdata xsm; static const CHAR16 __initconst newline[] =3D L"\r\n"; +static __initdata struct { + bool preserved; + uint64_t old_addr; + uint64_t new_addr; + uint32_t size; + const char *failure_reason; +} bgrt_debug_info; + static void __init PrintStr(const CHAR16 *s) { StdOut->OutputString(StdOut, (CHAR16 *)s ); @@ -747,6 +756,171 @@ static void __init efi_relocate_esrt(EFI_SYSTEM_TABLE= *SystemTable) efi_bs->FreePool(memory_map); } +struct bmp_header { + uint16_t signature; + uint32_t file_size; + uint16_t reserved_1; + uint16_t reserved_2; + uint32_t data_offset; +} __attribute__((packed)); + +/* + * ACPI Structures - defined locally, + * since we cannot include acpi headers + * in EFI Context. + */ + +struct acpi_rsdp { + char signature[8]; + uint8_t checksum; + char oem_id[6]; + uint8_t revision; + uint32_t rsdt_physical_address; + uint32_t length; + uint64_t xsdt_physical_address; + uint8_t extended_checksum; + uint8_t reserved[3]; +} __attribute__((packed)); + +struct acpi_table_header { + char signature[4]; + uint32_t length; + uint8_t revision; + uint8_t checksum; + char oem_id[6]; + char oem_table_id[8]; + uint32_t oem_revision; + uint32_t asl_compiler_id; + uint32_t asl_compiler_revision; +} __attribute__((packed)); + +struct acpi_xsdt { + struct acpi_table_header header; + uint64_t table_offset_entry[1]; /* Variable array length */ +} __attribute__((packed)); + +struct acpi_bgrt { + struct acpi_table_header header; + uint16_t version; + uint8_t status; + uint8_t image_type; + uint64_t image_address; + uint32_t image_offset_x; + uint32_t image_offset_y; +} __attribute__((packed)); + +static struct acpi_bgrt* __init find_bgrt_table(EFI_SYSTEM_TABLE *SystemTa= ble) +{ + EFI_GUID acpi2_guid =3D ACPI_20_TABLE_GUID; + struct acpi_rsdp *rsdp =3D NULL; + struct acpi_xsdt *xsdt; + struct acpi_bgrt *bgrt; + uint32_t entry_count, actual_size; + unsigned int i; + + for ( i =3D 0; i < SystemTable->NumberOfTableEntries; i++ ) + { + if ( match_guid(&acpi2_guid, &SystemTable->ConfigurationTable[i].V= endorGuid) ) + { + rsdp =3D SystemTable->ConfigurationTable[i].VendorTable; + break; + } + } + + if ( !rsdp || !rsdp->xsdt_physical_address ) + return NULL; + + xsdt =3D (struct acpi_xsdt *)rsdp->xsdt_physical_address; + if ( !xsdt ) + return NULL; + + actual_size =3D (xsdt->header.length - sizeof(struct acpi_table_header= )); + entry_count =3D (actual_size / sizeof(uint64_t)); + + for ( i =3D 0; i < entry_count; i++ ) + { + struct acpi_table_header *header =3D (struct acpi_table_header *)x= sdt->table_offset_entry[i]; + + if ( header->signature[0] =3D=3D 'B' + && header->signature[1] =3D=3D 'G' + && header->signature[2] =3D=3D 'R' + && header->signature[3] =3D=3D 'T' ) + { + bgrt =3D (struct acpi_bgrt *)header; + return bgrt; + } + } + return NULL; +} + +#define MAX_IMAGE_SIZE (16 * 1024 * 1024) /* Sanity check: reject if b= igger */ + +static void __init efi_preserve_bgrt_img(EFI_SYSTEM_TABLE *SystemTable) +{ + struct acpi_bgrt *bgrt; + struct bmp_header *bmp; + void *old_image, *new_image; + uint32_t image_size; + EFI_STATUS status; + uint8_t checksum; + unsigned int i; + + bgrt_debug_info.preserved =3D false; + bgrt_debug_info.failure_reason =3D NULL; + + bgrt =3D find_bgrt_table(SystemTable); + if ( !bgrt ) + { + bgrt_debug_info.failure_reason =3D "BGRT table not found in XSDT"; + return; + } + + if ( !bgrt->image_address ) + { + bgrt_debug_info.failure_reason =3D "BGRT image_address is NULL"; + return; + } + + old_image =3D (void *)bgrt->image_address; + bmp =3D (struct bmp_header *)old_image; + + if ( bmp->signature !=3D 0x4D42 ) + { + bgrt_debug_info.failure_reason =3D "Invalid BMP signature"; + return; + } + + image_size =3D bmp->file_size; + if ( !image_size || image_size > MAX_IMAGE_SIZE ) + { + bgrt_debug_info.failure_reason =3D "Invalid image size"; + return; + } + + status =3D efi_bs->AllocatePool(EfiACPIReclaimMemory, image_size, &new= _image); + if ( status !=3D EFI_SUCCESS || !new_image ) + { + bgrt_debug_info.failure_reason =3D "Memory allocation failed"; + return; + } + + memcpy(new_image, old_image, image_size); + + bgrt->image_address =3D (uint64_t)new_image; + bgrt->status |=3D 0x01; + + bgrt->header.checksum =3D 0; + checksum =3D 0; + for ( i =3D 0; i < bgrt->header.length; i++ ) + checksum +=3D ((uint8_t *)bgrt)[i]; + bgrt->header.checksum =3D (uint8_t)(0 - checksum); + + bgrt_debug_info.preserved =3D true; + bgrt_debug_info.old_addr =3D (uint64_t)old_image; + bgrt_debug_info.new_addr =3D (uint64_t)new_image; + bgrt_debug_info.size =3D image_size; +} + /* * Include architecture specific implementation here, which references the * static globals defined above. @@ -1794,6 +1968,19 @@ void __init efi_init_memory(void) if ( !efi_enabled(EFI_BOOT) ) return; + if ( bgrt_debug_info.preserved ) + { + printk(XENLOG_INFO "EFI: BGRT image preserved: %u KB\n", + bgrt_debug_info.size / 1024); + printk(XENLOG_INFO "EFI: BGRT relocated from %#" PRIx64 " to %#" P= RIx64 "\n", + bgrt_debug_info.old_addr, bgrt_debug_info.new_addr); + } + else if ( bgrt_debug_info.failure_reason ) + { + printk(XENLOG_WARNING "EFI: BGRT preservation failed: %s\n", + bgrt_debug_info.failure_reason); + } + printk(XENLOG_DEBUG "EFI memory map:%s\n", map_bs ? " (mapping BootServices)" : ""); for ( i =3D 0; i < efi_memmap_size; i +=3D efi_mdesc_size ) -- 2.53.0 From nobody Mon Apr 13 02:10:52 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=1772738340; cv=none; d=zohomail.com; s=zohoarc; b=M2ykrI5Xk1Sxcru4Z/bFoX/Z650XRnyZ+St8kkyX+RqQpbbJDAayGYyqqJCs5YodVWzhDDpUQmxLRfo09bAtW5eLBxQhDF4Ybgqyjym/yNeYSg5AMHGr2jIdy0CTePE/J9QzliHytiloilP+tgu0bjzqOoouw1XJWvRyIZZtRLk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772738340; 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=R1/nQgfr9Bh0trNj7y8yRO+57dFcCvGHPGgpaYkXq6U=; b=cQlII1MMF3RbtWEX0PLph3/YaACihEFhFu/eprLGEA5SUcdlumrXlekngk9xciH5TjZ5yNSAWLODHAUpU8sX87MlnuukwDB6tlaqGn1xpagt4cf/QszfqSydaB/mU/6EBJrXlIq1ErhovXYpwXWMWBjlfkMck37qdLm2RETaUV4= 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 1772738340426887.6999475133556; Thu, 5 Mar 2026 11:19:00 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1247048.1545952 (Exim 4.92) (envelope-from ) id 1vyEDM-0004Nf-W8; Thu, 05 Mar 2026 19:18:28 +0000 Received: by outflank-mailman (output) from mailman id 1247048.1545952; Thu, 05 Mar 2026 19:18:28 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vyEDM-0004NW-Si; Thu, 05 Mar 2026 19:18:28 +0000 Received: by outflank-mailman (input) for mailman id 1247048; Thu, 05 Mar 2026 19:18:28 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vyEDM-00048o-5F for xen-devel@lists.xenproject.org; Thu, 05 Mar 2026 19:18:28 +0000 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [2607:f8b0:4864:20::644]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 160136eb-18c8-11f1-b164-2bf370ae4941; Thu, 05 Mar 2026 20:18:27 +0100 (CET) Received: by mail-pl1-x644.google.com with SMTP id d9443c01a7336-2ad617d5b80so55057095ad.1 for ; Thu, 05 Mar 2026 11:18:27 -0800 (PST) Received: from fedora ([103.2.232.250]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2ae4d3113e0sm142965715ad.79.2026.03.05.11.18.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2026 11:18:25 -0800 (PST) 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" X-Inumbo-ID: 160136eb-18c8-11f1-b164-2bf370ae4941 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772738305; x=1773343105; 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=R1/nQgfr9Bh0trNj7y8yRO+57dFcCvGHPGgpaYkXq6U=; b=HJdbkhe1wjVAeM7agCKt8K8Dyt6hz6N2q5WGlfh5ra09qoRDIW532Exl+npy6NlsSy PyYqlrN1XXbtGY0G/PsQMKsNbKU3ZyCftNP7o8+iCRBd6Sj//dvzBTjF5ChO3Xs36YVs J5nDmtiYpY2tE2tkoWtnOHEFnkAa+MGcA1HkpEKZOmrAeGEcXG+6FMwZVtQT3Z0I8lCt MTGQrDGYUx2CqTtY51aIhvjDORvabOfVk27ltHR9dikLVfPgeYTJhOtJ2oHuo7vRCTA5 VkF4nsSNJfv9OhWBwuYb3nSQls5U5CZAv6jEWH0HQeMhnUX85mLo3JzcpkXTAEpBOmaA TA4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772738305; x=1773343105; 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=R1/nQgfr9Bh0trNj7y8yRO+57dFcCvGHPGgpaYkXq6U=; b=fAnY12wsSfKh+enJ66gCkxL0nCvs3qZhJjFv0wGbZShv6eUQI+yJymCjmHjiXCycSe B0f71Zy3sIruTGlk8xeL6tk4o1O8u3/9HgLaqTk2xBw7HN037f6sHWQ6WToHlCiqCBDO FHiVQ2qKK3lDRS536sf19mB5GObptcdOhRgBIxFp15F3126Wz4KQw28ekyGkIREevHvT mkGRJBZUq6jeIqwRIxK5gexbq+n04kdXc+cy+KRTbhc9s5tMO/pCoT3g6ORhYjER7C5y QWwvONerZAJXWLv5CesD9JshsPW0cNOhhd1IQPuCa2qWX5IOR9+yJKcNSxhSSS2t/0BN W07Q== X-Gm-Message-State: AOJu0YwIGdFrpCGaPkOwAmHyOxIKtAtfS69U9yP/dzcubGCh6sby/3/0 nEMOe5tUbAdeePqD1vq2HETCZOIL0w5ibK2KTs2mCaRiYmPnOgHatAhEss5jFQ4/ X-Gm-Gg: ATEYQzwOXqemoK7gp5t3NNtiZCDxzl0UQxczI0HI/X+i57+MNUgqdDDliDJI47tN2zR yu/h4x59zpszsACObBP5IoNPidc/pnS2UfVLe+KVkimf4TDrsM/Sdxn0SZIC0/3BGGt8HkCploQ PWaXymf1d/9WtM58qg/T1iHwXv0p8dmC8ad0YXdgC4Ks8yzzQEpoT+qR0iW6zj4JQxCDEHbP0HH 9y64Ee5Y5FMDUA3Y2PJI4Ibgv6zb4kI2GGEkFxhCSI3q+sC1jU53Yl/cuVwmw8ZEXQNdSr6z6oD sCpcJPQVBqbTL0fOqsWKxYTFNc3NKgO7I6KYKgLWnsGgSKRgLAO3fULn/JX2CL3jUNY6RwIAiJi sEfrVEiuZnli/g7kIDVn5P1fD9Q0u55/RT0g1GIRAwBbk9tPlOBUnvww24eKcJ7h2oEnAEcsyI+ PxflHBJfp0FO9/SEyN3zx7GXmJiuuQor/3v7a8/Y/l6w9NgPWupzLaJbyRLkfhbRi814BqLQB3V 0C9JzMmygcnVGQ3fMBFJC9frphY+nUrBFxuNPICOlbLmCfbbEotqVdb/nDQRCVsuMj0qahddA== X-Received: by 2002:a17:903:2a86:b0:2ae:6887:5c13 with SMTP id d9443c01a7336-2ae6ab408dfmr64671365ad.48.1772738305562; Thu, 05 Mar 2026 11:18:25 -0800 (PST) From: Soumyajyotii Ssarkar To: xen-devel@lists.xenproject.org, sarkarsoumyajyoti23@gmail.com Cc: Jan Beulich , "Daniel P . Smith" , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Andrew Cooper , Soumyajyotii Ssarkar Subject: [PATCH 2/3] x86/acpi: Remove BGRT invalidation code Date: Fri, 6 Mar 2026 00:48:09 +0530 Message-ID: <20260305191810.31033-3-soumyajyotisarkar23@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260305191810.31033-1-soumyajyotisarkar23@gmail.com> References: <20260305191810.31033-1-soumyajyotisarkar23@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1772738341311158500 Content-Type: text/plain; charset="utf-8" Now that BGRT images are preserved during EFI boot (via EfiACPIReclaimMemory allocation), the invalidation code in acpi_parse_bgrt() is no longer needed. The BGRT table remains valid throughout boot. This removes the code that was marking BGRT invalid when the image memory was detected as unavailable, which was causing ACPI warnings in Linux dom0. Signed-off-by: Soumyajyotii Ssarkar --- xen/arch/x86/acpi/boot.c | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/xen/arch/x86/acpi/boot.c b/xen/arch/x86/acpi/boot.c index 1ca2360e00..fc88b559e6 100644 --- a/xen/arch/x86/acpi/boot.c +++ b/xen/arch/x86/acpi/boot.c @@ -327,27 +327,6 @@ static int __init cf_check acpi_parse_hpet(struct acpi= _table_header *table) return 0; } -static int __init cf_check acpi_invalidate_bgrt(struct acpi_table_header *= table) -{ - struct acpi_table_bgrt *bgrt_tbl =3D - container_of(table, struct acpi_table_bgrt, header); - - if (table->length < sizeof(*bgrt_tbl)) - return -1; - - if (bgrt_tbl->version =3D=3D 1 && bgrt_tbl->image_address - && !page_is_ram_type(PFN_DOWN(bgrt_tbl->image_address), - RAM_TYPE_CONVENTIONAL)) - return 0; - - printk(KERN_INFO PREFIX "BGRT: invalidating v%d image at %#"PRIx64"\n", - bgrt_tbl->version, bgrt_tbl->image_address); - bgrt_tbl->image_address =3D 0; - bgrt_tbl->status &=3D ~1; - - return 0; -} - #define acpi_fadt_copy_address(dst, src, len) do { \ if (fadt->header.revision >=3D FADT2_REVISION_ID && \ fadt->header.length >=3D ACPI_FADT_V2_SIZE) \ @@ -752,7 +731,5 @@ int __init acpi_boot_init(void) acpi_hest_init(); - acpi_table_parse(ACPI_SIG_BGRT, acpi_invalidate_bgrt); - return 0; } -- 2.53.0 From nobody Mon Apr 13 02:10:52 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=1772738330; cv=none; d=zohomail.com; s=zohoarc; b=mYlYs5zYg1WrDL3ulWxsXbsICSwht5vASbQIvI6YmYw47tCiEh8XttJE+mZ67TfA4sp8VSSAlTAzM9JAY3qIwTWDz8sDVLs3aE4NNQAFNRy6A+GgTL5S4+B5cyRwh4h4YvULJ2vKsrSygpKoLFUWx9epoC66wRkqVqcoTiNe0es= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772738330; 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=++GELJavQDbG9JYk0zJHLyDpXIOV9aBooWUi6D+W/MA=; b=EksVzh9Z5kjDA2ZJHFClH+vLhKLGPuu89L/YZE1KqdoLDHvlRWrraE/GmHg6mjojmYgscZK+SpQVKXo26hKISkloHB1rnl4rBZzYGskLy/ugfvK0RQADaNk/SwuPy5pI01vW63aWCW+GaRcSVEhTDwfBLt82nQOeGUITaNaNEcg= 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 1772738330416160.17119746451078; Thu, 5 Mar 2026 11:18:50 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1247049.1545962 (Exim 4.92) (envelope-from ) id 1vyEDR-0004eY-7M; Thu, 05 Mar 2026 19:18:33 +0000 Received: by outflank-mailman (output) from mailman id 1247049.1545962; Thu, 05 Mar 2026 19:18:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vyEDR-0004eK-3y; Thu, 05 Mar 2026 19:18:33 +0000 Received: by outflank-mailman (input) for mailman id 1247049; Thu, 05 Mar 2026 19:18:32 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vyEDQ-00048o-7N for xen-devel@lists.xenproject.org; Thu, 05 Mar 2026 19:18:32 +0000 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [2607:f8b0:4864:20::642]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 18753e3d-18c8-11f1-b164-2bf370ae4941; Thu, 05 Mar 2026 20:18:31 +0100 (CET) Received: by mail-pl1-x642.google.com with SMTP id d9443c01a7336-2ad21f437eeso59682495ad.0 for ; Thu, 05 Mar 2026 11:18:31 -0800 (PST) Received: from fedora ([103.2.232.250]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2ae4d3113e0sm142965715ad.79.2026.03.05.11.18.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2026 11:18:29 -0800 (PST) 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" X-Inumbo-ID: 18753e3d-18c8-11f1-b164-2bf370ae4941 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772738310; x=1773343110; 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=++GELJavQDbG9JYk0zJHLyDpXIOV9aBooWUi6D+W/MA=; b=ZywURYfyu9jtd0HY/U+AMVN1oYScCM8ieiP9SoBXhR3jUC8XZQqqrwbrZe48NQvahw meuprx9ZWNPE+nAD8CHiw2voqFWrs4PRd5sUIW8R+w2iuUsIF+F8+xEoQobzx+MMkkcb 5alIDhKYqfTZoDM/NRb1J6+VxGbAD4z8meHijbS8zJoWyTvvTJglF6taF2DUb5sytTon 5BsmMNm11Vh9sKgijWgdcvcCiSjB0F/BaxTvyjZm4sDyDnELAZhf+x4htYJSCDWyvKrI /zcbzpc6kBZfxu+5h7b1DKbVUWCYn1jTItSNSWXNWBdobc1+hbVAy7fvY+FStNBYrR+K apag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772738310; x=1773343110; 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=++GELJavQDbG9JYk0zJHLyDpXIOV9aBooWUi6D+W/MA=; b=hdl893RlzgGeMycWDwNGmRQPOAMYIE3T+V/WgHRhbvWZ2YOlRu4BAzwLm6DrNC1ym8 ff6SvrZDqc7yyh5Oe5IytA+Fo0L8u2ZmTfW/jQOvnv2FPw+sLxK5HXVvNGPNpRoKsPix do5ab84VQms3St+dfJlIvCojaJwgX5+sT20yGOHB+6QYlzwqOkrz9PRoaeJRgsFVFpn1 WbfpVX4RIunRnF8is8m8yrCFSEE25FOyKo5Uodwm1ujVch+5lozBxM7jGYSrh6E9C71B mxraFRdtgnvJOqfY0BihQ97RzR1WIJWFKnDSTPjroAAhXUZbBQdX4RzOVBsZBEp4J7mB zwCQ== X-Gm-Message-State: AOJu0YwD86CtXyJlFlEoUI/tbz3CGuX9KyLFJzVKghdPcgdefqcI99hr ZMHiXADhHQbGnhyQyfXwKX7dlYrtFzHdnqZ+1qGEaDxfu677qT41RrUq0BL3k4TI X-Gm-Gg: ATEYQzzcZoXd9vNLL/CCU2MHf5XiF9YleQ2WGmnH8ek2DfrLC57yuKzMF+omyQo1fPw I6tr8TCUq3KIFpHI/oZIrCyyKWA7gbDJxy13VQhYCkUZso6628tc+XFkFFYO2VqSPkpV54v50W3 XIkB3SG7n9Ebvp+XBYRDj1eEnvraGkbRiS5HPgQkGJeWhCcDdTIJ0NbAWfi5z7gMkwM9nf+plJI iOBne8t0aLDRTZk/i3BRbGyC8TDC0UaQ5dfeO4TmVDeYC2M+QNfl0yS0KfvTB7qCQtKx+79BJvp TFC+Y+NPTA6UjZyHFe27JBjj9+VfTpAimMl25vfj4+oymUG5w7t9L8vpdbd6htzhN/BvMtazGgG eEbgjvcj8tKWcwtgh3AKumIJ0OMrhNvEI+MtWQU7662zaCWykfJLCUcYi73mrgSxWdTibUzqU4e uhVD4aG/u7LuErxW4QJZ0b1QsQ7kJHTlv/tmLGl/s0IC0221/ow8jbJmQPdxsXtBPobkdPll3eq aeVHbgSVNoXcgYW86t/WOnRlVPQuRicGd5PQZPLpCraS+Cq61L0Txi6brfo7YLq5AU3Q4sgkFXN sCcvQcun X-Received: by 2002:a17:903:1b6f:b0:2ae:7f15:7a4c with SMTP id d9443c01a7336-2ae7f157a85mr12680975ad.18.1772738309652; Thu, 05 Mar 2026 11:18:29 -0800 (PST) From: Soumyajyotii Ssarkar To: xen-devel@lists.xenproject.org, sarkarsoumyajyoti23@gmail.com Cc: Jan Beulich , "Daniel P . Smith" , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Andrew Cooper , Soumyajyotii Ssarkar Subject: [PATCH 3/3] x86/efi: Add opt-out mechanism for BGRT preservation Date: Fri, 6 Mar 2026 00:48:10 +0530 Message-ID: <20260305191810.31033-4-soumyajyotisarkar23@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260305191810.31033-1-soumyajyotisarkar23@gmail.com> References: <20260305191810.31033-1-soumyajyotisarkar23@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1772738331616158500 Content-Type: text/plain; charset="utf-8" As described in the task, BGRT preservation is now enabled by default to fi= x ACPI corruption for desktop/workstation systems (similar to ESRT). Add an opt-out parameter 'efi=3Dno-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=3Dno-bgrt' in Xen command line Signed-off-by: Soumyajyotii Ssarkar --- 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 =3D false; static struct file __initdata cfg; static struct file __initdata kernel; @@ -868,6 +869,9 @@ static void __init efi_preserve_bgrt_img(EFI_SYSTEM_TAB= LE *SystemTable) bgrt_debug_info.preserved =3D false; bgrt_debug_info.failure_reason =3D NULL; + if ( opt_bgrt_disabled ) + return; + bgrt =3D find_bgrt_table(SystemTable); if ( !bgrt ) { @@ -1873,6 +1877,10 @@ static int __init cf_check parse_efi_param(const cha= r *s) else __clear_bit(EFI_RS, &efi_flags); } + else if ( (ss - s) =3D=3D 7 && !memcmp(s, "no-bgrt", 7) ) + { + opt_bgrt_disabled =3D true; + } else if ( (ss - s) > 5 && !memcmp(s, "attr=3D", 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