]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Revert "KVM: MIPS: Drop other CPU ASIDs on guest MMU changes"
authorJiri Slaby <jslaby@suse.cz>
Wed, 9 Nov 2016 21:15:57 +0000 (22:15 +0100)
committerJiri Slaby <jslaby@suse.cz>
Wed, 9 Nov 2016 21:29:24 +0000 (22:29 +0100)
This reverts commit 168e5ebbd63eaf2557b5e37be1afb8c143de2380, which is
upstream commit 91e4f1b6073dd680d86cdb7e42d7cccca9db39d8. It caused
build failures as it was improperly backported. New version is
approaching, so revert this bad one.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: James Hogan <james.hogan@imgtec.com>
arch/mips/kvm/kvm_mips_emul.c

index 8ab9958767bb533304c73555580157f3b3761735..9f7643874fbad859d556fec6896b8142ffa273eb 100644 (file)
@@ -310,47 +310,6 @@ enum emulation_result kvm_mips_emul_tlbr(struct kvm_vcpu *vcpu)
        return er;
 }
 
-/**
- * kvm_mips_invalidate_guest_tlb() - Indicates a change in guest MMU map.
- * @vcpu:      VCPU with changed mappings.
- * @tlb:       TLB entry being removed.
- *
- * This is called to indicate a single change in guest MMU mappings, so that we
- * can arrange TLB flushes on this and other CPUs.
- */
-static void kvm_mips_invalidate_guest_tlb(struct kvm_vcpu *vcpu,
-                                         struct kvm_mips_tlb *tlb)
-{
-       int cpu, i;
-       bool user;
-
-       /* No need to flush for entries which are already invalid */
-       if (!((tlb->tlb_lo[0] | tlb->tlb_lo[1]) & ENTRYLO_V))
-               return;
-       /* User address space doesn't need flushing for KSeg2/3 changes */
-       user = tlb->tlb_hi < KVM_GUEST_KSEG0;
-
-       preempt_disable();
-
-       /*
-        * Probe the shadow host TLB for the entry being overwritten, if one
-        * matches, invalidate it
-        */
-       kvm_mips_host_tlb_inv(vcpu, tlb->tlb_hi);
-
-       /* Invalidate the whole ASID on other CPUs */
-       cpu = smp_processor_id();
-       for_each_possible_cpu(i) {
-               if (i == cpu)
-                       continue;
-               if (user)
-                       vcpu->arch.guest_user_asid[i] = 0;
-               vcpu->arch.guest_kernel_asid[i] = 0;
-       }
-
-       preempt_enable();
-}
-
 /* Write Guest TLB Entry @ Index */
 enum emulation_result kvm_mips_emul_tlbwi(struct kvm_vcpu *vcpu)
 {
@@ -373,8 +332,8 @@ enum emulation_result kvm_mips_emul_tlbwi(struct kvm_vcpu *vcpu)
 
        tlb = &vcpu->arch.guest_tlb[index];
 #if 1
-
-       kvm_mips_invalidate_guest_tlb(vcpu, tlb);
+       /* Probe the shadow host TLB for the entry being overwritten, if one matches, invalidate it */
+       kvm_mips_host_tlb_inv(vcpu, tlb->tlb_hi);
 #endif
 
        tlb->tlb_mask = kvm_read_c0_guest_pagemask(cop0);
@@ -415,7 +374,8 @@ enum emulation_result kvm_mips_emul_tlbwr(struct kvm_vcpu *vcpu)
        tlb = &vcpu->arch.guest_tlb[index];
 
 #if 1
-       kvm_mips_invalidate_guest_tlb(vcpu, tlb);
+       /* Probe the shadow host TLB for the entry being overwritten, if one matches, invalidate it */
+       kvm_mips_host_tlb_inv(vcpu, tlb->tlb_hi);
 #endif
 
        tlb->tlb_mask = kvm_read_c0_guest_pagemask(cop0);
@@ -459,7 +419,6 @@ kvm_mips_emulate_CP0(uint32_t inst, uint32_t *opc, uint32_t cause,
        int32_t rt, rd, copz, sel, co_bit, op;
        uint32_t pc = vcpu->arch.pc;
        unsigned long curr_pc;
-       int cpu, i;
 
        /*
         * Update PC and hold onto current PC in case there is
@@ -579,16 +538,8 @@ kvm_mips_emulate_CP0(uint32_t inst, uint32_t *opc, uint32_t cause,
                                             ASID_MASK,
                                             vcpu->arch.gprs[rt] & ASID_MASK);
 
-                                       preempt_disable();
                                        /* Blow away the shadow host TLBs */
                                        kvm_mips_flush_host_tlb(1);
-                                       cpu = smp_processor_id();
-                                       for_each_possible_cpu(i)
-                                               if (i != cpu) {
-                                                       vcpu->arch.guest_user_asid[i] = 0;
-                                                       vcpu->arch.guest_kernel_asid[i] = 0;
-                                               }
-                                       preempt_enable();
                                }
                                kvm_write_c0_guest_entryhi(cop0,
                                                           vcpu->arch.gprs[rt]);