MIPS: smp-cps: Avoid BUG() when offlining pre-r6 CPUs
authorMatt Redfearn <[email protected]>
Thu, 22 Sep 2016 10:59:47 +0000 (11:59 +0100)
committerRalf Baechle <[email protected]>
Thu, 29 Sep 2016 16:59:49 +0000 (18:59 +0200)
Commit 0d2808f338c7 ("MIPS: smp-cps: Add support for CPU hotplug of
MIPSr6 processors") added a call to mips_cm_lock_other in order to lock
the CPC in CPUs containing a version 3 or higher Coherence Manager,
which use the general CM core other register, where previous CMs had a
dedicated core other register for the CPC.

A kernel BUG() is triggered, however, if mips_cm_lock_other is called
with a VP other than 0 on a CPU with CM < 3, a condition introduced by
0d2808f338c7.

Avoid the BUG() by always locking VP0 when locking the CPC, since the
required register, cpc_stat_conf, is shared by all vps in a core.

Fixes: 0d2808f338c7 ("MIPS: smp-cps: Add support for CPU hotplug...)
Signed-off-by: Matt Redfearn <[email protected]>
Cc: Qais Yousef <[email protected]>
Cc: Masahiro Yamada <[email protected]>
Cc: James Hogan <[email protected]>
Cc: Paul Burton <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: [email protected]
Cc: [email protected]
Patchwork: https://patchwork.linux-mips.org/patch/14297/
Signed-off-by: Ralf Baechle <[email protected]>
arch/mips/kernel/smp-cps.c

index e9d9fc6c754c3b11283500ef8a5a72222a7a5b1a..6183ad84cc734501ddad895dbb640d44a34341de 100644 (file)
@@ -513,7 +513,7 @@ static void cps_cpu_die(unsigned int cpu)
                 * in which case the CPC will refuse to power down the core.
                 */
                do {
-                       mips_cm_lock_other(core, vpe_id);
+                       mips_cm_lock_other(core, 0);
                        mips_cpc_lock_other(core);
                        stat = read_cpc_co_stat_conf();
                        stat &= CPC_Cx_STAT_CONF_SEQSTATE_MSK;