[kvm-unit-tests PATCH v2 2/8] x86: nSVM: Test MSRs just outside the ranges of the MSR Permissions Map

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Verify that KVM correctly intercepts MSRs outside of all MSRPM ranges.  To
keep the run time sane, test only MSRs just before/after each range.  Odds
are very good that any bug that affects one out-of-range MSR will affect
all out-of-range MSRs.

Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
---
 x86/svm_tests.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/x86/svm_tests.c b/x86/svm_tests.c
index b738eb44..1795d7f6 100644
--- a/x86/svm_tests.c
+++ b/x86/svm_tests.c
@@ -322,7 +322,7 @@ static void test_msr_intercept(struct svm_test *test)
 	u64 ignored;
 	int vector;
 
-	for (msr_index = 0; msr_index <= 0xc0011fff; msr_index++) {
+	for (msr_index = 0; msr_index <= 0xc0012000; msr_index++) {
 		if (msr_index == 0xC0010131 /* MSR_SEV_STATUS */) {
 			/*
 			 * Per section 15.34.10 "SEV_STATUS MSR" of AMD64 Architecture
@@ -333,11 +333,14 @@ static void test_msr_intercept(struct svm_test *test)
 			continue;
 		}
 
-		/* Skips gaps between supported MSR ranges */
-		if (msr_index == 0x2000)
-			msr_index = 0xc0000000;
-		else if (msr_index == 0xc0002000)
-			msr_index = 0xc0010000;
+		/*
+		 * Test one MSR just before and after each range, but otherwise
+		 * skips gaps between supported MSR ranges.
+		 */
+		if (msr_index == 0x2000 + 1)
+			msr_index = 0xc0000000 - 1;
+		else if (msr_index == 0xc0002000 + 1)
+			msr_index = 0xc0010000 - 1;
 
 		test->scratch = -1;
 
-- 
2.50.0.rc0.604.gd4ff7b7c86-goog





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux