Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: Fix early CM probing

Commit c014d164f21d ("MIPS: Add platform callback before initializing
the L2 cache") added a platform_early_l2_init function in order to allow
platforms to probe for the CM before L2 initialisation is performed, so
that CM GCRs are available to mips_sc_probe.

That commit actually fails to do anything useful, since it checks
mips_cm_revision to determine whether it should call mips_cm_probe but
the result of mips_cm_revision will always be 0 until mips_cm_probe has
been called. Thus the "early" mips_cm_probe call never occurs.

Fix this & drop the useless weak platform_early_l2_init function by
simply calling mips_cm_probe from setup_arch. For platforms that don't
select CONFIG_MIPS_CM this will be a no-op, and for those that do it
removes the requirement for them to call mips_cm_probe manually
(although doing so isn't harmful for now).

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
Cc: Andrzej Hajda <a.hajda@samsung.com>
Cc: Aaro Koskinen <aaro.koskinen@nokia.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Rob Herring <robh@kernel.org>
Cc: Peter Hurley <peter@hurleysoftware.com>
Cc: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Cc: Jaedon Shin <jaedon.shin@gmail.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: Jonas Gorski <jogo@openwrt.org>
Cc: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/12475/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Paul Burton and committed by
Ralf Baechle
3af5a67c e6c058f9

+1 -18
+1
arch/mips/kernel/setup.c
··· 782 782 void __init setup_arch(char **cmdline_p) 783 783 { 784 784 cpu_probe(); 785 + mips_cm_probe(); 785 786 prom_init(); 786 787 787 788 setup_early_fdc_console();
-10
arch/mips/mm/sc-mips.c
··· 181 181 return 1; 182 182 } 183 183 184 - void __weak platform_early_l2_init(void) 185 - { 186 - } 187 - 188 184 static inline int __init mips_sc_probe(void) 189 185 { 190 186 struct cpuinfo_mips *c = &current_cpu_data; ··· 189 193 190 194 /* Mark as not present until probe completed */ 191 195 c->scache.flags |= MIPS_CACHE_NOT_PRESENT; 192 - 193 - /* 194 - * Do we need some platform specific probing before 195 - * we configure L2? 196 - */ 197 - platform_early_l2_init(); 198 196 199 197 if (mips_cm_revision() >= CM_REV_CM3) 200 198 return mips_sc_probe_cm3();
-8
arch/mips/mti-malta/malta-init.c
··· 293 293 console_config(); 294 294 #endif 295 295 /* Early detection of CMP support */ 296 - mips_cm_probe(); 297 296 mips_cpc_probe(); 298 297 299 298 if (!register_cps_smp_ops()) ··· 302 303 if (!register_vsmp_smp_ops()) 303 304 return; 304 305 register_up_smp_ops(); 305 - } 306 - 307 - void platform_early_l2_init(void) 308 - { 309 - /* L2 configuration lives in the CM3 */ 310 - if (mips_cm_revision() >= CM_REV_CM3) 311 - mips_cm_probe(); 312 306 }