kvm: arm/arm64: Fix stage2_flush_memslot for 4 level page table
authorSuzuki K Poulose <suzuki.poulose@arm.com>
Wed, 26 Sep 2018 16:32:37 +0000 (17:32 +0100)
committerMarc Zyngier <marc.zyngier@arm.com>
Mon, 1 Oct 2018 12:08:41 +0000 (13:08 +0100)
So far we have only supported 3 level page table with fixed IPA of
40bits, where PUD is folded. With 4 level page tables, we need
to check if the PUD entry is valid or not. Fix stage2_flush_memslot()
to do this check, before walking down the table.

Acked-by: Christoffer Dall <cdall@kernel.org>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
virt/kvm/arm/mmu.c

index ed162a6c57c597d89a7f08600b84a4425feb0b13..ee7ce8fa4a12c6cea7b41588a43fcc82f8f05427 100644 (file)
@@ -412,7 +412,8 @@ static void stage2_flush_memslot(struct kvm *kvm,
        pgd = kvm->arch.pgd + stage2_pgd_index(addr);
        do {
                next = stage2_pgd_addr_end(addr, end);
-               stage2_flush_puds(kvm, pgd, addr, next);
+               if (!stage2_pgd_none(*pgd))
+                       stage2_flush_puds(kvm, pgd, addr, next);
        } while (pgd++, addr = next, addr != end);
 }