aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/mmu.c
diff options
context:
space:
mode:
authorXiao Guangrong <xiaoguangrong@cn.fujitsu.com>2011-07-11 15:21:17 -0400
committerAvi Kivity <avi@redhat.com>2011-07-24 04:50:23 -0400
commit052331bea38dfc176322ec85642eb98d6803a762 (patch)
treeade0a6bf8c594b7bd516f76aa996711889b66384 /arch/x86/kvm/mmu.c
parentd910f5c1064d7ff09c31b0191564f9f99e210f91 (diff)
KVM: MMU: fix walking shadow page table
Properly check the last mapping, and do not walk to the next level if last spte is met Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/mmu.c')
-rw-r--r--arch/x86/kvm/mmu.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index da0f3b081076..03323dc705c2 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -1517,10 +1517,6 @@ static bool shadow_walk_okay(struct kvm_shadow_walk_iterator *iterator)
1517 if (iterator->level < PT_PAGE_TABLE_LEVEL) 1517 if (iterator->level < PT_PAGE_TABLE_LEVEL)
1518 return false; 1518 return false;
1519 1519
1520 if (iterator->level == PT_PAGE_TABLE_LEVEL)
1521 if (is_large_pte(*iterator->sptep))
1522 return false;
1523
1524 iterator->index = SHADOW_PT_INDEX(iterator->addr, iterator->level); 1520 iterator->index = SHADOW_PT_INDEX(iterator->addr, iterator->level);
1525 iterator->sptep = ((u64 *)__va(iterator->shadow_addr)) + iterator->index; 1521 iterator->sptep = ((u64 *)__va(iterator->shadow_addr)) + iterator->index;
1526 return true; 1522 return true;
@@ -1528,6 +1524,11 @@ static bool shadow_walk_okay(struct kvm_shadow_walk_iterator *iterator)
1528 1524
1529static void shadow_walk_next(struct kvm_shadow_walk_iterator *iterator) 1525static void shadow_walk_next(struct kvm_shadow_walk_iterator *iterator)
1530{ 1526{
1527 if (is_last_spte(*iterator->sptep, iterator->level)) {
1528 iterator->level = 0;
1529 return;
1530 }
1531
1531 iterator->shadow_addr = *iterator->sptep & PT64_BASE_ADDR_MASK; 1532 iterator->shadow_addr = *iterator->sptep & PT64_BASE_ADDR_MASK;
1532 --iterator->level; 1533 --iterator->level;
1533} 1534}