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

MIPS: Fix core number detection for MT cores

In cores which implement the MT ASE, the CPUNum in the EBase register is
a concatenation of the core number & the VPE ID within that core. In
order to retrieve the correct core number CPUNum must be shifted
appropriately to remove the VPE ID bits.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6666/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Paul Burton and committed by
Ralf Baechle
30ee615b 968a0734

+5 -1
+5 -1
arch/mips/kernel/cpu-probe.c
··· 23 23 #include <asm/cpu-type.h> 24 24 #include <asm/fpu.h> 25 25 #include <asm/mipsregs.h> 26 + #include <asm/mipsmtregs.h> 26 27 #include <asm/msa.h> 27 28 #include <asm/watch.h> 28 29 #include <asm/elf.h> ··· 422 421 mips_probe_watch_registers(c); 423 422 424 423 #ifndef CONFIG_MIPS_CPS 425 - if (cpu_has_mips_r2) 424 + if (cpu_has_mips_r2) { 426 425 c->core = read_c0_ebase() & 0x3ff; 426 + if (cpu_has_mipsmt) 427 + c->core >>= fls(core_nvpes()) - 1; 428 + } 427 429 #endif 428 430 } 429 431