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 2/5] x86/efi: Gather initial memory reservation and table handling logic
Date: Thu, 26 Mar 2026 14:26:58 +0100 [thread overview]
Message-ID: <20260326132655.1733873-9-ardb+git@google.com> (raw)
In-Reply-To: <20260326132655.1733873-7-ardb+git@google.com>
From: Ard Biesheuvel <ardb@kernel.org>
Move the back-to-back calls to various EFI routines related to
processing of firmware tables and reserving the associated memory into a
helper function. This is tidier, and will avoid the need to add yet
another function call there in a subsequent patch.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
arch/x86/include/asm/efi.h | 5 ++---
arch/x86/kernel/setup.c | 11 ++---------
arch/x86/platform/efi/efi.c | 13 +++++++++++++
3 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index 51b4cdbea061..3dcb137a49ed 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -387,11 +387,10 @@ static inline bool efi_is_table_address(unsigned long phys_addr)
{
return false;
}
-static inline void efi_reserve_boot_services(void)
-{
-}
#endif /* CONFIG_EFI */
+void efi_init_reservations(void);
+
extern int __init efi_memmap_alloc(unsigned int num_entries,
struct efi_memory_map_data *data);
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index eebcc9db1a1b..9f5f50bff16d 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -1083,15 +1083,8 @@ void __init setup_arch(char **cmdline_p)
mem_encrypt_setup_arch();
cc_random_init();
- efi_find_mirror();
- efi_esrt_init();
- efi_mokvar_table_init();
-
- /*
- * The EFI specification says that boot service code won't be
- * called after ExitBootServices(). This is, in fact, a lie.
- */
- efi_reserve_boot_services();
+ if (efi_enabled(EFI_BOOT))
+ efi_init_reservations();
/* preallocate 4k for mptable mpc */
e820__memblock_alloc_reserved_mpc_new();
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index d84c6020dda1..f32276bd8d4e 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -165,6 +165,19 @@ static void __init do_add_efi_memmap(void)
e820__update_table(e820_table);
}
+void __init efi_init_reservations(void)
+{
+ efi_find_mirror();
+ efi_esrt_init();
+ efi_mokvar_table_init();
+
+ /*
+ * The EFI specification says that boot service code won't be
+ * called after ExitBootServices(). This is, in fact, a lie.
+ */
+ efi_reserve_boot_services();
+}
+
/*
* Given add_efi_memmap defaults to 0 and there is no alternative
* e820 mechanism for soft-reserved memory, import the full EFI memory
--
2.53.0.1018.g2bb0e51243-goog
next prev parent reply other threads:[~2026-03-26 13:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-26 13:26 [PATCH 0/5] x86/efi: Re-enable memory attributes table for kexec Ard Biesheuvel
2026-03-26 13:26 ` [PATCH 1/5] efi/memattr: Fix thinko in table size sanity check Ard Biesheuvel
2026-03-29 17:51 ` Gregory Price
2026-03-26 13:26 ` Ard Biesheuvel [this message]
2026-03-29 17:53 ` [PATCH 2/5] x86/efi: Gather initial memory reservation and table handling logic Gregory Price
2026-03-26 13:26 ` [PATCH 3/5] x86/efi: Defer the call to efi_memattr_init() Ard Biesheuvel
2026-03-26 13:27 ` [PATCH 4/5] efi: Use efi_mem_reserve() to reserve the memory attribute table Ard Biesheuvel
2026-03-26 13:27 ` [PATCH 5/5] x86/efi: Drop kexec quirk for the EFI memory attributes table Ard Biesheuvel
2026-03-29 17:55 ` [PATCH 0/5] x86/efi: Re-enable memory attributes table for kexec Gregory Price
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=20260326132655.1733873-9-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox