diff options
author | Leonid Yegoshin <Leonid.Yegoshin@imgtec.com> | 2013-09-11 15:17:47 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2013-09-13 05:59:51 -0400 |
commit | 670bac3a8c201fc1f5f92ac6b4a8b42dc8172937 (patch) | |
tree | 45fd83bde9a24dd549ac05bc20b51bc1b21df769 | |
parent | 5359b938c088423a28c41499f183cd10824c1816 (diff) |
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>
-rw-r--r-- | arch/mips/kernel/smp-cmp.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/arch/mips/kernel/smp-cmp.c b/arch/mips/kernel/smp-cmp.c index c2e5d74739b4..5969f1e9b62a 100644 --- a/arch/mips/kernel/smp-cmp.c +++ b/arch/mips/kernel/smp-cmp.c | |||
@@ -99,7 +99,9 @@ static void cmp_init_secondary(void) | |||
99 | 99 | ||
100 | c->core = (read_c0_ebase() >> 1) & 0x1ff; | 100 | c->core = (read_c0_ebase() >> 1) & 0x1ff; |
101 | #if defined(CONFIG_MIPS_MT_SMP) || defined(CONFIG_MIPS_MT_SMTC) | 101 | #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; | ||
103 | #endif | 105 | #endif |
104 | #ifdef CONFIG_MIPS_MT_SMTC | 106 | #ifdef CONFIG_MIPS_MT_SMTC |
105 | c->tc_id = (read_c0_tcbind() & TCBIND_CURTC) >> TCBIND_CURTC_SHIFT; | 107 | c->tc_id = (read_c0_tcbind() & TCBIND_CURTC) >> TCBIND_CURTC_SHIFT; |
@@ -177,9 +179,16 @@ void __init cmp_smp_setup(void) | |||
177 | } | 179 | } |
178 | 180 | ||
179 | if (cpu_has_mipsmt) { | 181 | 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(); | ||
181 | 189 | ||
182 | nvpe = ((mvpconf0 & MVPCONF0_PTC) >> MVPCONF0_PTC_SHIFT) + 1; | 190 | nvpe = ((mvpconf0 & MVPCONF0_PTC) >> MVPCONF0_PTC_SHIFT) + 1; |
191 | #endif | ||
183 | smp_num_siblings = nvpe; | 192 | smp_num_siblings = nvpe; |
184 | } | 193 | } |
185 | pr_info("Detected %i available secondary CPU(s)\n", ncpu); | 194 | pr_info("Detected %i available secondary CPU(s)\n", ncpu); |