mmu_context.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (C) 2012 Regents of the University of California
  4. * Copyright (C) 2017 SiFive
  5. */
  6. #ifndef _ASM_RISCV_MMU_CONTEXT_H
  7. #define _ASM_RISCV_MMU_CONTEXT_H
  8. #include <linux/mm_types.h>
  9. #include <asm-generic/mm_hooks.h>
  10. #include <linux/mm.h>
  11. #include <linux/sched.h>
  12. #include <asm/tlbflush.h>
  13. #include <asm/cacheflush.h>
  14. #include <asm/asid.h>
  15. #define ASID_MASK ((1 << SATP_ASID_BITS) - 1)
  16. #define cpu_asid(mm) (atomic64_read(&mm->context.asid) & ASID_MASK)
  17. #define init_new_context(tsk,mm) ({ atomic64_set(&(mm)->context.asid, 0); 0; })
  18. static inline void enter_lazy_tlb(struct mm_struct *mm,
  19. struct task_struct *task)
  20. {
  21. }
  22. static inline void destroy_context(struct mm_struct *mm)
  23. {
  24. }
  25. void switch_mm(struct mm_struct *prev, struct mm_struct *next,
  26. struct task_struct *task);
  27. void check_and_switch_context(struct mm_struct *mm, unsigned int cpu);
  28. static inline void activate_mm(struct mm_struct *prev,
  29. struct mm_struct *next)
  30. {
  31. switch_mm(prev, next, NULL);
  32. }
  33. static inline void deactivate_mm(struct task_struct *task,
  34. struct mm_struct *mm)
  35. {
  36. }
  37. #endif /* _ASM_RISCV_MMU_CONTEXT_H */