summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/vmx/capabilities.h
diff options
context:
space:
mode:
authorLai Jiangshan <laijs@linux.alibaba.com>2021-11-24 13:20:49 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2021-12-08 10:25:12 +0100
commitcc022ae144c1ce318643f821461295337280a1c0 (patch)
tree05c3dbf3e3d7c6a032743cd9c7b581181a159dfa /arch/x86/kvm/vmx/capabilities.h
parentKVM: X86: Add huge_page_level to __reset_rsvds_bits_mask_ept() (diff)
downloadlinux-cc022ae144c1ce318643f821461295337280a1c0.tar.xz
linux-cc022ae144c1ce318643f821461295337280a1c0.zip
KVM: X86: Add parameter huge_page_level to kvm_init_shadow_ept_mmu()
The level of supported large page on nEPT affects the rsvds_bits_mask. Signed-off-by: Lai Jiangshan <laijs@linux.alibaba.com> Message-Id: <20211124122055.64424-8-jiangshanlai@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx/capabilities.h')
-rw-r--r--arch/x86/kvm/vmx/capabilities.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/x86/kvm/vmx/capabilities.h b/arch/x86/kvm/vmx/capabilities.h
index 4705ad55abb5..c8029b7845b6 100644
--- a/arch/x86/kvm/vmx/capabilities.h
+++ b/arch/x86/kvm/vmx/capabilities.h
@@ -312,6 +312,15 @@ static inline bool cpu_has_vmx_ept_1g_page(void)
return vmx_capability.ept & VMX_EPT_1GB_PAGE_BIT;
}
+static inline int ept_caps_to_lpage_level(u32 ept_caps)
+{
+ if (ept_caps & VMX_EPT_1GB_PAGE_BIT)
+ return PG_LEVEL_1G;
+ if (ept_caps & VMX_EPT_2MB_PAGE_BIT)
+ return PG_LEVEL_2M;
+ return PG_LEVEL_4K;
+}
+
static inline bool cpu_has_vmx_ept_ad_bits(void)
{
return vmx_capability.ept & VMX_EPT_AD_BIT;