@@ -1164,36 +1164,6 @@ void set_ept_pte(unsigned long *pml4, unsigned long guest_addr,
pt[offset] = pte_val;
}
-bool ept_2m_supported(void)
-{
- return ept_vpid.val & EPT_CAP_2M_PAGE;
-}
-
-bool ept_1g_supported(void)
-{
- return ept_vpid.val & EPT_CAP_1G_PAGE;
-}
-
-bool ept_huge_pages_supported(int level)
-{
- if (level == 2)
- return ept_2m_supported();
- else if (level == 3)
- return ept_1g_supported();
- else
- return false;
-}
-
-bool ept_execute_only_supported(void)
-{
- return ept_vpid.val & EPT_CAP_WT;
-}
-
-bool ept_ad_bits_supported(void)
-{
- return ept_vpid.val & EPT_CAP_AD_FLAG;
-}
-
void vpid_sync(int type, u16 vpid)
{
switch(type) {
@@ -785,6 +785,36 @@ 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 ept_2m_supported(void)
+{
+ return ept_vpid.val & EPT_CAP_2M_PAGE;
+}
+
+static inline bool ept_1g_supported(void)
+{
+ return ept_vpid.val & EPT_CAP_1G_PAGE;
+}
+
+static inline bool ept_huge_pages_supported(int level)
+{
+ if (level == 2)
+ return ept_2m_supported();
+ else if (level == 3)
+ return ept_1g_supported();
+ else
+ return false;
+}
+
+static inline bool ept_execute_only_supported(void)
+{
+ return ept_vpid.val & EPT_CAP_WT;
+}
+
+static inline bool ept_ad_bits_supported(void)
+{
+ return ept_vpid.val & EPT_CAP_AD_FLAG;
+}
+
static inline bool is_invept_type_supported(u64 type)
{
if (type < INVEPT_SINGLE || type > INVEPT_GLOBAL)
@@ -975,12 +1005,6 @@ void check_ept_ad(unsigned long *pml4, u64 guest_cr3,
void clear_ept_ad(unsigned long *pml4, u64 guest_cr3,
unsigned long guest_addr);
-bool ept_2m_supported(void);
-bool ept_1g_supported(void);
-bool ept_huge_pages_supported(int level);
-bool ept_execute_only_supported(void);
-bool ept_ad_bits_supported(void);
-
#define ABORT_ON_EARLY_VMENTRY_FAIL 0x1
#define ABORT_ON_INVALID_GUEST_STATE 0x2
Move the EPT capability helpers to vmx.h, ept_vpid is available and there's no reason to hide the trivial implementations. Signed-off-by: Sean Christopherson <seanjc@google.com> --- x86/vmx.c | 30 ------------------------------ x86/vmx.h | 36 ++++++++++++++++++++++++++++++------ 2 files changed, 30 insertions(+), 36 deletions(-)