summaryrefslogtreecommitdiffstats
path: root/arch/mips/include/asm/mmu_context.h
diff options
context:
space:
mode:
authorPaul Burton <paul.burton@mips.com>2019-02-02 01:43:15 +0000
committerPaul Burton <paul.burton@mips.com>2019-02-04 10:56:09 -0800
commitc653bd04f76dd4435c09097a82adc2a5be672292 (patch)
tree76076acebd08f5fadcd3233748d35ccf87688957 /arch/mips/include/asm/mmu_context.h
parentce680c8c99fdcefd99ca845b256f9db2c6c3847d (diff)
downloadlinux-c653bd04f76dd4435c09097a82adc2a5be672292.tar.bz2
MIPS: mm: Define activate_mm() using switch_mm()
MIPS has separate definitions of activate_mm() & switch_mm() which are identical apart from switch_mm() checking that the ASID is valid before acquiring a new one. We know that when activate_mm() is called cpu_context(X, mm) will be zero, and this will never be considered a valid ASID because we never allow the ASID version number to be zero, instead beginning with version 1 using asid_first_version(). Therefore switch_mm() will always allocate a new ASID when called for a new task, meaning that it will behave identically to activate_mm(). Take advantage of this to remove the duplication & define activate_mm() using switch_mm() just like many other architectures do. Signed-off-by: Paul Burton <paul.burton@mips.com> Cc: linux-mips@vger.kernel.org
Diffstat (limited to 'arch/mips/include/asm/mmu_context.h')
-rw-r--r--arch/mips/include/asm/mmu_context.h28
1 files changed, 1 insertions, 27 deletions
diff --git a/arch/mips/include/asm/mmu_context.h b/arch/mips/include/asm/mmu_context.h
index a589585be21b..6731fa5ec4b9 100644
--- a/arch/mips/include/asm/mmu_context.h
+++ b/arch/mips/include/asm/mmu_context.h
@@ -166,36 +166,10 @@ static inline void destroy_context(struct mm_struct *mm)
dsemul_mm_cleanup(mm);
}
+#define activate_mm(prev, next) switch_mm(prev, next, current)
#define deactivate_mm(tsk, mm) do { } while (0)
/*
- * After we have set current->mm to a new value, this activates
- * the context for the new mm so we see the new mappings.
- */
-static inline void
-activate_mm(struct mm_struct *prev, struct mm_struct *next)
-{
- unsigned long flags;
- unsigned int cpu = smp_processor_id();
-
- local_irq_save(flags);
-
- htw_stop();
- /* Unconditionally get a new ASID. */
- get_new_mmu_context(next, cpu);
-
- write_c0_entryhi(cpu_asid(cpu, next));
- TLBMISS_HANDLER_SETUP_PGD(next->pgd);
-
- /* mark mmu ownership change */
- cpumask_clear_cpu(cpu, mm_cpumask(prev));
- cpumask_set_cpu(cpu, mm_cpumask(next));
- htw_start();
-
- local_irq_restore(flags);
-}
-
-/*
* If mm is currently active_mm, we can't really drop it. Instead,
* we will get a new one for it.
*/