Skip to content

Commit 3d2e2f2

Browse files
author
Sean Cross
committed
proc-mohawk: Fix user cache invalidate call
The user cache invalidate call normally panics because it attempts to access an invalid region of memory as it attempts to fixup the A0 cache bug when called from userspace. This patch implements a fix that prevents it from working around the A0 bug when called from userspace.
1 parent 9b0d433 commit 3d2e2f2

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed

arch/arm/mm/proc-mohawk.S

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,32 @@ ENTRY(mohawk_flush_user_cache_range)
199199
* - end - virtual end address
200200
*/
201201
ENTRY(mohawk_coherent_kern_range)
202-
/* FALLTHROUGH */
202+
bic r0, r0, #CACHE_DLINESIZE - 1
203+
#if !defined(CONFIG_CPU_PXA168_B0)
204+
#if defined(CONFIG_CPU_L2_CACHE)
205+
mov r2, r0
206+
#endif
207+
#endif
208+
1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
209+
mcr p15, 0, r0, c7, c5, 1 @ invalidate I entry
210+
add r0, r0, #CACHE_DLINESIZE
211+
cmp r0, r1
212+
blo 1b
213+
mcr p15, 0, r0, c7, c10, 4 @ drain WB
214+
#if !defined(CONFIG_CPU_PXA168_B0)
215+
#if defined(CONFIG_CPU_L2_CACHE)
216+
mov r0, r2
217+
add r0, #BAD_CACHE_LINE_OFFSET
218+
1: cmp r0, r1
219+
bgt 2f
220+
mcr p15, 1, r0, c7, c11, 1 @ l2 clean single entry
221+
add r0, #PAGE_SZ
222+
b 1b
223+
2:
224+
#endif
225+
mcr p15, 0, r0, c7, c10, 4 @ drain WB
226+
#endif
227+
mov pc, lr
203228

204229
/*
205230
* coherent_user_range(start, end)
@@ -225,16 +250,6 @@ ENTRY(mohawk_coherent_user_range)
225250
blo 1b
226251
mcr p15, 0, r0, c7, c10, 4 @ drain WB
227252
#if !defined(CONFIG_CPU_PXA168_B0)
228-
#if defined(CONFIG_CPU_L2_CACHE)
229-
mov r0, r2
230-
add r0, #BAD_CACHE_LINE_OFFSET
231-
1: cmp r0, r1
232-
bgt 2f
233-
mcr p15, 1, r0, c7, c11, 1 @ l2 clean single entry
234-
add r0, #PAGE_SZ
235-
b 1b
236-
2:
237-
#endif
238253
mcr p15, 0, r0, c7, c10, 4 @ drain WB
239254
#endif
240255
mov pc, lr

0 commit comments

Comments
 (0)