[kvm-unit-tests PATCH 2/5] x86: nVMX: Pre-check EPT requirement for unrestricted guest

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

 



...and abort the test if configuring a dummy EPT fails now that all
users pre-check EPT support.  There are additional checks in the common
EPT setup code, e.g. for EPT memtype compatibility, but the checks in
question should never fail because they query capabilities that KVM
always bundles with EPT, hence the abort.

Cc: Marc Orr <marcorr@xxxxxxxxxx>
Signed-off-by: Sean Christopherson <sean.j.christopherson@xxxxxxxxx>
---
 x86/vmx_tests.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index 66fde33..bd17088 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -1063,19 +1063,20 @@ static int setup_ept(bool enable_ad)
 	return 0;
 }
 
-static int enable_ept(void)
+static void enable_ept(void)
 {
-	return setup_eptp(0, false);
+	if (setup_eptp(0, false))
+		report_abort("EPT setup unexpectedly failed");
 }
 
 static int enable_unrestricted_guest(void)
 {
 	if (!(ctrl_cpu_rev[0].clr & CPU_SECONDARY) ||
-	    !(ctrl_cpu_rev[1].clr & CPU_URG))
+	    !(ctrl_cpu_rev[1].clr & CPU_URG) ||
+	    !(ctrl_cpu_rev[1].clr & CPU_EPT))
 		return 1;
 
-	if (enable_ept())
-		return 1;
+	enable_ept();
 
 	vmcs_write(CPU_EXEC_CTRL0, vmcs_read(CPU_EXEC_CTRL0) | CPU_SECONDARY);
 	vmcs_write(CPU_EXEC_CTRL1, vmcs_read(CPU_EXEC_CTRL1) | CPU_URG);
-- 
2.20.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