MIPS: mm: Remove redundant drop_mmu_context() cpu argument
authorPaul Burton <paul.burton@mips.com>
Sat, 2 Feb 2019 01:43:16 +0000 (01:43 +0000)
committerPaul Burton <paul.burton@mips.com>
Mon, 4 Feb 2019 18:56:12 +0000 (10:56 -0800)
The drop_mmu_context() function accepts a cpu argument, but it
implicitly expects that this is always equal to smp_processor_id() by
allocating & configuring an ASID on the local CPU when the mm is active
on the CPU indicated by the cpu argument.

All callers do provide the value of smp_processor_id() to the cpu
argument.

Remove the redundant argument and have drop_mmu_context() call
smp_processor_id() itself, making it clearer that the cpu variable
always represents the local CPU.

Signed-off-by: Paul Burton <paul.burton@mips.com>
Cc: linux-mips@vger.kernel.org
arch/mips/include/asm/mmu_context.h
arch/mips/mm/c-r4k.c
arch/mips/mm/tlb-r3k.c
arch/mips/mm/tlb-r4k.c
arch/mips/mm/tlb-r8k.c

index 6731fa5ec4b98c40a128b55c56250baff1d4343c..dc45690cbbf5560021a7643253568d9ba826db02 100644 (file)
@@ -174,13 +174,15 @@ static inline void destroy_context(struct mm_struct *mm)
  * we will get a new one for it.
  */
 static inline void
-drop_mmu_context(struct mm_struct *mm, unsigned cpu)
+drop_mmu_context(struct mm_struct *mm)
 {
        unsigned long flags;
+       unsigned int cpu;
 
        local_irq_save(flags);
        htw_stop();
 
+       cpu = smp_processor_id();
        if (cpumask_test_cpu(cpu, mm_cpumask(mm)))  {
                get_new_mmu_context(mm, cpu);
                write_c0_entryhi(cpu_asid(cpu, mm));
index d0b64df51eb284feeaa8028e79a1468b1eefa565..1eca2b7e8a28ed4510e8e76d243bc2583aa09d14 100644 (file)
@@ -700,7 +700,7 @@ static inline void local_r4k_flush_cache_page(void *args)
                        int cpu = smp_processor_id();
 
                        if (cpu_context(cpu, mm) != 0)
-                               drop_mmu_context(mm, cpu);
+                               drop_mmu_context(mm);
                } else
                        vaddr ? r4k_blast_icache_page(addr) :
                                r4k_blast_icache_user_page(addr);
index 6f589e0112cea88dfa50b9fc1c99b592bf5c11d5..05a5ddccd9da35a2cf0a515d23ea69dc1330de47 100644 (file)
@@ -75,7 +75,7 @@ void local_flush_tlb_mm(struct mm_struct *mm)
 #ifdef DEBUG_TLB
                printk("[tlbmm<%lu>]", (unsigned long)cpu_context(cpu, mm));
 #endif
-               drop_mmu_context(mm, cpu);
+               drop_mmu_context(mm);
        }
 }
 
@@ -117,7 +117,7 @@ void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
                        }
                        write_c0_entryhi(oldpid);
                } else {
-                       drop_mmu_context(mm, cpu);
+                       drop_mmu_context(mm);
                }
                local_irq_restore(flags);
        }
index 0596505770dba382d4821df12f67cd431480873a..6c99dfff71b286ee0f5a5d774822ce048714eee9 100644 (file)
@@ -115,7 +115,7 @@ void local_flush_tlb_mm(struct mm_struct *mm)
        cpu = smp_processor_id();
 
        if (cpu_context(cpu, mm) != 0) {
-               drop_mmu_context(mm, cpu);
+               drop_mmu_context(mm);
        }
 
        preempt_enable();
@@ -163,7 +163,7 @@ void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
                        write_c0_entryhi(oldpid);
                        htw_start();
                } else {
-                       drop_mmu_context(mm, cpu);
+                       drop_mmu_context(mm);
                }
                flush_micro_tlb();
                local_irq_restore(flags);
index e86e2e55ad3efb736875f954560f2549dbf3b534..20fa35d21776a1837f123f52ce49ea0c8849a84b 100644 (file)
@@ -55,7 +55,7 @@ void local_flush_tlb_mm(struct mm_struct *mm)
        int cpu = smp_processor_id();
 
        if (cpu_context(cpu, mm) != 0)
-               drop_mmu_context(mm, cpu);
+               drop_mmu_context(mm);
 }
 
 void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
@@ -75,7 +75,7 @@ void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
        local_irq_save(flags);
 
        if (size > TFP_TLB_SIZE / 2) {
-               drop_mmu_context(mm, cpu);
+               drop_mmu_context(mm);
                goto out_restore;
        }