Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / arch / score / include / asm / tlbflush.h
blobf48722f4b00ef04fc87fa2a7b7f332e97b14d532
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_SCORE_TLBFLUSH_H
3 #define _ASM_SCORE_TLBFLUSH_H
5 #include <linux/mm.h>
7 /*
8 * TLB flushing:
10 * - flush_tlb_all() flushes all processes TLB entries
11 * - flush_tlb_mm(mm) flushes the specified mm context TLB entries
12 * - flush_tlb_page(vma, vmaddr) flushes one page
13 * - flush_tlb_range(vma, start, end) flushes a range of pages
14 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
16 extern void local_flush_tlb_all(void);
17 extern void local_flush_tlb_mm(struct mm_struct *mm);
18 extern void local_flush_tlb_range(struct vm_area_struct *vma,
19 unsigned long start, unsigned long end);
20 extern void local_flush_tlb_kernel_range(unsigned long start,
21 unsigned long end);
22 extern void local_flush_tlb_page(struct vm_area_struct *vma,
23 unsigned long page);
24 extern void local_flush_tlb_one(unsigned long vaddr);
26 #define flush_tlb_all() local_flush_tlb_all()
27 #define flush_tlb_mm(mm) local_flush_tlb_mm(mm)
28 #define flush_tlb_range(vma, vmaddr, end) \
29 local_flush_tlb_range(vma, vmaddr, end)
30 #define flush_tlb_kernel_range(vmaddr, end) \
31 local_flush_tlb_kernel_range(vmaddr, end)
32 #define flush_tlb_page(vma, page) local_flush_tlb_page(vma, page)
33 #define flush_tlb_one(vaddr) local_flush_tlb_one(vaddr)
35 #ifndef __ASSEMBLY__
37 static inline unsigned long pevn_get(void)
39 unsigned long val;
41 __asm__ __volatile__(
42 "mfcr %0, cr11\n"
43 "nop\nnop\n"
44 : "=r" (val));
46 return val;
49 static inline void pevn_set(unsigned long val)
51 __asm__ __volatile__(
52 "mtcr %0, cr11\n"
53 "nop\nnop\nnop\nnop\nnop\n"
54 : : "r" (val));
57 static inline void pectx_set(unsigned long val)
59 __asm__ __volatile__(
60 "mtcr %0, cr12\n"
61 "nop\nnop\nnop\nnop\nnop\n"
62 : : "r" (val));
65 static inline unsigned long pectx_get(void)
67 unsigned long val;
68 __asm__ __volatile__(
69 "mfcr %0, cr12\n"
70 "nop\nnop\n"
71 : "=r" (val));
72 return val;
74 static inline unsigned long tlblock_get(void)
76 unsigned long val;
78 __asm__ __volatile__(
79 "mfcr %0, cr7\n"
80 "nop\nnop\n"
81 : "=r" (val));
82 return val;
84 static inline void tlblock_set(unsigned long val)
86 __asm__ __volatile__(
87 "mtcr %0, cr7\n"
88 "nop\nnop\nnop\nnop\nnop\n"
89 : : "r" (val));
92 static inline void tlbpt_set(unsigned long val)
94 __asm__ __volatile__(
95 "mtcr %0, cr8\n"
96 "nop\nnop\nnop\nnop\nnop\n"
97 : : "r" (val));
100 static inline long tlbpt_get(void)
102 long val;
104 __asm__ __volatile__(
105 "mfcr %0, cr8\n"
106 "nop\nnop\n"
107 : "=r" (val));
109 return val;
112 static inline void peaddr_set(unsigned long val)
114 __asm__ __volatile__(
115 "mtcr %0, cr9\n"
116 "nop\nnop\nnop\nnop\nnop\n"
117 : : "r" (val));
120 /* TLB operations. */
121 static inline void tlb_probe(void)
123 __asm__ __volatile__("stlb;nop;nop;nop;nop;nop");
126 static inline void tlb_read(void)
128 __asm__ __volatile__("mftlb;nop;nop;nop;nop;nop");
131 static inline void tlb_write_indexed(void)
133 __asm__ __volatile__("mtptlb;nop;nop;nop;nop;nop");
136 static inline void tlb_write_random(void)
138 __asm__ __volatile__("mtrtlb;nop;nop;nop;nop;nop");
141 #endif /* Not __ASSEMBLY__ */
143 #endif /* _ASM_SCORE_TLBFLUSH_H */