diff mbox series

[kvm-unit-test,v2,3/4] KVM nVMX: test_vmcs_page_values() needs to accept a bit range

Message ID 20181212010437.11129-4-krish.sadhukhan@oracle.com (mailing list archive)
State New, archived
Headers show
Series [kvm-unit-test,v2,1/4] KVM nVMX: Change the names of the functions test_vmcs_page_* to test_vmcs_addr_* | expand

Commit Message

Krish Sadhukhan Dec. 12, 2018, 1:04 a.m. UTC
... because various addresses need to be tested for various bit ranges.

Signed-off-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
Reviewed-by: Mihai Carabas <mihai.carabas@oracle.com>
---
 x86/vmx_tests.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index 3e6babe..b56f870 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -3487,12 +3487,12 @@  static void test_vmcs_addr_values(const char *name,
 				  enum Encoding encoding,
 				  bool ignored,
 				  bool xfail_beyond_mapped_ram,
-				  u64 align)
+				  u64 align, u32 addr_start, u32 addr_end)
 {
 	unsigned i;
 	u64 orig_val = vmcs_read(encoding);
 
-	for (i = 0; i < 64; i++)
+	for (i = addr_start; i < addr_end; i++)
 		test_vmcs_addr(name, encoding, ignored,
 			       xfail_beyond_mapped_ram, 1ul << i, align);
 
@@ -3541,8 +3541,9 @@  static void test_vmcs_addr_reference(u32 control_bit, enum Encoding field,
 		vmcs_write(CPU_EXEC_CTRL0, primary | CPU_SECONDARY);
 		vmcs_write(CPU_EXEC_CTRL1, secondary | control_bit);
 	}
+
 	test_vmcs_addr_values(field_name, field, false,
-			      xfail_beyond_mapped_ram, align);
+			      xfail_beyond_mapped_ram, align, 0, 64);
 	report_prefix_pop();
 
 	report_prefix_pushf("%s disabled", control_name);
@@ -3552,7 +3553,9 @@  static void test_vmcs_addr_reference(u32 control_bit, enum Encoding field,
 		vmcs_write(CPU_EXEC_CTRL0, primary & ~CPU_SECONDARY);
 		vmcs_write(CPU_EXEC_CTRL1, secondary & ~control_bit);
 	}
-	test_vmcs_addr_values(field_name, field, true, false, align);
+
+	test_vmcs_addr_values(field_name, field, true, false, align,
+			      0, 64);
 	report_prefix_pop();
 
 	vmcs_write(field, page_addr);
@@ -3907,7 +3910,7 @@  static void test_posted_intr(void)
 	test_pi_desc_addr(0xc000, true);
 
 	test_vmcs_addr_values("process-posted interrupts",
-	    POSTED_INTR_DESC_ADDR, false, false);
+	    POSTED_INTR_DESC_ADDR, false, false, PAGE_SIZE, 0, 64);
 
 	vmcs_write(CPU_EXEC_CTRL0, saved_primary);
 	vmcs_write(CPU_EXEC_CTRL1, saved_secondary);