]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
x86/boot: Move the 5-level paging trampoline into /startup
authorArd Biesheuvel <ardb@kernel.org>
Tue, 1 Apr 2025 13:34:19 +0000 (15:34 +0200)
committerIngo Molnar <mingo@kernel.org>
Sun, 6 Apr 2025 18:15:14 +0000 (20:15 +0200)
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>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: David Woodhouse <dwmw@amazon.co.uk>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/r/20250401133416.1436741-10-ardb+git@google.com
arch/x86/Makefile
arch/x86/boot/compressed/Makefile
arch/x86/boot/startup/Makefile [new file with mode: 0644]
arch/x86/boot/startup/la57toggle.S [moved from arch/x86/boot/compressed/la57toggle.S with 100% similarity]

index 594723005d95d999df400c1481a0136c91340487..53daf4654f6c66947f60021c2a36153612ab2f56 100644 (file)
@@ -281,6 +281,7 @@ archprepare: $(cpufeaturemasks.hdr)
 ###
 # Kernel objects
 
+core-y  += arch/x86/boot/startup/
 libs-y  += arch/x86/lib/
 
 # drivers-y are linked after core-y
index fdbce022db555972c47fea2cb7866aa5d10debad..37b85ce9b2a3ab6acb369d96b3be0fdbb8e45bf1 100644 (file)
@@ -97,7 +97,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
@@ -106,6 +105,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 (file)
index 0000000..03519ef
--- /dev/null
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+
+lib-$(CONFIG_X86_64)           += la57toggle.o