Use the enable_unrestricted_guest() helper to enable URG and bail if it URG isn't supported. EPT is also required for URG, but EPT can be enabled independent of URG, and some hardware support EPT but not URG, e.g. NHM. Fixes: f441716 ("nVMX: Test vmentry of unrestricted (PG=0/PE=1) nested guest") Cc: Krish Sadhukhan <krish.sadhukhan@xxxxxxxxxx> Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx> --- x86/vmx_tests.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c index cf42619..35463b6 100644 --- a/x86/vmx_tests.c +++ b/x86/vmx_tests.c @@ -8266,12 +8266,14 @@ static void unsetup_unrestricted_guest(void) */ static void vmentry_unrestricted_guest_test(void) { + if (enable_unrestricted_guest(true)) { + report_skip("Unrestricted guest not supported"); + return; + } + test_set_guest(unrestricted_guest_main); setup_unrestricted_guest(); - if (setup_ept(false)) - test_skip("EPT not supported"); - vmcs_write(CPU_EXEC_CTRL1, vmcs_read(CPU_EXEC_CTRL1) | CPU_URG); - test_guest_state("Unrestricted guest test", false, CPU_URG, "CPU_URG"); + test_guest_state("Unrestricted guest test", false, CPU_URG, "CPU_URG"); /* * Let the guest finish execution as a regular guest -- 2.30.0.478.g8a0d178c01-goog