From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 01DBFEB1054 for ; Tue, 10 Mar 2026 14:14:19 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.1250167.1547636 (Exim 4.92) (envelope-from ) id 1vzxqZ-0004ge-3f; Tue, 10 Mar 2026 14:14:07 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1250167.1547636; Tue, 10 Mar 2026 14:14:07 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vzxqZ-0004gX-0r; Tue, 10 Mar 2026 14:14:07 +0000 Received: by outflank-mailman (input) for mailman id 1250167; Tue, 10 Mar 2026 14:14:05 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vzxqX-0004gQ-BZ for xen-devel@lists.xenproject.org; Tue, 10 Mar 2026 14:14:05 +0000 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [2a00:1450:4864:20::42c]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 63e658c5-1c8b-11f1-9ccf-f158ae23cfc8; Tue, 10 Mar 2026 15:14:02 +0100 (CET) Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-439b6d9c981so6420600f8f.1 for ; Tue, 10 Mar 2026 07:14:02 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-439dada9116sm33731436f8f.14.2026.03.10.07.14.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 10 Mar 2026 07:14:01 -0700 (PDT) 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: 63e658c5-1c8b-11f1-9ccf-f158ae23cfc8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1773152042; x=1773756842; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=IvFj7BAAy+OPVIRcv54K79IILH7WSbxHWhjWNJQS6SU=; b=ciSayuqOFE8H9HO87bw/gthQyLPLMgTHWuIya6yRysO7F1m1D4XRjIuW0mSg+JN2sE VCLWvuTElpsh+LYEdjVg9tNjMGr4R3T1sp33p7VUzFqXZZblhdMRxSQ02HunAmQuZOzN bcwZ8txPcE8gzOiOaT8yGGPngsdzSjHZcWJp8rZKr3nIDHS5vy7b+oH2pdBTSd0TOpUs 5QpBw+jd/VJKy6B+EQThV1UjCEEP2OfcQb6QgN0aszsDOtctDRj3bpRaBXT8rvLYvQ4n wrq1xHijh/wacGN2yOzvosqaJ/BvtXO8N0slZGCplCs5dXLxDXV1anelBJUuwyeM+6gI GpTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773152042; x=1773756842; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=IvFj7BAAy+OPVIRcv54K79IILH7WSbxHWhjWNJQS6SU=; b=bvrR4o6DUVewZ1XRZ/nH/p69yuHZngo/iJRnF+okRA7Qi/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+3O5Tllp4qC0BIB1cCk7 W1i7JcWc4xbFM4= X-Received: by 2002:a05:6000:1847:b0:439:b6b3:faa7 with SMTP id ffacd0b85a97d-439eff5cdb7mr6880582f8f.28.1773152041960; Tue, 10 Mar 2026 07:14:01 -0700 (PDT) Message-ID: <7adc329e-6690-46ad-b706-74548dc7ccbc@suse.com> Date: Tue, 10 Mar 2026 15:14:01 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/3] x86/efi: Add BGRT image preservation during boot To: Soumyajyotii Ssarkar Cc: =?UTF-8?Q?Marek_Marczykowski-G=C3=B3recki?= , xen-devel@lists.xenproject.org, sarkarsoumyajyoti23@gmail.com, "Daniel P . Smith" , =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= , Andrew Cooper References: <20260305191810.31033-1-soumyajyotisarkar23@gmail.com> <20260305191810.31033-2-soumyajyotisarkar23@gmail.com> <609060f4-d94b-4b65-a10b-5126f10307db@suse.com> Content-Language: en-US From: Jan Beulich Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAU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 Content-Transfer-Encoding: 8bit On 10.03.2026 14:05, Soumyajyotii Ssarkar wrote: > On Mon, Mar 9, 2026 at 1:01 PM Jan Beulich wrote: > >> On 08.03.2026 19:30, Marek Marczykowski-Górecki wrote: >>> On Fri, Mar 06, 2026 at 12:48:08AM +0530, Soumyajyotii Ssarkar wrote: >>>> --- 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[] = 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 */ >>> >>> uint64_t table_offset_entry[]; >>> >>> BTW, do we have some canonical place with list of files imported (and >>> kept in sync) with other projects? xen/include/acpi/actbl.h doesn't >>> exactly follow Xen coding style, but it's unclear to me if it needs to >>> stay this way. >> >> I don't really understand why the headers we've got can't be used. Even >> some of the library-like code under xen/acpi/ may be usable here. >> >> While we don't exactly keep xen/include/acpi/ in sync with Linux, when >> things are added we preferably add them in the way Linux has them. >> >> > I was trying to avoid including the headers from the xen/include/acpi/ > since it was specified in the comment. to not include them. > Specific comment specified below this paragraph. > Also since acpi was using datatypes like "u32" while boot.c had types of > "uint32", so it felt a bit non-standardized. > I checked the rest of the boot.c which followed the same manner. So I went > with this choice. > > /* * Keep this arch-specific modified include in the common file, as moving > * it to the arch specific include file would obscure that special care is > * taken to include it with __ASSEMBLER__ defined. > */ > #define __ASSEMBLER__ /* avoid pulling in ACPI stuff (conflicts with EFI) > */ > #include > #undef __ASSEMBLER__ > #endif > > The ACPI headers in /xen/include/acpi uses defines such > as ACPI_NAME_SIZE, ACPI_OEM_ID_SIZE > and ACPI_OEM_TABLE_ID_SIZE these require adding additional > header. > Also since their is no acpi headers included in the boot.c file, so i > thought to I avoid it. > > Thus to get it fully working with ACPI headers from the xen/include/acpi I > would require these three headers. > #include > #include > #include > > I thought this would lead to cross contamination, and confusing to further > modifications in future so weighing my options I thought best to redefine > them, > for code clarity. > Can you suggest me best option to move forward, should I redefine them as > is or include the headers? First - see about re-using ACPI functions we already have. Then put new ACPI code you need to add in a file different from the EFI one. Jan