mmu_context.h (959B)
1/* SPDX-License-Identifier: GPL-2.0 */ 2 3#ifndef __ASM_CSKY_MMU_CONTEXT_H 4#define __ASM_CSKY_MMU_CONTEXT_H 5 6#include <asm-generic/mm_hooks.h> 7#include <asm/setup.h> 8#include <asm/page.h> 9#include <asm/cacheflush.h> 10#include <asm/tlbflush.h> 11 12#include <linux/errno.h> 13#include <linux/sched.h> 14#include <abi/ckmmu.h> 15 16#define ASID_MASK ((1 << CONFIG_CPU_ASID_BITS) - 1) 17#define cpu_asid(mm) (atomic64_read(&mm->context.asid) & ASID_MASK) 18 19#define init_new_context(tsk,mm) ({ atomic64_set(&(mm)->context.asid, 0); 0; }) 20 21void check_and_switch_context(struct mm_struct *mm, unsigned int cpu); 22 23static inline void 24switch_mm(struct mm_struct *prev, struct mm_struct *next, 25 struct task_struct *tsk) 26{ 27 unsigned int cpu = smp_processor_id(); 28 29 if (prev != next) 30 check_and_switch_context(next, cpu); 31 32 setup_pgd(next->pgd, next->context.asid.counter); 33 34 flush_icache_deferred(next); 35} 36 37#include <asm-generic/mmu_context.h> 38 39#endif /* __ASM_CSKY_MMU_CONTEXT_H */