Only flush TLB when a reset to the shadow mappings is needed. For guest tlbia, we can reset vcpu's mappings instead of a real flush. And because different vcpu maps to different IDs, no flush is needed at vcpu_put() and mmu_destroy(). Signed-off-by: Liu Yu <yu.liu@xxxxxxxxxxxxx> --- arch/powerpc/kvm/e500_tlb.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/kvm/e500_tlb.c b/arch/powerpc/kvm/e500_tlb.c index d090d97..570185c 100644 --- a/arch/powerpc/kvm/e500_tlb.c +++ b/arch/powerpc/kvm/e500_tlb.c @@ -109,6 +109,7 @@ unsigned int kvmppc_e500_get_sid(struct kvmppc_vcpu_e500 *vcpu_e500, sid = e500_id_create_mapping(&idm->id[as][gid]); if(sid <= 0) { BUG_ON(sid == 0); + _tlbil_all(); e500_id_destroy_all(); kvmppc_e500_update_spid(vcpu_e500); } @@ -229,7 +230,6 @@ void kvmppc_e500_tlb_load(struct kvm_vcpu *vcpu, int cpu) void kvmppc_e500_tlb_put(struct kvm_vcpu *vcpu) { - _tlbil_all(); } /* Search the guest TLB for a matching entry. */ @@ -412,7 +412,6 @@ void kvmppc_mmu_priv_switch(struct kvm_vcpu *vcpu, int usermode) struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu); if (usermode) { - _tlbil_all(); /* clear PID for guest kernel mapping */ vcpu->arch.swap_pid = 0; } else { @@ -458,7 +457,9 @@ int kvmppc_e500_emul_mt_mmucsr0(struct kvmppc_vcpu_e500 *vcpu_e500, ulong value) for (esel = 0; esel < vcpu_e500->guest_tlb_size[1]; esel++) kvmppc_e500_gtlbe_invalidate(vcpu_e500, 1, esel); - _tlbil_all(); + /* Reset vcpu shadow id mapping */ + kvmppc_e500_reset_idm(vcpu_e500->id_mapping); + kvmppc_e500_update_spid(vcpu_e500); return EMULATE_DONE; } @@ -489,7 +490,9 @@ int kvmppc_e500_emul_tlbivax(struct kvm_vcpu *vcpu, int ra, int rb) kvmppc_e500_gtlbe_invalidate(vcpu_e500, tlbsel, esel); } - _tlbil_all(); + /* Reset vcpu shadow id mapping */ + kvmppc_e500_reset_idm(vcpu_e500->id_mapping); + kvmppc_e500_update_spid(vcpu_e500); return EMULATE_DONE; } @@ -668,9 +671,6 @@ void kvmppc_mmu_destroy(struct kvm_vcpu *vcpu) for (stlbsel = 0; stlbsel < 2; stlbsel++) for (i = 0; i < vcpu_e500->guest_tlb_size[stlbsel]; i++) kvmppc_e500_shadow_release(vcpu_e500, stlbsel, i); - - /* discard all guest mapping */ - _tlbil_all(); } void kvmppc_mmu_map(struct kvm_vcpu *vcpu, u64 eaddr, gpa_t gpaddr, -- 1.5.4 -- To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html