public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH] x86: Fix max VMCS field encoding index check
@ 2019-05-18 16:37 Nadav Amit
  2019-05-20 14:51 ` Paolo Bonzini
  2019-12-12 22:59 ` Jim Mattson
  0 siblings, 2 replies; 7+ messages in thread
From: Nadav Amit @ 2019-05-18 16:37 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kvm, Nadav Amit, Sean Christopherson

The test that checks the maximum VMCS field encoding does not probe all
possible VMCS fields. As a result it might fail since the actual
IA32_VMX_VMCS_ENUM.MAX_INDEX would be higher than the expected value.

Change the test to check that the maximum of the supported probed
VMCS fields is lower/equal than the actual reported
IA32_VMX_VMCS_ENUM.MAX_INDEX.

This test might still fail on bare-metal due to errata (e.g., BDX30).

Cc: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Nadav Amit <nadav.amit@gmail.com>
---
 x86/vmx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/x86/vmx.c b/x86/vmx.c
index 962ec0f..f540e15 100644
--- a/x86/vmx.c
+++ b/x86/vmx.c
@@ -361,8 +361,8 @@ static void test_vmwrite_vmread(void)
 	report("VMWRITE/VMREAD", __check_all_vmcs_fields(0x42, &max_index));
 
 	vmcs_enum_max = rdmsr(MSR_IA32_VMX_VMCS_ENUM) & VMCS_FIELD_INDEX_MASK;
-	report("VMX_VMCS_ENUM.MAX_INDEX expected: %x, actual: %x",
-		vmcs_enum_max == max_index, max_index, vmcs_enum_max);
+	report("VMX_VMCS_ENUM.MAX_INDEX expected at least: %x, actual: %x",
+		vmcs_enum_max >= max_index, max_index, vmcs_enum_max);
 
 	assert(!vmcs_clear(vmcs));
 	free_page(vmcs);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-12-19  8:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-18 16:37 [kvm-unit-tests PATCH] x86: Fix max VMCS field encoding index check Nadav Amit
2019-05-20 14:51 ` Paolo Bonzini
2019-12-12 22:59 ` Jim Mattson
2019-12-13  9:13   ` Nadav Amit
2019-12-13 17:30     ` Jim Mattson
2019-12-18  0:24       ` Sean Christopherson
2019-12-19  8:52         ` Nadav Amit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox