EPT can technically be supported without INVEPT(SINGLE_CONTEXT), skip the EPT tests if SINGLE_CONTEXT isn't supported as it's heavily used (without the result being checked, yay). Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx> --- x86/vmx.h | 8 ++++++++ x86/vmx_tests.c | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/x86/vmx.h b/x86/vmx.h index dd869c2..472b28a 100644 --- a/x86/vmx.h +++ b/x86/vmx.h @@ -725,6 +725,14 @@ extern union vmx_ctrl_msr ctrl_exit_rev; extern union vmx_ctrl_msr ctrl_enter_rev; extern union vmx_ept_vpid ept_vpid; +static inline bool is_invept_type_supported(u64 type) +{ + if (type < INVEPT_SINGLE || type > INVEPT_GLOBAL) + return false; + + return ept_vpid.val & (EPT_CAP_INVEPT_SINGLE << (type - INVEPT_SINGLE)); +} + extern u64 *bsp_vmxon_region; extern bool launched; diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c index 97fa8ce..cbf22e3 100644 --- a/x86/vmx_tests.c +++ b/x86/vmx_tests.c @@ -1148,8 +1148,13 @@ static int ept_init_common(bool have_ad) int ret; struct pci_dev pcidev; + /* INVEPT is required by the EPT violation handler. */ + if (!is_invept_type_supported(INVEPT_SINGLE)) + return VMX_TEST_EXIT; + if (setup_ept(have_ad)) return VMX_TEST_EXIT; + data_page1 = alloc_page(); data_page2 = alloc_page(); *((u32 *)data_page1) = MAGIC_VAL_1; -- 2.34.0.rc2.393.gf8c9666880-goog