KVM: MMU: make for_each_shadow_entry aware of largepages
authorMarcelo Tosatti <mtosatti@redhat.com>
Thu, 11 Jun 2009 15:07:41 +0000 (12:07 -0300)
committerAvi Kivity <avi@redhat.com>
Thu, 10 Sep 2009 05:32:55 +0000 (08:32 +0300)
This way there is no need to add explicit checks in every
for_each_shadow_entry user.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/mmu.c

index 780ce3f..e18f65b 100644 (file)
@@ -1302,6 +1302,11 @@ static bool shadow_walk_okay(struct kvm_shadow_walk_iterator *iterator)
 {
        if (iterator->level < PT_PAGE_TABLE_LEVEL)
                return false;
+
+       if (iterator->level == PT_PAGE_TABLE_LEVEL)
+               if (is_large_pte(*iterator->sptep))
+                       return false;
+
        iterator->index = SHADOW_PT_INDEX(iterator->addr, iterator->level);
        iterator->sptep = ((u64 *)__va(iterator->shadow_addr)) + iterator->index;
        return true;