aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/setup_64.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@au1.ibm.com>2007-10-27 17:49:28 -0400
committerPaul Mackerras <paulus@samba.org>2007-11-07 22:15:30 -0500
commit20474abda6bb11396434593daf2f52679cf62edf (patch)
treec2d4c2bd279ea26abe06cb78138558f9273f59e3 /arch/powerpc/kernel/setup_64.c
parentfb293ae1c02dab78e714d50f2c37d7852d6f328a (diff)
[POWERPC] Fix cache line vs. block size confusion
We had an historical confusion in the kernel between cache line and cache block size. The former is an implementation detail of the L1 cache which can be useful for performance optimisations, the later is the actual size on which the cache control instructions operate, which can be different. For some reason, we had a weird hack reading the right property on powermac and the wrong one on any other 64 bits (32 bits is unaffected as it only uses the cputable for cache block size infos at this stage). This fixes the booting-without-of.txt documentation to mention the right properties, and fixes the 64 bits initialization code to look for the block size first, with a fallback to the line size if the property is missing. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/setup_64.c')
-rw-r--r--arch/powerpc/kernel/setup_64.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index ede77dbbd4df..3b1529c103ef 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -291,23 +291,16 @@ static void __init initialize_cache_info(void)
291 if ( num_cpus == 1 ) { 291 if ( num_cpus == 1 ) {
292 const u32 *sizep, *lsizep; 292 const u32 *sizep, *lsizep;
293 u32 size, lsize; 293 u32 size, lsize;
294 const char *dc, *ic;
295
296 /* Then read cache informations */
297 if (machine_is(powermac)) {
298 dc = "d-cache-block-size";
299 ic = "i-cache-block-size";
300 } else {
301 dc = "d-cache-line-size";
302 ic = "i-cache-line-size";
303 }
304 294
305 size = 0; 295 size = 0;
306 lsize = cur_cpu_spec->dcache_bsize; 296 lsize = cur_cpu_spec->dcache_bsize;
307 sizep = of_get_property(np, "d-cache-size", NULL); 297 sizep = of_get_property(np, "d-cache-size", NULL);
308 if (sizep != NULL) 298 if (sizep != NULL)
309 size = *sizep; 299 size = *sizep;
310 lsizep = of_get_property(np, dc, NULL); 300 lsizep = of_get_property(np, "d-cache-block-size", NULL);
301 /* fallback if block size missing */
302 if (lsizep == NULL)
303 lsizep = of_get_property(np, "d-cache-line-size", NULL);
311 if (lsizep != NULL) 304 if (lsizep != NULL)
312 lsize = *lsizep; 305 lsize = *lsizep;
313 if (sizep == 0 || lsizep == 0) 306 if (sizep == 0 || lsizep == 0)
@@ -324,7 +317,9 @@ static void __init initialize_cache_info(void)
324 sizep = of_get_property(np, "i-cache-size", NULL); 317 sizep = of_get_property(np, "i-cache-size", NULL);
325 if (sizep != NULL) 318 if (sizep != NULL)
326 size = *sizep; 319 size = *sizep;
327 lsizep = of_get_property(np, ic, NULL); 320 lsizep = of_get_property(np, "i-cache-block-size", NULL);
321 if (lsizep == NULL)
322 lsizep = of_get_property(np, "i-cache-line-size", NULL);
328 if (lsizep != NULL) 323 if (lsizep != NULL)
329 lsize = *lsizep; 324 lsize = *lsizep;
330 if (sizep == 0 || lsizep == 0) 325 if (sizep == 0 || lsizep == 0)