@@ -28,5 +28,7 @@ obj-y += net/
obj-$(CONFIG_KEXEC_FILE) += purgatory/
+obj-y += tests/
+
# for cleaning
subdir- += boot tools
@@ -278,3 +278,22 @@ endchoice
config FRAME_POINTER
depends on !UNWINDER_ORC && !UNWINDER_GUESS
bool
+
+config X86_TESTS
+ bool "x86 unit tests"
+ help
+ This enables building the tests under arch/x86/tests.
+
+if X86_TESTS
+config AMD_SEV_TEST_VC
+ bool "Test for AMD SEV VC exception handling"
+ depends on AMD_MEM_ENCRYPT
+ select FUNCTION_TRACER
+ select KPROBES
+ select KUNIT
+ help
+ Enable KUnit-based testing for AMD SEV #VC exception handling.
+ When this configuration option is enabled, these Kunit tests
+ get executed at the kernel boot time. Results of the test
+ execution can be monitored in the kernel log.
+endif # X86_TESTS
@@ -23,6 +23,13 @@ CFLAGS_REMOVE_head64.o = -pg
CFLAGS_REMOVE_sev.o = -pg
endif
+# AMD_SEV_TEST_VC registers a kprobe by function name. IPA-SRA creates
+# function copies and renames them to have an .isra suffix, which breaks kprobes'
+# lookup. Build with -fno-ipa-sra for the test.
+ifdef CONFIG_AMD_SEV_TEST_VC
+CFLAGS_sev.o += -fno-ipa-sra
+endif
+
KASAN_SANITIZE_head$(BITS).o := n
KASAN_SANITIZE_dumpstack.o := n
KASAN_SANITIZE_dumpstack_$(BITS).o := n
Configuration options CONFIG_X86_TESTS and CONFIG_AMD_SEV_ES_TEST_VC enable the execution of the KUnit tests added under arch/x86/tests that test AMD SEV-ES #VC handling. Signed-off-by: Vasant Karasulli <vkarasulli@suse.de> --- arch/x86/Kbuild | 2 ++ arch/x86/Kconfig.debug | 19 +++++++++++++++++++ arch/x86/kernel/Makefile | 7 +++++++ 3 files changed, 28 insertions(+) -- 2.32.0