]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
KVM: PPC: E500: Fix clear_tlb_refs
authorAlexander Graf <agraf@suse.de>
Thu, 2 Aug 2012 11:38:49 +0000 (13:38 +0200)
committerAlexander Graf <agraf@suse.de>
Mon, 24 Sep 2012 12:50:21 +0000 (14:50 +0200)
Our mapping code assumes that TLB0 entries are always mapped. However, after
calling clear_tlb_refs() this is no longer the case.

Map them dynamically if we find an entry unmapped in TLB0.

Signed-off-by: Alexander Graf <agraf@suse.de>
arch/powerpc/kvm/e500_tlb.c

index ff38b664195d6dcac44f1e24b6e15c6a431abd7b..b56b6e14df6c0dcc92df29b4e4058177a81ab654 100644 (file)
@@ -1039,8 +1039,12 @@ void kvmppc_mmu_map(struct kvm_vcpu *vcpu, u64 eaddr, gpa_t gpaddr,
                sesel = 0; /* unused */
                priv = &vcpu_e500->gtlb_priv[tlbsel][esel];
 
-               kvmppc_e500_setup_stlbe(vcpu, gtlbe, BOOK3E_PAGESZ_4K,
-                                       &priv->ref, eaddr, &stlbe);
+               /* Only triggers after clear_tlb_refs */
+               if (unlikely(!(priv->ref.flags & E500_TLB_VALID)))
+                       kvmppc_e500_tlb0_map(vcpu_e500, esel, &stlbe);
+               else
+                       kvmppc_e500_setup_stlbe(vcpu, gtlbe, BOOK3E_PAGESZ_4K,
+                                               &priv->ref, eaddr, &stlbe);
                break;
 
        case 1: {