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

MIPS: Add function get_ebase_cpunum

This returns the CPUNum from the low order Ebase bits.

Signed-off-by: David Daney <david.daney@cavium.com>
Signed-off-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
Cc: linux-mips@linux-mips.org
Cc: James Hogan <james.hogan@imgtec.com>
Cc: kvm@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/7012/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

David Daney and committed by
Ralf Baechle
45b585c8 18a8cd63

+10 -1
+9
arch/mips/include/asm/mipsregs.h
··· 1792 1792 __BUILD_SET_C0(brcm_config) 1793 1793 __BUILD_SET_C0(brcm_mode) 1794 1794 1795 + /* 1796 + * Return low 10 bits of ebase. 1797 + * Note that under KVM (MIPSVZ) this returns vcpu id. 1798 + */ 1799 + static inline unsigned int get_ebase_cpunum(void) 1800 + { 1801 + return read_c0_ebase() & 0x3ff; 1802 + } 1803 + 1795 1804 #endif /* !__ASSEMBLY__ */ 1796 1805 1797 1806 #endif /* _ASM_MIPSREGS_H */
+1 -1
arch/mips/kernel/cpu-probe.c
··· 423 423 424 424 #ifndef CONFIG_MIPS_CPS 425 425 if (cpu_has_mips_r2) { 426 - c->core = read_c0_ebase() & 0x3ff; 426 + c->core = get_ebase_cpunum(); 427 427 if (cpu_has_mipsmt) 428 428 c->core >>= fls(core_nvpes()) - 1; 429 429 }