mmu_context.h 959 B

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