Skip to content

Commit d012d13

Browse files
committed
x86/sev: Move SEV compilation units
JIRA: https://issues.redhat.com/browse/RHEL-49791 A long time ago it was agreed upon that the coco stuff needs to go where it belongs: https://lore.kernel.org/all/Yg5nh1RknPRwIrb8@zn.tnic 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/202406220748.hG3qlmDx-lkp@intel.com Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-lkp/202407091342.46d7dbb-oliver.sang@intel.com Reported-by: kernel test robot <oliver.sang@intel.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Nikunj A Dadhania <nikunj@amd.com> Reviewed-by: Ashish Kalra <ashish.kalra@amd.com> Tested-by: kernel test robot <oliver.sang@intel.com> Link: https://lore.kernel.org/r/20240619093014.17962-1-bp@kernel.org (cherry picked from commit 38918e0) Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent 1e89a67 commit d012d13

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
@@ -126,7 +126,7 @@ static bool fault_in_kernel_space(unsigned long address)
126126
#include "../../lib/insn.c"
127127

128128
/* Include code for early handlers */
129-
#include "../../kernel/sev-shared.c"
129+
#include "../../coco/sev/shared.c"
130130

131131
static struct svsm_ca *svsm_get_caa(void)
132132
{

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
@@ -21,7 +21,6 @@ CFLAGS_REMOVE_ftrace.o = -pg
2121
CFLAGS_REMOVE_early_printk.o = -pg
2222
CFLAGS_REMOVE_head64.o = -pg
2323
CFLAGS_REMOVE_head32.o = -pg
24-
CFLAGS_REMOVE_sev.o = -pg
2524
CFLAGS_REMOVE_rethook.o = -pg
2625
endif
2726

@@ -30,19 +29,16 @@ KASAN_SANITIZE_dumpstack.o := n
3029
KASAN_SANITIZE_dumpstack_$(BITS).o := n
3130
KASAN_SANITIZE_stacktrace.o := n
3231
KASAN_SANITIZE_paravirt.o := n
33-
KASAN_SANITIZE_sev.o := n
3432

3533
# With some compiler versions the generated code results in boot hangs, caused
3634
# by several compilation units. To be safe, disable all instrumentation.
3735
KCSAN_SANITIZE := n
3836
KMSAN_SANITIZE_head$(BITS).o := n
3937
KMSAN_SANITIZE_nmi.o := n
40-
KMSAN_SANITIZE_sev.o := n
4138

4239
# If instrumentation of the following files is enabled, boot hangs during
4340
# first second.
4441
KCOV_INSTRUMENT_head$(BITS).o := n
45-
KCOV_INSTRUMENT_sev.o := n
4642

4743
CFLAGS_irq.o := -I $(srctree)/$(src)/../include/asm/trace
4844

@@ -141,8 +137,6 @@ obj-$(CONFIG_UNWINDER_ORC) += unwind_orc.o
141137
obj-$(CONFIG_UNWINDER_FRAME_POINTER) += unwind_frame.o
142138
obj-$(CONFIG_UNWINDER_GUESS) += unwind_guess.o
143139

144-
obj-$(CONFIG_AMD_MEM_ENCRYPT) += sev.o
145-
146140
obj-$(CONFIG_CALL_THUNKS) += callthunks.o
147141

148142
obj-$(CONFIG_CFI_CLANG) += cfi.o

0 commit comments

Comments
 (0)