Skip to content

Commit 670bac3

Browse files
Leonid Yegoshinralfbaechle
authored andcommitted
MIPS: Fix SMP core calculations when using MT support.
The TCBIND register is only available if the core has MT support. It should not be read otherwise. Secondly, the number of TCs (siblings) are calculated differently depending on if the kernel is configured as SMVP or SMTC. Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com> Signed-off-by: Steven J. Hill <Steven.Hill@imgtec.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/5822/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
1 parent 5359b93 commit 670bac3

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

arch/mips/kernel/smp-cmp.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ static void cmp_init_secondary(void)
9999

100100
c->core = (read_c0_ebase() >> 1) & 0x1ff;
101101
#if defined(CONFIG_MIPS_MT_SMP) || defined(CONFIG_MIPS_MT_SMTC)
102-
c->vpe_id = (read_c0_tcbind() >> TCBIND_CURVPE_SHIFT) & TCBIND_CURVPE;
102+
if (cpu_has_mipsmt)
103+
c->vpe_id = (read_c0_tcbind() >> TCBIND_CURVPE_SHIFT) &
104+
TCBIND_CURVPE;
103105
#endif
104106
#ifdef CONFIG_MIPS_MT_SMTC
105107
c->tc_id = (read_c0_tcbind() & TCBIND_CURTC) >> TCBIND_CURTC_SHIFT;
@@ -177,9 +179,16 @@ void __init cmp_smp_setup(void)
177179
}
178180

179181
if (cpu_has_mipsmt) {
180-
unsigned int nvpe, mvpconf0 = read_c0_mvpconf0();
182+
unsigned int nvpe = 1;
183+
#ifdef CONFIG_MIPS_MT_SMP
184+
unsigned int mvpconf0 = read_c0_mvpconf0();
185+
186+
nvpe = ((mvpconf0 & MVPCONF0_PVPE) >> MVPCONF0_PVPE_SHIFT) + 1;
187+
#elif defined(CONFIG_MIPS_MT_SMTC)
188+
unsigned int mvpconf0 = read_c0_mvpconf0();
181189

182190
nvpe = ((mvpconf0 & MVPCONF0_PTC) >> MVPCONF0_PTC_SHIFT) + 1;
191+
#endif
183192
smp_num_siblings = nvpe;
184193
}
185194
pr_info("Detected %i available secondary CPU(s)\n", ncpu);

0 commit comments

Comments
 (0)