From: Peter Feiner <pfeiner@xxxxxxxxxx> Signed-off-by: Peter Feiner <pfeiner@xxxxxxxxxx> Signed-off-by: David Matlack <dmatlack@xxxxxxxxxx> --- x86/vmx_tests.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c index 5758b6becfa6..be01709d3057 100644 --- a/x86/vmx_tests.c +++ b/x86/vmx_tests.c @@ -940,12 +940,20 @@ static int insn_intercept_exit_handler() } +/* Enables EPT and sets up the identity map. */ static int setup_ept(bool enable_ad) { int support_2m; unsigned long end_of_memory; u32 ctrl_cpu[2]; + if (!(ctrl_cpu_rev[0].clr & CPU_SECONDARY) || + !(ctrl_cpu_rev[1].clr & CPU_EPT)) { + printf("\tEPT is not supported"); + return 1; + } + + if (!(ept_vpid.val & EPT_CAP_UC) && !(ept_vpid.val & EPT_CAP_WB)) { printf("\tEPT paging-structure memory type " @@ -992,12 +1000,6 @@ static int apic_version; static int ept_init_common(bool have_ad) { - if (!(ctrl_cpu_rev[0].clr & CPU_SECONDARY) || - !(ctrl_cpu_rev[1].clr & CPU_EPT)) { - printf("\tEPT is not supported"); - return VMX_TEST_EXIT; - } - if (setup_ept(have_ad)) return VMX_TEST_EXIT; data_page1 = alloc_page(); -- 2.12.2.816.g2cccc81164-goog