Skip to content

Commit

Permalink
KVM: VMX: Enforce EPT pagetable level checking
Browse files Browse the repository at this point in the history
We only support 4 levels EPT pagetable now.

Signed-off-by: Sheng Yang <[email protected]>
Signed-off-by: Marcelo Tosatti <[email protected]>
  • Loading branch information
Sheng Yang authored and avikivity committed Aug 1, 2010
1 parent d2d7a61 commit 4bc9b98
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion arch/x86/kvm/vmx.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,11 @@ static inline bool cpu_has_vmx_ept_1g_page(void)
return vmx_capability.ept & VMX_EPT_1GB_PAGE_BIT;
}

static inline bool cpu_has_vmx_ept_4levels(void)
{
return vmx_capability.ept & VMX_EPT_PAGE_WALK_4_BIT;
}

static inline bool cpu_has_vmx_invept_individual_addr(void)
{
return vmx_capability.ept & VMX_EPT_EXTENT_INDIVIDUAL_BIT;
Expand Down Expand Up @@ -1568,7 +1573,8 @@ static __init int hardware_setup(void)
if (!cpu_has_vmx_vpid())
enable_vpid = 0;

if (!cpu_has_vmx_ept()) {
if (!cpu_has_vmx_ept() ||
!cpu_has_vmx_ept_4levels()) {
enable_ept = 0;
enable_unrestricted_guest = 0;
}
Expand Down

0 comments on commit 4bc9b98

Please sign in to comment.