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>,
Tom Lendacky <thomas.lendacky@amd.com>,
Dionna Amalie Glaze <dionnaglaze@google.com>,
Kevin Loughlin <kevinloughlin@google.com>
Subject: [RFC PATCH 2/6] x86/boot: Move 5-level paging trampoline into startup code
Date: Tue, 1 Apr 2025 15:34:19 +0200 [thread overview]
Message-ID: <20250401133416.1436741-10-ardb+git@google.com> (raw)
In-Reply-To: <20250401133416.1436741-8-ardb+git@google.com>
From: Ard Biesheuvel <ardb@kernel.org>
The 5-level paging trampoline is used by both the EFI stub and the
traditional decompressor. Move it out of the decompressor sources into
the newly minted arch/x86/boot/startup/ sub-directory which will hold
startup code that may be shared between the decompressor, the EFI stub
and the kernel proper, and needs to tolerate being called during early
boot, before the kernel virtual mapping has been created.
This will allow the 5-level paging trampoline to be used by EFI boot
images such as zboot that omit the traditional decompressor entirely.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
arch/x86/Makefile | 1 +
arch/x86/boot/compressed/Makefile | 2 +-
arch/x86/boot/startup/Makefile | 3 +++
arch/x86/boot/{compressed => startup}/la57toggle.S | 0
4 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 27efe2dc2aa8..c8703276e3e7 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -287,6 +287,7 @@ archprepare: $(cpufeaturemasks.hdr)
###
# Kernel objects
+core-y += arch/x86/boot/startup/
libs-y += arch/x86/lib/
# drivers-y are linked after core-y
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index 2eb63536c5d0..468e135de88e 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -98,7 +98,6 @@ ifdef CONFIG_X86_64
vmlinux-objs-$(CONFIG_AMD_MEM_ENCRYPT) += $(obj)/mem_encrypt.o
vmlinux-objs-y += $(obj)/pgtable_64.o
vmlinux-objs-$(CONFIG_AMD_MEM_ENCRYPT) += $(obj)/sev.o
- vmlinux-objs-y += $(obj)/la57toggle.o
endif
vmlinux-objs-$(CONFIG_ACPI) += $(obj)/acpi.o
@@ -107,6 +106,7 @@ vmlinux-objs-$(CONFIG_UNACCEPTED_MEMORY) += $(obj)/mem.o
vmlinux-objs-$(CONFIG_EFI) += $(obj)/efi.o
vmlinux-libs-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a
+vmlinux-libs-$(CONFIG_X86_64) += $(objtree)/arch/x86/boot/startup/lib.a
$(obj)/vmlinux: $(vmlinux-objs-y) $(vmlinux-libs-y) FORCE
$(call if_changed,ld)
diff --git a/arch/x86/boot/startup/Makefile b/arch/x86/boot/startup/Makefile
new file mode 100644
index 000000000000..03519ef4869d
--- /dev/null
+++ b/arch/x86/boot/startup/Makefile
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+
+lib-$(CONFIG_X86_64) += la57toggle.o
diff --git a/arch/x86/boot/compressed/la57toggle.S b/arch/x86/boot/startup/la57toggle.S
similarity index 100%
rename from arch/x86/boot/compressed/la57toggle.S
rename to arch/x86/boot/startup/la57toggle.S
--
2.49.0.472.ge94155a9ec-goog
next prev parent reply other threads:[~2025-04-01 13:34 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-01 13:34 [RFC PATCH 0/6] x86: Refactor and consolidate startup code Ard Biesheuvel
2025-04-01 13:34 ` [RFC PATCH 1/6] x86/boot/compressed: Merge local pgtable.h include into asm/boot.h Ard Biesheuvel
2025-04-06 18:33 ` [tip: x86/boot] x86/boot/compressed: Merge the local pgtable.h include into <asm/boot.h> tip-bot2 for Ard Biesheuvel
2025-04-01 13:34 ` Ard Biesheuvel [this message]
2025-04-06 18:33 ` [tip: x86/boot] x86/boot: Move the 5-level paging trampoline into /startup tip-bot2 for Ard Biesheuvel
2025-04-01 13:34 ` [RFC PATCH 3/6] x86/boot: Move EFI mixed mode startup code back under arch/x86 Ard Biesheuvel
2025-04-06 18:33 ` [tip: x86/boot] x86/boot: Move the EFI mixed mode startup code back under arch/x86, into startup/ tip-bot2 for Ard Biesheuvel
2025-04-07 7:38 ` Aithal, Srikanth
2025-04-07 8:30 ` Ard Biesheuvel
2025-04-07 9:41 ` Aithal, Srikanth
2025-04-09 11:54 ` Aithal, Srikanth
2025-04-09 12:00 ` Ingo Molnar
2025-04-01 13:34 ` [RFC PATCH 4/6] x86/boot: Move early GDT/IDT setup code " Ard Biesheuvel
2025-04-06 18:33 ` [tip: x86/boot] x86/boot: Move the " tip-bot2 for Ard Biesheuvel
2025-04-01 13:34 ` [RFC PATCH 5/6] x86/boot: Move early kernel mapping " Ard Biesheuvel
2025-04-06 18:32 ` [tip: x86/boot] x86/boot: Move the " tip-bot2 for Ard Biesheuvel
2025-04-06 18:51 ` [RFC PATCH 5/6] x86/boot: Move " Ingo Molnar
2025-04-06 19:24 ` Ard Biesheuvel
2025-04-01 13:34 ` [RFC PATCH 6/6] x86/boot: Move early SME init " Ard Biesheuvel
2025-04-06 18:32 ` [tip: x86/boot] x86/boot: Move the " tip-bot2 for 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=20250401133416.1436741-10-ardb+git@google.com \
--to=ardb+git@google.com \
--cc=ardb@kernel.org \
--cc=dionnaglaze@google.com \
--cc=kevinloughlin@google.com \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=thomas.lendacky@amd.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