MIPS: check for D$ line size and CONFIG_MIPS_L1_SHIFT
PATCH 1/1 MIPS: check for D$ line size and CONFIG_MIPS_L1_SHIFT
When a platform overrides the dcache_line_size detection in its cpu-features-override.h file, check that the value matches (1 << CONFIG_MIPS_L1_SHIFT) to ensure both settings are correct.
--- arch/mips/include/asm/cpu-features.h | 4 ++++ 1 file changed, 4 insertions(+)
arch/mips/include/asm/cpu-features.h +4 -0
@@ -279,6 +279,10 @@#ifndef cpu_dcache_line_size#define cpu_dcache_line_size () cpu_data[0].dcache.linesz +#else +#if (cpu_dcache_line_size () != (1 <<CONFIG_MIPS_L1_CACHE_SHIFT )) +#error "cpu_dcache_line_size does not match CONFIG_MIPS_L1_CACHE_SHIFT" +#endif #endif #ifndef cpu_icache_line_size#define cpu_icache_line_size () cpu_data[0].icache.linesz
Signature · 1 line
1.8.3.2
Quoted 3 lines · Florian Fainelli
When a platform overrides the
dcache_line_sizedetection in itscpu-features-override.hfile, check that the value matches (1 <<CONFIG_MIPS_L1_SHIFT) to ensure both settings are correct.
Conceptually wrong - the two values serve an entirely different purpose. dcache_line_size is used for cache maintenance by the MIPS code while CONFIG_MIPS_L1_SHIFT - which has to be a constant due to the way it's being used - are being used to define L1_CACHE_SHIFT in <asm/cache.h> which in turn is being used primarily to optimize the memory layout of various structures for performance - and in case of IP27 we lie, set L1_CACHE_SHIFT to 7 which is the size of the S-cache.
On top of that it breaks the ip27 build.
And while we're at it, the use of CONFIG_MIPS_L1_SHIFT in arch/mips/kernel/vmlinux.lds.S is fishy - but it needs a constant and this should be good enough for all users.
Ralf
2014/1/22 Ralf Baechle <[email protected]>:
Quoted 14 lines · Florian Fainelli
Quoted 4 lines
When a platform overrides the
dcache_line_sizedetection in itscpu-features-override.hfile, check that the value matches (1 <<CONFIG_MIPS_L1_SHIFT) to ensure both settings are correct.Conceptually wrong - the two values serve an entirely different purpose.
dcache_line_sizeis used for cache maintenance by the MIPS code whileCONFIG_MIPS_L1_SHIFT- which has to be a constant due to the way it's being used - are being used to defineL1_CACHE_SHIFTin <asm/cache.h> which in turn is being used primarily to optimize the memory layout of various structures for performance - and in case of IP27 we lie, setL1_CACHE_SHIFTto 7 which is the size of the S-cache.
Quoted 5 lines
On top of that it breaks the ip27 build.
And while we're at it, the use of
CONFIG_MIPS_L1_SHIFTinarch/mips/kernel/vmlinux.lds.Sis fishy - but it needs a constant and this should be good enough for all users.
Fair enough, feel free to revert these commits and fix vmlinux.lds.S while at it.
Signature · 1 line
Florian