treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / arch / csky / include / asm / mmu_context.h
blob0285b0ad18b6f2bce9276396461f9a1ffc2ed2f2
1 /* SPDX-License-Identifier: GPL-2.0 */
2 // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
4 #ifndef __ASM_CSKY_MMU_CONTEXT_H
5 #define __ASM_CSKY_MMU_CONTEXT_H
7 #include <asm-generic/mm_hooks.h>
8 #include <asm/setup.h>
9 #include <asm/page.h>
10 #include <asm/cacheflush.h>
11 #include <asm/tlbflush.h>
13 #include <linux/errno.h>
14 #include <linux/sched.h>
15 #include <abi/ckmmu.h>
17 #define TLBMISS_HANDLER_SETUP_PGD(pgd) \
18 setup_pgd(__pa(pgd), false)
20 #define TLBMISS_HANDLER_SETUP_PGD_KERNEL(pgd) \
21 setup_pgd(__pa(pgd), true)
23 #define ASID_MASK ((1 << CONFIG_CPU_ASID_BITS) - 1)
24 #define cpu_asid(mm) (atomic64_read(&mm->context.asid) & ASID_MASK)
26 #define init_new_context(tsk,mm) ({ atomic64_set(&(mm)->context.asid, 0); 0; })
27 #define activate_mm(prev,next) switch_mm(prev, next, current)
29 #define destroy_context(mm) do {} while (0)
30 #define enter_lazy_tlb(mm, tsk) do {} while (0)
31 #define deactivate_mm(tsk, mm) do {} while (0)
33 void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
35 static inline void
36 switch_mm(struct mm_struct *prev, struct mm_struct *next,
37 struct task_struct *tsk)
39 unsigned int cpu = smp_processor_id();
41 if (prev != next)
42 check_and_switch_context(next, cpu);
44 TLBMISS_HANDLER_SETUP_PGD(next->pgd);
45 write_mmu_entryhi(next->context.asid.counter);
47 #endif /* __ASM_CSKY_MMU_CONTEXT_H */