[PATCH kvm-unit-tests 1/4] x86: vmx: restore primary controls in test_tpr_threshold early return

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

 



test_tpr_threshold() could theoretically leave CPU_TPR_SHADOW set in
its early return path when none of the secondary controls needed for
the remaining tests are supported.

Fix the prefix for the TPR-enabled, sec_exec-disabled case.

Signed-off-by: Sean Christopherson <sean.j.christopherson@xxxxxxxxx>
---
 x86/vmx_tests.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index 6c73041..ab6e089 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -4085,13 +4085,15 @@ static void test_tpr_threshold(void)
 	test_tpr_threshold_values();
 	report_prefix_pop();
 	vmcs_write(CPU_EXEC_CTRL0, vmcs_read(CPU_EXEC_CTRL0) | CPU_TPR_SHADOW);
-	report_prefix_pushf("Use TPR shadow enabled");
+	report_prefix_pushf("Use TPR shadow enabled, secondary controls disabled");
 	test_tpr_threshold_values();
 	report_prefix_pop();
 
 	if (!((ctrl_cpu_rev[0].clr & CPU_SECONDARY) &&
-	    (ctrl_cpu_rev[1].clr & (CPU_VINTD  | CPU_VIRT_APIC_ACCESSES))))
+	    (ctrl_cpu_rev[1].clr & (CPU_VINTD  | CPU_VIRT_APIC_ACCESSES)))) {
+		vmcs_write(CPU_EXEC_CTRL0, primary);
 		return;
+	}
 
 	u32 secondary = vmcs_read(CPU_EXEC_CTRL1);
 
-- 
2.18.0




[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