]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
x86/boot: Move early SME init code into startup/
authorArd Biesheuvel <ardb@kernel.org>
Thu, 10 Apr 2025 13:41:23 +0000 (15:41 +0200)
committerIngo Molnar <mingo@kernel.org>
Sat, 12 Apr 2025 09:13:05 +0000 (11:13 +0200)
Move the SME initialization code, which runs from the 1:1 mapping of
memory as it operates on the kernel virtual mapping, into the new
sub-directory arch/x86/boot/startup/ where all startup code will reside
that needs to tolerate executing from the 1:1 mapping.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Dionna Amalie Glaze <dionnaglaze@google.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Kevin Loughlin <kevinloughlin@google.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: linux-efi@vger.kernel.org
Link: https://lore.kernel.org/r/20250410134117.3713574-18-ardb+git@google.com
arch/x86/boot/startup/Makefile
arch/x86/boot/startup/sme.c [moved from arch/x86/mm/mem_encrypt_identity.c with 99% similarity]
arch/x86/mm/Makefile

index 10319aee666b1683e013a2daf17524427aaa52e2..ccdfc42a4d59e1b53303072868ce871b90fd4630 100644 (file)
@@ -16,6 +16,7 @@ UBSAN_SANITIZE        := n
 KCOV_INSTRUMENT        := n
 
 obj-$(CONFIG_X86_64)           += gdt_idt.o map_kernel.o
+obj-$(CONFIG_AMD_MEM_ENCRYPT)  += sme.o
 
 lib-$(CONFIG_X86_64)           += la57toggle.o
 lib-$(CONFIG_EFI_MIXED)                += efi-mixed.o
similarity index 99%
rename from arch/x86/mm/mem_encrypt_identity.c
rename to arch/x86/boot/startup/sme.c
index e7fb3779b35fe5be01389fdfe2f7094b74eebad5..23d10cda5b58c21c82a4ae512f0542d5b48b9aeb 100644 (file)
@@ -45,8 +45,6 @@
 #include <asm/coco.h>
 #include <asm/sev.h>
 
-#include "mm_internal.h"
-
 #define PGD_FLAGS              _KERNPG_TABLE_NOENC
 #define P4D_FLAGS              _KERNPG_TABLE_NOENC
 #define PUD_FLAGS              _KERNPG_TABLE_NOENC
index 32035d5be5a017a97fb2699d647c4c70029a0591..3faa60f13a61a6e018ed0efcbbcb5ee40de6c754 100644 (file)
@@ -3,12 +3,10 @@
 KCOV_INSTRUMENT_tlb.o                  := n
 KCOV_INSTRUMENT_mem_encrypt.o          := n
 KCOV_INSTRUMENT_mem_encrypt_amd.o      := n
-KCOV_INSTRUMENT_mem_encrypt_identity.o := n
 KCOV_INSTRUMENT_pgprot.o               := n
 
 KASAN_SANITIZE_mem_encrypt.o           := n
 KASAN_SANITIZE_mem_encrypt_amd.o       := n
-KASAN_SANITIZE_mem_encrypt_identity.o  := n
 KASAN_SANITIZE_pgprot.o                := n
 
 # Disable KCSAN entirely, because otherwise we get warnings that some functions
@@ -16,12 +14,10 @@ KASAN_SANITIZE_pgprot.o             := n
 KCSAN_SANITIZE := n
 # Avoid recursion by not calling KMSAN hooks for CEA code.
 KMSAN_SANITIZE_cpu_entry_area.o := n
-KMSAN_SANITIZE_mem_encrypt_identity.o := n
 
 ifdef CONFIG_FUNCTION_TRACER
 CFLAGS_REMOVE_mem_encrypt.o            = -pg
 CFLAGS_REMOVE_mem_encrypt_amd.o                = -pg
-CFLAGS_REMOVE_mem_encrypt_identity.o   = -pg
 CFLAGS_REMOVE_pgprot.o                 = -pg
 endif
 
@@ -32,7 +28,6 @@ obj-y                         += pat/
 
 # Make sure __phys_addr has no stackprotector
 CFLAGS_physaddr.o              := -fno-stack-protector
-CFLAGS_mem_encrypt_identity.o  := -fno-stack-protector
 
 CFLAGS_fault.o := -I $(src)/../include/asm/trace
 
@@ -63,5 +58,4 @@ obj-$(CONFIG_MITIGATION_PAGE_TABLE_ISOLATION) += pti.o
 obj-$(CONFIG_X86_MEM_ENCRYPT)  += mem_encrypt.o
 obj-$(CONFIG_AMD_MEM_ENCRYPT)  += mem_encrypt_amd.o
 
-obj-$(CONFIG_AMD_MEM_ENCRYPT)  += mem_encrypt_identity.o
 obj-$(CONFIG_AMD_MEM_ENCRYPT)  += mem_encrypt_boot.o