]>
git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - arch/riscv/include/asm/mmu_context.h
2 * Copyright (C) 2012 Regents of the University of California
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation, version 2.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
14 #ifndef _ASM_RISCV_MMU_CONTEXT_H
15 #define _ASM_RISCV_MMU_CONTEXT_H
17 #include <asm-generic/mm_hooks.h>
20 #include <linux/sched.h>
21 #include <asm/tlbflush.h>
23 static inline void enter_lazy_tlb(struct mm_struct
*mm
,
24 struct task_struct
*task
)
28 /* Initialize context-related info for a new mm_struct */
29 static inline int init_new_context(struct task_struct
*task
,
35 static inline void destroy_context(struct mm_struct
*mm
)
39 static inline pgd_t
*current_pgdir(void)
41 return pfn_to_virt(csr_read(sptbr
) & SPTBR_PPN
);
44 static inline void set_pgdir(pgd_t
*pgd
)
46 csr_write(sptbr
, virt_to_pfn(pgd
) | SPTBR_MODE
);
49 static inline void switch_mm(struct mm_struct
*prev
,
50 struct mm_struct
*next
, struct task_struct
*task
)
52 if (likely(prev
!= next
)) {
54 local_flush_tlb_all();
58 static inline void activate_mm(struct mm_struct
*prev
,
59 struct mm_struct
*next
)
61 switch_mm(prev
, next
, NULL
);
64 static inline void deactivate_mm(struct task_struct
*task
,
69 #endif /* _ASM_RISCV_MMU_CONTEXT_H */