[kvm-unit-tests PATCH 4/4] Test of virtual-APIC address

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

 



This test checks that a nested VM-entry fails if the "use TPR shadow"
VM-execution control is set and the virtual-APIC address is illegal. A
legal virtual-apic address is 4k-aligned and within the physical
address space supported by the processor.

Signed-off-by: Jim Mattson <jmattson@xxxxxxxxxx>
---
 x86/vmx_tests.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index 22295e8..32aa35a 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -3438,6 +3438,20 @@ static void test_msr_bitmap(void)
 				 "MSR bitmap", "Use MSR bitmaps");
 }
 
+/*
+ * If the "use TPR shadow" VM-execution control is 1, the virtual-APIC
+ * address must satisfy the following checks:
+ * - Bits 11:0 of the address must be 0.
+ * - The address should not set any bits beyond the processor's
+ *   physical-address width.
+ * [Intel SDM]
+ */
+static void test_apic_virt_addr(void)
+{
+	test_vmcs_page_reference(CPU_TPR_SHADOW, APIC_VIRT_ADDR,
+				 "virtual-APIC address", "Use TPR shadow");
+}
+
 static void vmx_controls_test(void)
 {
 	/*
@@ -3453,6 +3467,7 @@ static void vmx_controls_test(void)
 	test_cr3_targets();
 	test_io_bitmaps();
 	test_msr_bitmap();
+	test_apic_virt_addr();
 }
 
 static bool valid_vmcs_for_vmentry(void)
-- 
2.14.1.342.g6490525c54-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