1
2
3
4
5
6
7
8
9#include <linux/errno.h>
10#include <linux/linkage.h>
11#include <linux/init.h>
12#include <asm/assembler.h>
13#include <asm/cpufeature.h>
14#include <asm/alternative.h>
15#include <asm/asm-uaccess.h>
16
17
18
19
20
21
22
23
24
25
26
27
28.macro caches_clean_inval_pou_macro, fixup
29alternative_if ARM64_HAS_CACHE_IDC
30 dsb ishst
31 b .Ldc_skip_\@
32alternative_else_nop_endif
33 mov x2, x0
34 mov x3, x1
35 dcache_by_line_op cvau, ish, x2, x3, x4, x5, \fixup
36.Ldc_skip_\@:
37alternative_if ARM64_HAS_CACHE_DIC
38 isb
39 b .Lic_skip_\@
40alternative_else_nop_endif
41 invalidate_icache_by_line x0, x1, x2, x3, \fixup
42.Lic_skip_\@:
43.endm
44
45
46
47
48
49
50
51
52
53
54
55SYM_FUNC_START(caches_clean_inval_pou)
56 caches_clean_inval_pou_macro
57 ret
58SYM_FUNC_END(caches_clean_inval_pou)
59
60
61
62
63
64
65
66
67
68
69
70SYM_FUNC_START(caches_clean_inval_user_pou)
71 uaccess_ttbr0_enable x2, x3, x4
72
73 caches_clean_inval_pou_macro 2f
74 mov x0, xzr
751:
76 uaccess_ttbr0_disable x1, x2
77 ret
782:
79 mov x0,
80 b 1b
81SYM_FUNC_END(caches_clean_inval_user_pou)
82
83
84
85
86
87
88
89
90
91SYM_FUNC_START(icache_inval_pou)
92alternative_if ARM64_HAS_CACHE_DIC
93 isb
94 ret
95alternative_else_nop_endif
96
97 invalidate_icache_by_line x0, x1, x2, x3
98 ret
99SYM_FUNC_END(icache_inval_pou)
100
101
102
103
104
105
106
107
108
109
110SYM_FUNC_START(__pi_dcache_clean_inval_poc)
111 dcache_by_line_op civac, sy, x0, x1, x2, x3
112 ret
113SYM_FUNC_END(__pi_dcache_clean_inval_poc)
114SYM_FUNC_ALIAS(dcache_clean_inval_poc, __pi_dcache_clean_inval_poc)
115
116
117
118
119
120
121
122
123
124
125SYM_FUNC_START(dcache_clean_pou)
126alternative_if ARM64_HAS_CACHE_IDC
127 dsb ishst
128 ret
129alternative_else_nop_endif
130 dcache_by_line_op cvau, ish, x0, x1, x2, x3
131 ret
132SYM_FUNC_END(dcache_clean_pou)
133
134
135
136
137
138
139
140
141
142
143
144SYM_FUNC_START(__pi_dcache_inval_poc)
145 dcache_line_size x2, x3
146 sub x3, x2,
147 tst x1, x3
148 bic x1, x1, x3
149 b.eq 1f
150 dc civac, x1
1511: tst x0, x3
152 bic x0, x0, x3
153 b.eq 2f
154 dc civac, x0
155 b 3f
1562: dc ivac, x0
1573: add x0, x0, x2
158 cmp x0, x1
159 b.lo 2b
160 dsb sy
161 ret
162SYM_FUNC_END(__pi_dcache_inval_poc)
163SYM_FUNC_ALIAS(dcache_inval_poc, __pi_dcache_inval_poc)
164
165
166
167
168
169
170
171
172
173
174SYM_FUNC_START(__pi_dcache_clean_poc)
175 dcache_by_line_op cvac, sy, x0, x1, x2, x3
176 ret
177SYM_FUNC_END(__pi_dcache_clean_poc)
178SYM_FUNC_ALIAS(dcache_clean_poc, __pi_dcache_clean_poc)
179
180
181
182
183
184
185
186
187
188
189SYM_FUNC_START(__pi_dcache_clean_pop)
190 alternative_if_not ARM64_HAS_DCPOP
191 b dcache_clean_poc
192 alternative_else_nop_endif
193 dcache_by_line_op cvap, sy, x0, x1, x2, x3
194 ret
195SYM_FUNC_END(__pi_dcache_clean_pop)
196SYM_FUNC_ALIAS(dcache_clean_pop, __pi_dcache_clean_pop)
197
198
199
200
201
202
203
204
205
206SYM_FUNC_START(__pi___dma_flush_area)
207 add x1, x0, x1
208 dcache_by_line_op civac, sy, x0, x1, x2, x3
209 ret
210SYM_FUNC_END(__pi___dma_flush_area)
211SYM_FUNC_ALIAS(__dma_flush_area, __pi___dma_flush_area)
212
213
214
215
216
217
218
219SYM_FUNC_START(__pi___dma_map_area)
220 add x1, x0, x1
221 b __pi_dcache_clean_poc
222SYM_FUNC_END(__pi___dma_map_area)
223SYM_FUNC_ALIAS(__dma_map_area, __pi___dma_map_area)
224
225
226
227
228
229
230
231SYM_FUNC_START(__pi___dma_unmap_area)
232 add x1, x0, x1
233 cmp w2,
234 b.ne __pi_dcache_inval_poc
235 ret
236SYM_FUNC_END(__pi___dma_unmap_area)
237SYM_FUNC_ALIAS(__dma_unmap_area, __pi___dma_unmap_area)
238