mmu_context.h 898 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. void switch_mm(struct mm_struct *prev, struct mm_struct *next,
  13. struct task_struct *task);
  14. #define activate_mm activate_mm
  15. static inline void activate_mm(struct mm_struct *prev,
  16. struct mm_struct *next)
  17. {
  18. switch_mm(prev, next, NULL);
  19. }
  20. #define init_new_context init_new_context
  21. static inline int init_new_context(struct task_struct *tsk,
  22. struct mm_struct *mm)
  23. {
  24. #ifdef CONFIG_MMU
  25. atomic_long_set(&mm->context.id, 0);
  26. #endif
  27. return 0;
  28. }
  29. DECLARE_STATIC_KEY_FALSE(use_asid_allocator);
  30. #include <asm-generic/mmu_context.h>
  31. #endif /* _ASM_RISCV_MMU_CONTEXT_H */