diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2007-06-13 00:52:57 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-06-14 08:30:16 -0400 |
commit | 4508dc21feb189159d4cc1d5b79c5a55fad5f2ed (patch) | |
tree | 8128d7642606a64e2b65a4ea9d2e74cf70cdf1f8 /arch/ppc/kernel | |
parent | 8e561e7eda02819c711a75b64a000bf34948cdbb (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/ppc/kernel')
-rw-r--r-- | arch/ppc/kernel/misc.S | 8 | ||||
-rw-r--r-- | arch/ppc/kernel/setup.c | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/arch/ppc/kernel/misc.S b/arch/ppc/kernel/misc.S index d319f9ba2379..0da55368655c 100644 --- a/arch/ppc/kernel/misc.S +++ b/arch/ppc/kernel/misc.S | |||
@@ -328,7 +328,7 @@ BEGIN_FTR_SECTION | |||
328 | mtspr SPRN_L1CSR0,r3 | 328 | mtspr SPRN_L1CSR0,r3 |
329 | isync | 329 | isync |
330 | blr | 330 | blr |
331 | END_FTR_SECTION_IFCLR(CPU_FTR_SPLIT_ID_CACHE) | 331 | END_FTR_SECTION_IFSET(CPU_FTR_UNIFIED_ID_CACHE) |
332 | mfspr r3,SPRN_L1CSR1 | 332 | mfspr r3,SPRN_L1CSR1 |
333 | ori r3,r3,L1CSR1_ICFI|L1CSR1_ICLFR | 333 | ori r3,r3,L1CSR1_ICFI|L1CSR1_ICLFR |
334 | mtspr SPRN_L1CSR1,r3 | 334 | mtspr SPRN_L1CSR1,r3 |
@@ -355,7 +355,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_SPLIT_ID_CACHE) | |||
355 | _GLOBAL(__flush_icache_range) | 355 | _GLOBAL(__flush_icache_range) |
356 | BEGIN_FTR_SECTION | 356 | BEGIN_FTR_SECTION |
357 | blr /* for 601, do nothing */ | 357 | blr /* for 601, do nothing */ |
358 | END_FTR_SECTION_IFCLR(CPU_FTR_SPLIT_ID_CACHE) | 358 | END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE) |
359 | li r5,L1_CACHE_BYTES-1 | 359 | li r5,L1_CACHE_BYTES-1 |
360 | andc r3,r3,r5 | 360 | andc r3,r3,r5 |
361 | subf r4,r3,r4 | 361 | subf r4,r3,r4 |
@@ -472,7 +472,7 @@ _GLOBAL(flush_dcache_all) | |||
472 | _GLOBAL(__flush_dcache_icache) | 472 | _GLOBAL(__flush_dcache_icache) |
473 | BEGIN_FTR_SECTION | 473 | BEGIN_FTR_SECTION |
474 | blr /* for 601, do nothing */ | 474 | blr /* for 601, do nothing */ |
475 | END_FTR_SECTION_IFCLR(CPU_FTR_SPLIT_ID_CACHE) | 475 | END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE) |
476 | rlwinm r3,r3,0,0,19 /* Get page base address */ | 476 | rlwinm r3,r3,0,0,19 /* Get page base address */ |
477 | li r4,4096/L1_CACHE_BYTES /* Number of lines in a page */ | 477 | li r4,4096/L1_CACHE_BYTES /* Number of lines in a page */ |
478 | mtctr r4 | 478 | mtctr r4 |
@@ -500,7 +500,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_SPLIT_ID_CACHE) | |||
500 | _GLOBAL(__flush_dcache_icache_phys) | 500 | _GLOBAL(__flush_dcache_icache_phys) |
501 | BEGIN_FTR_SECTION | 501 | BEGIN_FTR_SECTION |
502 | blr /* for 601, do nothing */ | 502 | blr /* for 601, do nothing */ |
503 | END_FTR_SECTION_IFCLR(CPU_FTR_SPLIT_ID_CACHE) | 503 | END_FTR_SECTION_IFSET(CPU_FTR_COHERENT_ICACHE) |
504 | mfmsr r10 | 504 | mfmsr r10 |
505 | rlwinm r0,r10,0,28,26 /* clear DR */ | 505 | rlwinm r0,r10,0,28,26 /* clear DR */ |
506 | mtmsr r0 | 506 | mtmsr r0 |
diff --git a/arch/ppc/kernel/setup.c b/arch/ppc/kernel/setup.c index c79704f5409c..967c1ef59a6b 100644 --- a/arch/ppc/kernel/setup.c +++ b/arch/ppc/kernel/setup.c | |||
@@ -526,7 +526,7 @@ void __init setup_arch(char **cmdline_p) | |||
526 | * Systems with OF can look in the properties on the cpu node(s) | 526 | * Systems with OF can look in the properties on the cpu node(s) |
527 | * for a possibly more accurate value. | 527 | * for a possibly more accurate value. |
528 | */ | 528 | */ |
529 | if (cpu_has_feature(CPU_FTR_SPLIT_ID_CACHE)) { | 529 | if (! cpu_has_feature(CPU_FTR_UNIFIED_ID_CACHE)) { |
530 | dcache_bsize = cur_cpu_spec->dcache_bsize; | 530 | dcache_bsize = cur_cpu_spec->dcache_bsize; |
531 | icache_bsize = cur_cpu_spec->icache_bsize; | 531 | icache_bsize = cur_cpu_spec->icache_bsize; |
532 | ucache_bsize = 0; | 532 | ucache_bsize = 0; |