From: Vasant Karasulli <vkarasulli@suse.de>
To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: bp@alien8.de, jroedel@suse.de, thomas.lendacky@amd.com,
x86@kernel.org, seanjc@google.com,
Vasant Karasulli <vkarasulli@suse.de>
Subject: [PATCH v7 1/4] KVM: SEV-ES: Add configuration options to test #VC handling
Date: Mon, 13 Jun 2022 19:04:17 +0200 [thread overview]
Message-ID: <20220613170420.18521-2-vkarasulli@suse.de> (raw)
In-Reply-To: <20220613170420.18521-1-vkarasulli@suse.de>
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(+)
diff --git a/arch/x86/Kbuild b/arch/x86/Kbuild
index 5a83da703e87..ec01cd024bae 100644
--- a/arch/x86/Kbuild
+++ b/arch/x86/Kbuild
@@ -28,5 +28,7 @@ obj-y += net/
obj-$(CONFIG_KEXEC_FILE) += purgatory/
+obj-y += tests/
+
# for cleaning
subdir- += boot tools
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index 340399f69954..b0687173fb97 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -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
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 03364dc40d8d..3fa9ce2a700e 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -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
--
2.32.0
next prev parent reply other threads:[~2022-06-13 19:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-13 17:04 [PATCH v7 0/4] KVM: SEV-ES: Add tests to validate " Vasant Karasulli
2022-06-13 17:04 ` Vasant Karasulli [this message]
2022-06-13 17:04 ` [PATCH v7 2/4] KVM: SEV-ES: Add tests to validate VC handling for CPUID and WBINVD Vasant Karasulli
2022-06-13 17:04 ` [PATCH v7 3/4] KVM: SEV-ES: Add tests to validate VC handling for MSR and DR7 register accesses Vasant Karasulli
2022-06-13 17:04 ` [PATCH v7 4/4] KVM SEV-ES: Add tests to validate VC handling for IO instructions Vasant Karasulli
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=20220613170420.18521-2-vkarasulli@suse.de \
--to=vkarasulli@suse.de \
--cc=bp@alien8.de \
--cc=jroedel@suse.de \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=seanjc@google.com \
--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
all inboxes | Powered by JetHome®