1
2
3
4
5
6
7
8
9
10
11
12#ifndef __UNICORE_TLBFLUSH_H__
13#define __UNICORE_TLBFLUSH_H__
14
15#ifndef __ASSEMBLY__
16
17#include <linux/sched.h>
18
19extern void __cpu_flush_user_tlb_range(unsigned long, unsigned long,
20 struct vm_area_struct *);
21extern void __cpu_flush_kern_tlb_range(unsigned long, unsigned long);
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66static inline void local_flush_tlb_all(void)
67{
68 const int zero = 0;
69
70
71 asm("movc p0.c6, %0, #6; nop; nop; nop; nop; nop; nop; nop; nop"
72 : : "r" (zero) : "cc");
73}
74
75static inline void local_flush_tlb_mm(struct mm_struct *mm)
76{
77 const int zero = 0;
78
79 if (cpumask_test_cpu(get_cpu(), mm_cpumask(mm))) {
80
81 asm("movc p0.c6, %0, #6; nop; nop; nop; nop; nop; nop; nop; nop"
82 : : "r" (zero) : "cc");
83 }
84 put_cpu();
85}
86
87static inline void
88local_flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr)
89{
90 if (cpumask_test_cpu(smp_processor_id(), mm_cpumask(vma->vm_mm))) {
91#ifndef CONFIG_CPU_TLB_SINGLE_ENTRY_DISABLE
92
93 asm("movc p0.c6, %0, #5; nop; nop; nop; nop; nop; nop; nop; nop"
94 : : "r" (uaddr & PAGE_MASK) : "cc");
95
96 asm("movc p0.c6, %0, #3; nop; nop; nop; nop; nop; nop; nop; nop"
97 : : "r" (uaddr & PAGE_MASK) : "cc");
98#else
99
100 asm("movc p0.c6, %0, #6; nop; nop; nop; nop; nop; nop; nop; nop"
101 : : "r" (uaddr & PAGE_MASK) : "cc");
102#endif
103 }
104}
105
106static inline void local_flush_tlb_kernel_page(unsigned long kaddr)
107{
108#ifndef CONFIG_CPU_TLB_SINGLE_ENTRY_DISABLE
109
110 asm("movc p0.c6, %0, #5; nop; nop; nop; nop; nop; nop; nop; nop"
111 : : "r" (kaddr & PAGE_MASK) : "cc");
112
113 asm("movc p0.c6, %0, #3; nop; nop; nop; nop; nop; nop; nop; nop"
114 : : "r" (kaddr & PAGE_MASK) : "cc");
115#else
116
117 asm("movc p0.c6, %0, #6; nop; nop; nop; nop; nop; nop; nop; nop"
118 : : "r" (kaddr & PAGE_MASK) : "cc");
119#endif
120}
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135static inline void flush_pmd_entry(pmd_t *pmd)
136{
137#ifndef CONFIG_CPU_DCACHE_LINE_DISABLE
138
139 asm("mov r1, %0 << #20\n"
140 "ldw r2, =_stext\n"
141 "add r2, r2, r1 >> #20\n"
142 "ldw r1, [r2+], #0x0000\n"
143 "ldw r1, [r2+], #0x1000\n"
144 "ldw r1, [r2+], #0x2000\n"
145 "ldw r1, [r2+], #0x3000\n"
146 : : "r" (pmd) : "r1", "r2");
147#else
148
149 asm("movc p0.c5, %0, #14; nop; nop; nop; nop; nop; nop; nop; nop"
150 : : "r" (pmd) : "cc");
151#endif
152}
153
154static inline void clean_pmd_entry(pmd_t *pmd)
155{
156#ifndef CONFIG_CPU_DCACHE_LINE_DISABLE
157
158 asm("movc p0.c5, %0, #11; nop; nop; nop; nop; nop; nop; nop; nop"
159 : : "r" (__pa(pmd) & ~(L1_CACHE_BYTES - 1)) : "cc");
160#else
161
162 asm("movc p0.c5, %0, #10; nop; nop; nop; nop; nop; nop; nop; nop"
163 : : "r" (pmd) : "cc");
164#endif
165}
166
167
168
169
170#define local_flush_tlb_range(vma, start, end) \
171 __cpu_flush_user_tlb_range(start, end, vma)
172#define local_flush_tlb_kernel_range(s, e) \
173 __cpu_flush_kern_tlb_range(s, e)
174
175#define flush_tlb_all local_flush_tlb_all
176#define flush_tlb_mm local_flush_tlb_mm
177#define flush_tlb_page local_flush_tlb_page
178#define flush_tlb_kernel_page local_flush_tlb_kernel_page
179#define flush_tlb_range local_flush_tlb_range
180#define flush_tlb_kernel_range local_flush_tlb_kernel_range
181
182
183
184
185
186
187extern void update_mmu_cache(struct vm_area_struct *vma,
188 unsigned long addr, pte_t *ptep);
189
190extern void do_bad_area(unsigned long addr, unsigned int fsr,
191 struct pt_regs *regs);
192
193#endif
194
195#endif
196