aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2007-06-13 00:52:57 -0400
committerPaul Mackerras <paulus@samba.org>2007-06-14 08:30:16 -0400
commit4508dc21feb189159d4cc1d5b79c5a55fad5f2ed (patch)
tree8128d7642606a64e2b65a4ea9d2e74cf70cdf1f8 /arch/powerpc/kernel
parent8e561e7eda02819c711a75b64a000bf34948cdbb (diff)
[POWERPC] Merge CPU features pertaining to icache coherency
Currently the powerpc kernel has a 64-bit only feature, COHERENT_ICACHE used for those CPUS which maintain icache/dcache coherency in hardware (POWER5, essentially). It also has a feature, SPLIT_ID_CACHE, which is used on CPUs which have separate i and d-caches, which is to say everything except 601 and Freescale E200. In nearly all the places we check the SPLIT_ID_CACHE, what we actually care about is whether the i and d-caches are coherent (which they will be, trivially, if they're the same cache). This tries to clarify the situation a little. The COHERENT_ICACHE feature becomes availble on 32-bit and is set for all CPUs where i and d-cache are effectively coherent, whether this is due to special logic (POWER5) or because they're unified. We check this, instead of SPLIT_ID_CACHE nearly everywhere. The SPLIT_ID_CACHE feature itself is replaced by a UNIFIED_ID_CACHE feature with reversed sense, set only on 601 and Freescale E200. In the two places (one Freescale BookE specific) where we really care whether it's a unified cache, not whether they're coherent, we check this feature. The CPUs with unified cache are so few, we could consider replacing this feature bit with explicit checks against the PVR. This will make unifying the 32-bit and 64-bit cache flush code a little more straightforward. Signed-off-by: David Gibson <dwg@au1.ibm.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r--arch/powerpc/kernel/misc_32.S10
-rw-r--r--arch/powerpc/kernel/setup_32.c12
2 files changed, 10 insertions, 12 deletions
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index 98decf8ebff4..e708ab7ca9e8 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -392,7 +392,7 @@ BEGIN_FTR_SECTION
392 mtspr SPRN_L1CSR0,r3 392 mtspr SPRN_L1CSR0,r3
393 isync 393 isync
394 blr 394 blr
395END_FTR_SECTION_IFCLR(CPU_FTR_SPLIT_ID_CACHE) 395END_FTR_SECTION_IFSET(CPU_FTR_UNIFIED_ID_CACHE)
396 mfspr r3,SPRN_L1CSR1 396 mfspr r3,SPRN_L1CSR1
397 ori r3,r3,L1CSR1_ICFI|L1CSR1_ICLFR 397 ori r3,r3,L1CSR1_ICFI|L1CSR1_ICLFR
398 mtspr SPRN_L1CSR1,r3 398 mtspr SPRN_L1CSR1,r3
@@ -419,7 +419,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_SPLIT_ID_CACHE)
419_GLOBAL(__flush_icache_range) 419_GLOBAL(__flush_icache_range)
420BEGIN_FTR_SECTION 420BEGIN_FTR_SECTION
421 blr /* for 601, do nothing */ 421 blr /* for 601, do nothing */
422END_FTR_SECTION_IFCLR(CPU_FTR_SPLIT_ID_CACHE) 422END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
423 li r5,L1_CACHE_BYTES-1 423 li r5,L1_CACHE_BYTES-1
424 andc r3,r3,r5 424 andc r3,r3,r5
425 subf r4,r3,r4 425 subf r4,r3,r4
@@ -514,8 +514,8 @@ _GLOBAL(invalidate_dcache_range)
514 */ 514 */
515_GLOBAL(__flush_dcache_icache) 515_GLOBAL(__flush_dcache_icache)
516BEGIN_FTR_SECTION 516BEGIN_FTR_SECTION
517 blr /* for 601, do nothing */ 517 blr
518END_FTR_SECTION_IFCLR(CPU_FTR_SPLIT_ID_CACHE) 518END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
519 rlwinm r3,r3,0,0,19 /* Get page base address */ 519 rlwinm r3,r3,0,0,19 /* Get page base address */
520 li r4,4096/L1_CACHE_BYTES /* Number of lines in a page */ 520 li r4,4096/L1_CACHE_BYTES /* Number of lines in a page */
521 mtctr r4 521 mtctr r4
@@ -543,7 +543,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_SPLIT_ID_CACHE)
543_GLOBAL(__flush_dcache_icache_phys) 543_GLOBAL(__flush_dcache_icache_phys)
544BEGIN_FTR_SECTION 544BEGIN_FTR_SECTION
545 blr /* for 601, do nothing */ 545 blr /* for 601, do nothing */
546END_FTR_SECTION_IFCLR(CPU_FTR_SPLIT_ID_CACHE) 546END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE)
547 mfmsr r10 547 mfmsr r10
548 rlwinm r0,r10,0,28,26 /* clear DR */ 548 rlwinm r0,r10,0,28,26 /* clear DR */
549 mtmsr r0 549 mtmsr r0
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 35f8f443c14f..7ec6ba56d83d 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -262,13 +262,11 @@ void __init setup_arch(char **cmdline_p)
262 * Systems with OF can look in the properties on the cpu node(s) 262 * Systems with OF can look in the properties on the cpu node(s)
263 * for a possibly more accurate value. 263 * for a possibly more accurate value.
264 */ 264 */
265 if (cpu_has_feature(CPU_FTR_SPLIT_ID_CACHE)) { 265 dcache_bsize = cur_cpu_spec->dcache_bsize;
266 dcache_bsize = cur_cpu_spec->dcache_bsize; 266 icache_bsize = cur_cpu_spec->icache_bsize;
267 icache_bsize = cur_cpu_spec->icache_bsize; 267 ucache_bsize = 0;
268 ucache_bsize = 0; 268 if (cpu_has_feature(CPU_FTR_UNIFIED_ID_CACHE))
269 } else 269 ucache_bsize = icache_bsize = dcache_bsize;
270 ucache_bsize = dcache_bsize = icache_bsize
271 = cur_cpu_spec->dcache_bsize;
272 270
273 /* reboot on panic */ 271 /* reboot on panic */
274 panic_timeout = 180; 272 panic_timeout = 180;