Messages in this thread Patch in this message | | | From | Vasant Karasulli <> | Subject | [PATCH v6 3/4] x86/tests: Add tests for AMD SEV-ES #VC handling Add KUnit based tests to validate Linux's VC handling for instructions accessing registers such as MSR and DR7. These tests: 1. install a kretprobe on the #VC handler (sev_es_ghcb_hv_call, t | Date | Fri, 18 Mar 2022 10:45:31 +0100 |
| |
Signed-off-by: Vasant Karasulli <vkarasulli@suse.de> --- arch/x86/tests/sev-test-vc.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
diff --git a/arch/x86/tests/sev-test-vc.c b/arch/x86/tests/sev-test-vc.c index 9d415b9708dc..b27b9f114a12 100644 --- a/arch/x86/tests/sev-test-vc.c +++ b/arch/x86/tests/sev-test-vc.c @@ -7,6 +7,7 @@
#include <asm/cpufeature.h> #include <asm/sev-common.h> +#include <asm/debugreg.h> #include <asm/svm.h> #include <kunit/test.h> #include <linux/kprobes.h> @@ -99,9 +100,22 @@ static void sev_es_nae_wbinvd(struct kunit *test) check_op(test, SVM_EXIT_WBINVD, wbinvd()); }
+static void sev_es_nae_msr(struct kunit *test) +{ + check_op(test, SVM_EXIT_MSR, __rdmsr(MSR_IA32_TSC)); +} + +static void sev_es_nae_dr7_rw(struct kunit *test) +{ + check_op(test, SVM_EXIT_WRITE_DR7, + native_set_debugreg(7, native_get_debugreg(7))); +} + static struct kunit_case sev_es_vc_testcases[] = { KUNIT_CASE(sev_es_nae_cpuid), KUNIT_CASE(sev_es_nae_wbinvd), + KUNIT_CASE(sev_es_nae_msr), + KUNIT_CASE(sev_es_nae_dr7_rw), {} };
-- 2.32.0
| |