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

Message ID 20181213182356.29124-4-krish.sadhukhan@oracle.com
State New
Headers show
Series
  • [kvm-unit-test,v3,1/4] KVM nVMX: Change the names of the functions test_vmcs_page_* to test_vmcs_addr_*
Related show

Commit Message

Krish Sadhukhan Dec. 13, 2018, 6:23 p.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(-)

Comments

Jim Mattson Dec. 13, 2018, 8:51 p.m. UTC | #1
On Thu, Dec 13, 2018 at 10:48 AM Krish Sadhukhan
<krish.sadhukhan@oracle.com> wrote:
>
>  ... 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>
Reviewed-by: Jim Mattson <jmattson@google.com>

Patch
diff mbox series

diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index e5cdb4b..88d815a 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -3487,12 +3487,13 @@  static void test_vmcs_addr_values(const char *name,
 				  enum Encoding encoding,
 				  u64 align,
 				  bool ignored,
-				  bool xfail_beyond_mapped_ram)
+				  bool xfail_beyond_mapped_ram,
+				  u32 bit_start, u32 bit_end)
 {
 	unsigned i;
 	u64 orig_val = vmcs_read(encoding);
 
-	for (i = 0; i < 64; i++)
+	for (i = bit_start; i <= bit_end; i++)
 		test_vmcs_addr(name, encoding, align, ignored,
 			       xfail_beyond_mapped_ram, 1ul << i);
 
@@ -3540,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, align, false,
-			      xfail_beyond_mapped_ram);
+			      xfail_beyond_mapped_ram, 0, 63);
 	report_prefix_pop();
 
 	report_prefix_pushf("%s disabled", control_name);
@@ -3551,7 +3553,8 @@  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, align, true, false);
+
+	test_vmcs_addr_values(field_name, field, align, true, false, 0, 63);
 	report_prefix_pop();
 
 	vmcs_write(field, page_addr);
@@ -3907,7 +3910,7 @@  static void test_posted_intr(void)
 
 	test_vmcs_addr_values("process-posted interrupts",
 			       POSTED_INTR_DESC_ADDR, PAGE_SIZE,
-			       false, false);
+			       false, false, 0, 63);
 
 	vmcs_write(CPU_EXEC_CTRL0, saved_primary);
 	vmcs_write(CPU_EXEC_CTRL1, saved_secondary);