aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/mmu.c
diff options
context:
space:
mode:
authorSheng Yang <sheng@linux.intel.com>2010-01-05 06:02:29 -0500
committerMarcelo Tosatti <mtosatti@redhat.com>2010-03-01 10:35:46 -0500
commit878403b788bff1af9c7f1a61e104f0c77115af29 (patch)
treead25143de372db159aec0734e049050f2b72b128 /arch/x86/kvm/mmu.c
parent17cc393596823f4bbab81e68a9e23e7beadbcfca (diff)
KVM: VMX: Enable EPT 1GB page support
Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/mmu.c')
-rw-r--r--arch/x86/kvm/mmu.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 12ccf14f8539..4f5508c35100 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -500,8 +500,7 @@ out:
500static int mapping_level(struct kvm_vcpu *vcpu, gfn_t large_gfn) 500static int mapping_level(struct kvm_vcpu *vcpu, gfn_t large_gfn)
501{ 501{
502 struct kvm_memory_slot *slot; 502 struct kvm_memory_slot *slot;
503 int host_level; 503 int host_level, level, max_level;
504 int level = PT_PAGE_TABLE_LEVEL;
505 504
506 slot = gfn_to_memslot(vcpu->kvm, large_gfn); 505 slot = gfn_to_memslot(vcpu->kvm, large_gfn);
507 if (slot && slot->dirty_bitmap) 506 if (slot && slot->dirty_bitmap)
@@ -512,7 +511,10 @@ static int mapping_level(struct kvm_vcpu *vcpu, gfn_t large_gfn)
512 if (host_level == PT_PAGE_TABLE_LEVEL) 511 if (host_level == PT_PAGE_TABLE_LEVEL)
513 return host_level; 512 return host_level;
514 513
515 for (level = PT_DIRECTORY_LEVEL; level <= host_level; ++level) 514 max_level = kvm_x86_ops->get_lpage_level() < host_level ?
515 kvm_x86_ops->get_lpage_level() : host_level;
516
517 for (level = PT_DIRECTORY_LEVEL; level <= max_level; ++level)
516 if (has_wrprotected_page(vcpu->kvm, large_gfn, level)) 518 if (has_wrprotected_page(vcpu->kvm, large_gfn, level))
517 break; 519 break;
518 520