forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/arch/arm/mm/cache-v7.S
....@@ -1,12 +1,9 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * linux/arch/arm/mm/cache-v7.S
34 *
45 * Copyright (C) 2001 Deep Blue Solutions Ltd.
56 * Copyright (C) 2005 ARM Ltd.
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License version 2 as
9
- * published by the Free Software Foundation.
107 *
118 * This is the "shell" of the ARMv7 processor support.
129 */
....@@ -19,6 +16,14 @@
1916
2017 #include "proc-macros.S"
2118
19
+#ifdef CONFIG_CPU_ICACHE_MISMATCH_WORKAROUND
20
+.globl icache_size
21
+ .data
22
+ .align 2
23
+icache_size:
24
+ .long 64
25
+ .text
26
+#endif
2227 /*
2328 * The secondary kernel init calls v7_flush_dcache_all before it enables
2429 * the L1; however, the L1 comes out of reset in an undefined state, so
....@@ -130,13 +135,13 @@
130135 and r1, r1, #7 @ mask of the bits for current cache only
131136 cmp r1, #2 @ see what cache we have at this level
132137 blt skip @ skip if no cache, or just i-cache
133
-#ifdef CONFIG_PREEMPT
138
+#ifdef CONFIG_PREEMPTION
134139 save_and_disable_irqs_notrace r9 @ make cssr&csidr read atomic
135140 #endif
136141 mcr p15, 2, r10, c0, c0, 0 @ select current cache level in cssr
137142 isb @ isb to sych the new cssr&csidr
138143 mrc p15, 1, r1, c0, c0, 0 @ read the new csidr
139
-#ifdef CONFIG_PREEMPT
144
+#ifdef CONFIG_PREEMPTION
140145 restore_irqs_notrace r9
141146 #endif
142147 and r2, r1, #7 @ extract the length of the cache lines
....@@ -163,6 +168,9 @@
163168 skip:
164169 add r10, r10, #2 @ increment cache number
165170 cmp r3, r10
171
+#ifdef CONFIG_ARM_ERRATA_814220
172
+ dsb
173
+#endif
166174 bgt flush_levels
167175 finished:
168176 mov r10, #0 @ switch back to cache level 0
....@@ -284,7 +292,12 @@
284292 cmp r12, r1
285293 blo 1b
286294 dsb ishst
295
+#ifdef CONFIG_CPU_ICACHE_MISMATCH_WORKAROUND
296
+ ldr r3, =icache_size
297
+ ldr r2, [r3, #0]
298
+#else
287299 icache_line_size r2, r3
300
+#endif
288301 sub r3, r2, #1
289302 bic r12, r0, r3
290303 2: