nVMX: Use helpers to check for WB memtype and 4-level EPT support
Use is_ept_memtype_supported() and is_4_level_ept_supported() to check for
basic EPT support instead of open coding checks on ept_vpid.val.
Opportunstically add a report() failure if 4-level EPT isn't supported, as
support for 4-level paging is mandatory in any sane configuration.
Link: https://lore.kernel.org/r/20230911182013.333559-2-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index 97b8e72..c4d5c5f 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -1039,11 +1039,14 @@
printf("\tEPT is not supported\n");
return 1;
}
- if (!(ept_vpid.val & EPT_CAP_WB)) {
+ if (!is_ept_memtype_supported(EPT_MEM_TYPE_WB)) {
printf("\tWB memtype for EPT walks not supported\n");
return 1;
}
- if (!(ept_vpid.val & EPT_CAP_PWL4)) {
+
+ if (!is_4_level_ept_supported()) {
+ /* Support for 4-level EPT is mandatory. */
+ report(false, "4-level EPT support check");
printf("\tPWL4 is not supported\n");
return 1;
}