Skip to content

Commit 38918e0

Browse files
committed
x86/sev: Move SEV compilation units
A long time ago it was agreed upon that the coco stuff needs to go where it belongs: https://lore.kernel.org/all/[email protected] and not keep it in arch/x86/kernel. TDX did that and SEV can't find time to do so. So lemme do it. If people have trouble converting their ongoing featuritis patches, ask me for a sed script. No functional changes. Move the instrumentation exclusion bits too, as helpfully caught and reported by the 0day folks. Closes: https://lore.kernel.org/oe-kbuild-all/[email protected] Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-lkp/[email protected] Reported-by: kernel test robot <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Reviewed-by: Nikunj A Dadhania <[email protected]> Reviewed-by: Ashish Kalra <[email protected]> Tested-by: kernel test robot <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 3991b04 commit 38918e0

File tree

6 files changed

+18
-8
lines changed

6 files changed

+18
-8
lines changed

arch/x86/boot/compressed/sev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ static bool fault_in_kernel_space(unsigned long address)
127127
#include "../../lib/insn.c"
128128

129129
/* Include code for early handlers */
130-
#include "../../kernel/sev-shared.c"
130+
#include "../../coco/sev/shared.c"
131131

132132
static struct svsm_ca *svsm_get_caa(void)
133133
{

arch/x86/coco/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ CFLAGS_core.o += -fno-stack-protector
66
obj-y += core.o
77

88
obj-$(CONFIG_INTEL_TDX_GUEST) += tdx/
9+
obj-$(CONFIG_AMD_MEM_ENCRYPT) += sev/

arch/x86/coco/sev/Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
3+
obj-y += core.o
4+
5+
ifdef CONFIG_FUNCTION_TRACER
6+
CFLAGS_REMOVE_core.o = -pg
7+
endif
8+
9+
KASAN_SANITIZE_core.o := n
10+
KMSAN_SANITIZE_core.o := n
11+
KCOV_INSTRUMENT_core.o := n
12+
13+
# With some compiler versions the generated code results in boot hangs, caused
14+
# by several compilation units. To be safe, disable all instrumentation.
15+
KCSAN_SANITIZE := n

arch/x86/kernel/sev.c renamed to arch/x86/coco/sev/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ static __always_inline void vc_forward_exception(struct es_em_ctxt *ctxt)
613613
}
614614

615615
/* Include code shared with pre-decompression boot stage */
616-
#include "sev-shared.c"
616+
#include "shared.c"
617617

618618
static inline struct svsm_ca *svsm_get_caa(void)
619619
{
File renamed without changes.

arch/x86/kernel/Makefile

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ CFLAGS_REMOVE_ftrace.o = -pg
1717
CFLAGS_REMOVE_early_printk.o = -pg
1818
CFLAGS_REMOVE_head64.o = -pg
1919
CFLAGS_REMOVE_head32.o = -pg
20-
CFLAGS_REMOVE_sev.o = -pg
2120
CFLAGS_REMOVE_rethook.o = -pg
2221
endif
2322

@@ -26,19 +25,16 @@ KASAN_SANITIZE_dumpstack.o := n
2625
KASAN_SANITIZE_dumpstack_$(BITS).o := n
2726
KASAN_SANITIZE_stacktrace.o := n
2827
KASAN_SANITIZE_paravirt.o := n
29-
KASAN_SANITIZE_sev.o := n
3028

3129
# With some compiler versions the generated code results in boot hangs, caused
3230
# by several compilation units. To be safe, disable all instrumentation.
3331
KCSAN_SANITIZE := n
3432
KMSAN_SANITIZE_head$(BITS).o := n
3533
KMSAN_SANITIZE_nmi.o := n
36-
KMSAN_SANITIZE_sev.o := n
3734

3835
# If instrumentation of the following files is enabled, boot hangs during
3936
# first second.
4037
KCOV_INSTRUMENT_head$(BITS).o := n
41-
KCOV_INSTRUMENT_sev.o := n
4238

4339
CFLAGS_irq.o := -I $(src)/../include/asm/trace
4440

@@ -142,8 +138,6 @@ obj-$(CONFIG_UNWINDER_ORC) += unwind_orc.o
142138
obj-$(CONFIG_UNWINDER_FRAME_POINTER) += unwind_frame.o
143139
obj-$(CONFIG_UNWINDER_GUESS) += unwind_guess.o
144140

145-
obj-$(CONFIG_AMD_MEM_ENCRYPT) += sev.o
146-
147141
obj-$(CONFIG_CFI_CLANG) += cfi.o
148142

149143
obj-$(CONFIG_CALL_THUNKS) += callthunks.o

0 commit comments

Comments
 (0)