1 /* SPDX-License-Identifier: GPL-2.0 */
3 #ifndef __ASM_CSKY_MMU_CONTEXT_H
4 #define __ASM_CSKY_MMU_CONTEXT_H
6 #include <asm-generic/mm_hooks.h>
9 #include <asm/cacheflush.h>
10 #include <asm/tlbflush.h>
12 #include <linux/errno.h>
13 #include <linux/sched.h>
14 #include <abi/ckmmu.h>
16 #define ASID_MASK ((1 << CONFIG_CPU_ASID_BITS) - 1)
17 #define cpu_asid(mm) (atomic64_read(&mm->context.asid) & ASID_MASK)
19 #define init_new_context(tsk,mm) ({ atomic64_set(&(mm)->context.asid, 0); 0; })
21 void check_and_switch_context(struct mm_struct
*mm
, unsigned int cpu
);
24 switch_mm(struct mm_struct
*prev
, struct mm_struct
*next
,
25 struct task_struct
*tsk
)
27 unsigned int cpu
= smp_processor_id();
30 check_and_switch_context(next
, cpu
);
32 setup_pgd(next
->pgd
, next
->context
.asid
.counter
);
34 flush_icache_deferred(next
);
37 #include <asm-generic/mmu_context.h>
39 #endif /* __ASM_CSKY_MMU_CONTEXT_H */