summaryrefslogtreecommitdiff
path: root/arch/mips/mm/context.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/mm/context.c')
-rw-r--r--arch/mips/mm/context.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/mips/mm/context.c b/arch/mips/mm/context.c
new file mode 100644
index 000000000000..b5af471006f0
--- /dev/null
+++ b/arch/mips/mm/context.c
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <linux/mmu_context.h>
+
+void get_new_mmu_context(struct mm_struct *mm)
+{
+ unsigned int cpu;
+ u64 asid;
+
+ cpu = smp_processor_id();
+ asid = asid_cache(cpu);
+
+ if (!((asid += cpu_asid_inc()) & cpu_asid_mask(&cpu_data[cpu]))) {
+ if (cpu_has_vtag_icache)
+ flush_icache_all();
+ local_flush_tlb_all(); /* start new asid cycle */
+ }
+
+ cpu_context(cpu, mm) = asid_cache(cpu) = asid;
+}