[PATCH kvm-unit-tests] vmx: do not XFAIL for virtual-APIC address beyond RAM

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

 



We will allow this behavior for KVM in some specific cases
(CR8 load/store exits enabled, virtualize APIC accesses
disabled).  Ensure these specific values of the controls
are there in the VMCS, and remove the XFAIL.

Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
---
 x86/vmx_tests.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index ab7e8cc..0ca5363 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -3669,9 +3669,17 @@ static void test_msr_bitmap(void)
  */
 static void test_apic_virt_addr(void)
 {
+	/*
+	 * Ensure the processor will never use the virtual-APIC page, since
+	 * we will point it to invalid RAM.  Otherwise KVM is puzzled about
+	 * what we're trying to achieve and fails vmentry.
+	 */
+	u32 cpu_ctrls0 = vmcs_read(CPU_EXEC_CTRL0);
+	vmcs_write(CPU_EXEC_CTRL0, cpu_ctrls0 | CPU_CR8_LOAD | CPU_CR8_STORE);
 	test_vmcs_addr_reference(CPU_TPR_SHADOW, APIC_VIRT_ADDR,
 				 "virtual-APIC address", "Use TPR shadow",
-				 PAGE_SIZE, true, true);
+				 PAGE_SIZE, false, true);
+	vmcs_write(CPU_EXEC_CTRL0, cpu_ctrls0);
 }
 
 /*
-- 
1.8.3.1




[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