From 20474abda6bb11396434593daf2f52679cf62edf Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt Date: Sun, 28 Oct 2007 08:49:28 +1100 Subject: [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 Signed-off-by: Paul Mackerras --- arch/powerpc/kernel/setup_64.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'arch/powerpc') 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) if ( num_cpus == 1 ) { const u32 *sizep, *lsizep; u32 size, lsize; - const char *dc, *ic; - - /* Then read cache informations */ - if (machine_is(powermac)) { - dc = "d-cache-block-size"; - ic = "i-cache-block-size"; - } else { - dc = "d-cache-line-size"; - ic = "i-cache-line-size"; - } size = 0; lsize = cur_cpu_spec->dcache_bsize; sizep = of_get_property(np, "d-cache-size", NULL); if (sizep != NULL) size = *sizep; - lsizep = of_get_property(np, dc, NULL); + lsizep = of_get_property(np, "d-cache-block-size", NULL); + /* fallback if block size missing */ + if (lsizep == NULL) + lsizep = of_get_property(np, "d-cache-line-size", NULL); if (lsizep != NULL) lsize = *lsizep; if (sizep == 0 || lsizep == 0) @@ -324,7 +317,9 @@ static void __init initialize_cache_info(void) sizep = of_get_property(np, "i-cache-size", NULL); if (sizep != NULL) size = *sizep; - lsizep = of_get_property(np, ic, NULL); + lsizep = of_get_property(np, "i-cache-block-size", NULL); + if (lsizep == NULL) + lsizep = of_get_property(np, "i-cache-line-size", NULL); if (lsizep != NULL) lsize = *lsizep; if (sizep == 0 || lsizep == 0) -- cgit v1.2.3-59-g8ed1b