diff options
author | Sheng Yang <sheng@linux.intel.com> | 2010-06-02 02:05:24 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-08-01 03:39:25 -0400 |
commit | 4bc9b9828150747386130ab172f7e868e1a0fc2a (patch) | |
tree | 1d0bdff256c67255fa4e80c29e8c001e434f3ad9 /arch/x86/kvm/vmx.c | |
parent | d2d7a61127ced8ce9ec7666991aad1d846932212 (diff) |
KVM: VMX: Enforce EPT pagetable level checking
We only support 4 levels EPT pagetable now.
Signed-off-by: Sheng Yang <sheng@linux.intel.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r-- | arch/x86/kvm/vmx.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 8c9085d44c37..2201e3816205 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -340,6 +340,11 @@ static inline bool cpu_has_vmx_ept_1g_page(void) | |||
340 | return vmx_capability.ept & VMX_EPT_1GB_PAGE_BIT; | 340 | return vmx_capability.ept & VMX_EPT_1GB_PAGE_BIT; |
341 | } | 341 | } |
342 | 342 | ||
343 | static inline bool cpu_has_vmx_ept_4levels(void) | ||
344 | { | ||
345 | return vmx_capability.ept & VMX_EPT_PAGE_WALK_4_BIT; | ||
346 | } | ||
347 | |||
343 | static inline bool cpu_has_vmx_invept_individual_addr(void) | 348 | static inline bool cpu_has_vmx_invept_individual_addr(void) |
344 | { | 349 | { |
345 | return vmx_capability.ept & VMX_EPT_EXTENT_INDIVIDUAL_BIT; | 350 | return vmx_capability.ept & VMX_EPT_EXTENT_INDIVIDUAL_BIT; |
@@ -1568,7 +1573,8 @@ static __init int hardware_setup(void) | |||
1568 | if (!cpu_has_vmx_vpid()) | 1573 | if (!cpu_has_vmx_vpid()) |
1569 | enable_vpid = 0; | 1574 | enable_vpid = 0; |
1570 | 1575 | ||
1571 | if (!cpu_has_vmx_ept()) { | 1576 | if (!cpu_has_vmx_ept() || |
1577 | !cpu_has_vmx_ept_4levels()) { | ||
1572 | enable_ept = 0; | 1578 | enable_ept = 0; |
1573 | enable_unrestricted_guest = 0; | 1579 | enable_unrestricted_guest = 0; |
1574 | } | 1580 | } |