From: Ard Biesheuvel <ardb+git@google.com>
To: linux-kernel@vger.kernel.org
Cc: linux-efi@vger.kernel.org, x86@kernel.org, mingo@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 v5 4/6] x86/boot: Move SEV startup code into startup/
Date: Fri, 18 Apr 2025 16:12:58 +0200 [thread overview]
Message-ID: <20250418141253.2601348-12-ardb+git@google.com> (raw)
In-Reply-To: <20250418141253.2601348-8-ardb+git@google.com>
From: Ard Biesheuvel <ardb@kernel.org>
Move the SEV startup code into arch/x86/boot/startup/, where it will
reside along with other code that executes extremely early, and
therefore needs to be built in a special manner.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
arch/x86/boot/compressed/sev.c | 2 +-
arch/x86/boot/startup/Makefile | 2 +-
arch/x86/{coco/sev/shared.c => boot/startup/sev-shared.c} | 0
arch/x86/{coco/sev/startup.c => boot/startup/sev-startup.c} | 2 +-
arch/x86/coco/sev/Makefile | 20 ++------------------
5 files changed, 5 insertions(+), 21 deletions(-)
diff --git a/arch/x86/boot/compressed/sev.c b/arch/x86/boot/compressed/sev.c
index 714e30c66eae..478c65149cf0 100644
--- a/arch/x86/boot/compressed/sev.c
+++ b/arch/x86/boot/compressed/sev.c
@@ -144,7 +144,7 @@ int svsm_perform_call_protocol(struct svsm_call *call);
u8 snp_vmpl;
/* Include code for early handlers */
-#include "../../coco/sev/shared.c"
+#include "../../boot/startup/sev-shared.c"
int svsm_perform_call_protocol(struct svsm_call *call)
{
diff --git a/arch/x86/boot/startup/Makefile b/arch/x86/boot/startup/Makefile
index bb7c826e586c..21d911b61459 100644
--- a/arch/x86/boot/startup/Makefile
+++ b/arch/x86/boot/startup/Makefile
@@ -17,7 +17,7 @@ UBSAN_SANITIZE := n
KCOV_INSTRUMENT := n
obj-$(CONFIG_X86_64) += gdt_idt.o map_kernel.o
-obj-$(CONFIG_AMD_MEM_ENCRYPT) += sme.o
+obj-$(CONFIG_AMD_MEM_ENCRYPT) += sme.o sev-startup.o
lib-$(CONFIG_X86_64) += la57toggle.o
lib-$(CONFIG_EFI_MIXED) += efi-mixed.o
diff --git a/arch/x86/coco/sev/shared.c b/arch/x86/boot/startup/sev-shared.c
similarity index 100%
rename from arch/x86/coco/sev/shared.c
rename to arch/x86/boot/startup/sev-shared.c
diff --git a/arch/x86/coco/sev/startup.c b/arch/x86/boot/startup/sev-startup.c
similarity index 99%
rename from arch/x86/coco/sev/startup.c
rename to arch/x86/boot/startup/sev-startup.c
index 9f5dc70cfb44..10b636009d1c 100644
--- a/arch/x86/coco/sev/startup.c
+++ b/arch/x86/boot/startup/sev-startup.c
@@ -422,7 +422,7 @@ static __always_inline void vc_forward_exception(struct es_em_ctxt *ctxt)
}
/* Include code shared with pre-decompression boot stage */
-#include "shared.c"
+#include "sev-shared.c"
noinstr void __sev_put_ghcb(struct ghcb_state *state)
{
diff --git a/arch/x86/coco/sev/Makefile b/arch/x86/coco/sev/Makefile
index 57e25f946663..2919dcfc4b02 100644
--- a/arch/x86/coco/sev/Makefile
+++ b/arch/x86/coco/sev/Makefile
@@ -1,25 +1,9 @@
# SPDX-License-Identifier: GPL-2.0
-obj-y += core.o sev-nmi.o startup.o
-
-# jump tables are emitted using absolute references in non-PIC code
-# so they cannot be used in the early SEV startup code
-CFLAGS_startup.o += -fno-jump-tables
-
-ifdef CONFIG_FUNCTION_TRACER
-CFLAGS_REMOVE_startup.o = -pg
-endif
-
-KASAN_SANITIZE_startup.o := n
-KMSAN_SANITIZE_startup.o := n
-KCOV_INSTRUMENT_startup.o := n
-
-# With some compiler versions the generated code results in boot hangs, caused
-# by several compilation units. To be safe, disable all instrumentation.
-KCSAN_SANITIZE := n
+obj-y += core.o sev-nmi.o
# Clang 14 and older may fail to respect __no_sanitize_undefined when inlining
-UBSAN_SANITIZE := n
+UBSAN_SANITIZE_sev-nmi.o := n
# GCC may fail to respect __no_sanitize_address when inlining
KASAN_SANITIZE_sev-nmi.o := n
--
2.49.0.805.g082f7c87e0-goog
next prev parent reply other threads:[~2025-04-18 14:14 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-18 14:12 [PATCH v5 0/6] x86: Refactor and consolidate startup code Ard Biesheuvel
2025-04-18 14:12 ` [PATCH v5 1/6] vmlinux.lds: Include .data.rel[.local] into .data section Ard Biesheuvel
2025-04-18 14:12 ` [PATCH v5 2/6] x86/sev: Move noinstr NMI handling code into separate source file Ard Biesheuvel
2025-04-18 14:12 ` [PATCH v5 3/6] x86/sev: Split off startup code from core code Ard Biesheuvel
2025-04-23 15:22 ` Tom Lendacky
2025-04-23 15:50 ` Ard Biesheuvel
2025-04-24 9:37 ` Borislav Petkov
2025-04-24 15:34 ` [PATCH] x86/sev: Share the sev_secrets_pa value again Ingo Molnar
2025-04-24 16:04 ` Tom Lendacky
2025-04-18 14:12 ` Ard Biesheuvel [this message]
2025-04-18 14:12 ` [PATCH v5 5/6] x86/boot: Drop RIP_REL_REF() uses from early SEV code Ard Biesheuvel
2025-04-18 14:13 ` [PATCH v5 6/6] x86/asm: Retire RIP_REL_REF() Ard Biesheuvel
2025-04-18 15:51 ` Uros Bizjak
2025-04-18 15:58 ` Ard Biesheuvel
2025-05-04 7:33 ` Uros Bizjak
2025-04-22 19:55 ` [PATCH v5 0/6] x86: Refactor and consolidate startup code Ingo Molnar
2025-04-22 21:09 ` 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=20250418141253.2601348-12-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