From: Ard Biesheuvel <ardb+git@google.com>
To: linux-efi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
Ard Biesheuvel <ardb@kernel.org>, Dave Young <dyoung@redhat.com>,
Gregory Price <gourry@gourry.net>,
Usama Arif <usamaarif642@gmail.com>,
Jiri Slaby <jirislaby@kernel.org>,
Breno Leitao <leitao@debian.org>
Subject: [PATCH v2 3/5] x86/efi: Defer the call to efi_memattr_init()
Date: Wed, 1 Apr 2026 14:23:55 +0200 [thread overview]
Message-ID: <20260401122351.2058145-10-ardb+git@google.com> (raw)
In-Reply-To: <20260401122351.2058145-7-ardb+git@google.com>
From: Ard Biesheuvel <ardb@kernel.org>
efi_memattr_init() should call efi_mem_reserve() rather than
memblock_reserve() to preserve the memory contents of the region when
the EFI memory attributes table is loaded by the firmware.
However, efi_mem_reserve() can only be called later during the boot on
x86, due to the fact that it may need to memblock_alloc() memory for the
EFI memory map.
So move the call to efi_memattr_init() to a later stage when building
for x86_64.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
arch/x86/platform/efi/efi.c | 2 ++
drivers/firmware/efi/efi.c | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index f32276bd8d4e..107dcdf354ba 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -167,6 +167,8 @@ static void __init do_add_efi_memmap(void)
void __init efi_init_reservations(void)
{
+ if (IS_ENABLED(CONFIG_X86_64) && efi_enabled(EFI_MEMMAP))
+ efi_memattr_init();
efi_find_mirror();
efi_esrt_init();
efi_mokvar_table_init();
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index b2fb92a4bbd1..d28ed1ce9a33 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -761,7 +761,7 @@ int __init efi_config_parse_tables(const efi_config_table_t *config_tables,
}
}
- if (!IS_ENABLED(CONFIG_X86_32) && efi_enabled(EFI_MEMMAP))
+ if (!IS_ENABLED(CONFIG_X86) && efi_enabled(EFI_MEMMAP))
efi_memattr_init();
efi_tpm_eventlog_init();
--
2.53.0.1118.gaef5881109-goog
next prev parent reply other threads:[~2026-04-01 12:24 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-01 12:23 [PATCH v2 0/5] x86/efi: Re-enable memory attributes table for kexec Ard Biesheuvel
2026-04-01 12:23 ` [PATCH v2 1/5] efi/memattr: Fix thinko in table size sanity check Ard Biesheuvel
2026-04-01 12:45 ` Breno Leitao
2026-04-01 14:31 ` Ard Biesheuvel
2026-04-01 14:35 ` Breno Leitao
2026-04-01 12:23 ` [PATCH v2 2/5] x86/efi: Gather initial memory reservation and table handling logic Ard Biesheuvel
2026-04-01 14:49 ` Breno Leitao
2026-04-01 14:59 ` Ard Biesheuvel
2026-04-01 12:23 ` Ard Biesheuvel [this message]
2026-04-01 14:57 ` [PATCH v2 3/5] x86/efi: Defer the call to efi_memattr_init() Breno Leitao
2026-04-01 12:23 ` [PATCH v2 4/5] efi: Use efi_mem_reserve() to reserve the memory attribute table Ard Biesheuvel
2026-04-01 17:39 ` Breno Leitao
2026-04-01 17:47 ` Ard Biesheuvel
2026-04-01 12:23 ` [PATCH v2 5/5] x86/efi: Drop kexec quirk for the EFI memory attributes table Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260401122351.2058145-10-ardb+git@google.com \
--to=ardb+git@google.com \
--cc=ardb@kernel.org \
--cc=dyoung@redhat.com \
--cc=gourry@gourry.net \
--cc=jirislaby@kernel.org \
--cc=leitao@debian.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=usamaarif642@gmail.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.