mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb+git@google.com>
To: linux-efi@vger.kernel.org
Cc: x86@kernel.org, mingo@kernel.org, linux-kernel@vger.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: [PATCH v4 05/11] x86/boot: Move early SME init code into startup/
Date: Thu, 10 Apr 2025 15:41:23 +0200	[thread overview]
Message-ID: <20250410134117.3713574-18-ardb+git@google.com> (raw)
In-Reply-To: <20250410134117.3713574-13-ardb+git@google.com>

From: Ard Biesheuvel <ardb@kernel.org>

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>
---
 arch/x86/boot/startup/Makefile                             | 1 +
 arch/x86/{mm/mem_encrypt_identity.c => boot/startup/sme.c} | 2 --
 arch/x86/mm/Makefile                                       | 6 ------
 3 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/arch/x86/boot/startup/Makefile b/arch/x86/boot/startup/Makefile
index 10319aee666b..ccdfc42a4d59 100644
--- a/arch/x86/boot/startup/Makefile
+++ b/arch/x86/boot/startup/Makefile
@@ -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
diff --git a/arch/x86/mm/mem_encrypt_identity.c b/arch/x86/boot/startup/sme.c
similarity index 99%
rename from arch/x86/mm/mem_encrypt_identity.c
rename to arch/x86/boot/startup/sme.c
index e7fb3779b35f..23d10cda5b58 100644
--- a/arch/x86/mm/mem_encrypt_identity.c
+++ b/arch/x86/boot/startup/sme.c
@@ -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
diff --git a/arch/x86/mm/Makefile b/arch/x86/mm/Makefile
index 32035d5be5a0..3faa60f13a61 100644
--- a/arch/x86/mm/Makefile
+++ b/arch/x86/mm/Makefile
@@ -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
-- 
2.49.0.504.g3bcea36a83-goog


  parent reply	other threads:[~2025-04-10 13:41 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-10 13:41 [PATCH v4 00/11] x86: Refactor and consolidate startup code Ard Biesheuvel
2025-04-10 13:41 ` [PATCH v4 01/11] x86/asm: Make rip_rel_ptr() usable from fPIC code Ard Biesheuvel
2025-04-12 14:33   ` [tip: x86/boot] " tip-bot2 for Ard Biesheuvel
2025-04-10 13:41 ` [PATCH v4 02/11] x86/boot: Move the early GDT/IDT setup code into startup/ Ard Biesheuvel
2025-04-12 14:33   ` [tip: x86/boot] " tip-bot2 for Ard Biesheuvel
2025-04-10 13:41 ` [PATCH v4 03/11] x86/boot: Move early kernel mapping " Ard Biesheuvel
2025-04-12 14:33   ` [tip: x86/boot] " tip-bot2 for Ard Biesheuvel
2025-04-10 13:41 ` [PATCH v4 04/11] x86/boot: Drop RIP_REL_REF() uses from early mapping code Ard Biesheuvel
2025-04-12 14:33   ` [tip: x86/boot] " tip-bot2 for Ard Biesheuvel
2025-04-10 13:41 ` Ard Biesheuvel [this message]
2025-04-12 14:33   ` [tip: x86/boot] x86/boot: Move early SME init code into startup/ tip-bot2 for Ard Biesheuvel
2025-04-10 13:41 ` [PATCH v4 06/11] x86/boot: Drop RIP_REL_REF() uses from SME startup code Ard Biesheuvel
2025-04-12 14:33   ` [tip: x86/boot] " tip-bot2 for Ard Biesheuvel
2025-04-10 13:41 ` [PATCH v4 07/11] x86/sev: Prepare for splitting off early SEV code Ard Biesheuvel
2025-04-12 14:33   ` [tip: x86/boot] " tip-bot2 for Ard Biesheuvel
2025-04-10 13:41 ` [PATCH v4 08/11] x86/sev: Split off startup code from core code Ard Biesheuvel
2025-04-12 12:23   ` Ingo Molnar
2025-04-12 18:47     ` Ingo Molnar
2025-04-12 20:08       ` Ingo Molnar
2025-04-12 20:24         ` Ard Biesheuvel
2025-04-12 20:50           ` Ingo Molnar
2025-04-10 13:41 ` [PATCH v4 09/11] x86/boot: Move SEV startup code into startup/ Ard Biesheuvel
2025-04-10 13:41 ` [PATCH v4 10/11] x86/boot: Drop RIP_REL_REF() uses from early SEV code Ard Biesheuvel
2025-04-10 13:41 ` [PATCH v4 11/11] x86/asm: Retire RIP_REL_REF() Ard Biesheuvel
2025-04-11 19:15 ` [PATCH v4 00/11] x86: Refactor and consolidate startup code Borislav Petkov

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=20250410134117.3713574-18-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=mingo@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

Powered by JetHome