diff mbox series

[kvm-unit-tests,v2,2/4] x86: nSVM: Move #BP test to exception test framework

Message ID 20220810052102.7591-1-manali.shukla@amd.com (mailing list archive)
State New, archived
Headers show
Series x86: nSVM: Add testing for routing L2 exceptions | expand

Commit Message

Manali Shukla Aug. 10, 2022, 5:21 a.m. UTC
Remove boiler plate code for #BP test and move #BP exception test in
exception test framework.

Signed-off-by: Manali Shukla <manali.shukla@amd.com>
---
 x86/svm_tests.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)
diff mbox series

Patch

diff --git a/x86/svm_tests.c b/x86/svm_tests.c
index 7544034..b36aec1 100644
--- a/x86/svm_tests.c
+++ b/x86/svm_tests.c
@@ -2804,26 +2804,11 @@  static void svm_into_test(void)
 	       "#OF is generated in L2 exception handler");
 }
 
-static int bp_test_counter;
-
-static void guest_test_bp_handler(struct ex_regs *r)
-{
-	bp_test_counter++;
-}
-
-static void svm_bp_test_guest(struct svm_test *test)
+static void svm_l2_bp_test(struct svm_test *test)
 {
 	asm volatile("int3");
 }
 
-static void svm_int3_test(void)
-{
-	handle_exception(BP_VECTOR, guest_test_bp_handler);
-	test_set_guest(svm_bp_test_guest);
-	report(svm_vmrun() == SVM_EXIT_VMMCALL && bp_test_counter == 1,
-	       "#BP is handled in L2 exception handler");
-}
-
 static int nm_test_counter;
 
 static void guest_test_nm_handler(struct ex_regs *r)
@@ -3350,6 +3335,7 @@  struct svm_exception_test svm_exception_tests[] = {
 	{ DE_VECTOR, svm_l2_de_test },
 	{ DB_VECTOR, svm_l2_db_test },
 	{ AC_VECTOR, svm_l2_ac_test },
+	{ BP_VECTOR, svm_l2_bp_test },
 };
 
 static u8 svm_exception_test_vector;
@@ -3500,7 +3486,6 @@  struct svm_test svm_tests[] = {
 	TEST(svm_vmload_vmsave),
 	TEST(svm_test_singlestep),
 	TEST(svm_nm_test),
-	TEST(svm_int3_test),
 	TEST(svm_into_test),
 	TEST(svm_exception_test),
 	TEST(svm_lbrv_test0),