]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
MIPS: Add function get_ebase_cpunum
authorDavid Daney <david.daney@cavium.com>
Wed, 28 May 2014 21:52:10 +0000 (23:52 +0200)
committerRalf Baechle <ralf@linux-mips.org>
Fri, 30 May 2014 19:01:11 +0000 (21:01 +0200)
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>
arch/mips/include/asm/mipsregs.h
arch/mips/kernel/cpu-probe.c

index fb2d17487ec252f55e1c82de9f31df9f9dd38191..98e9754a4b6b94a913fb9363778a085966c750d0 100644 (file)
@@ -1792,6 +1792,15 @@ __BUILD_SET_C0(brcm_cmt_ctrl)
 __BUILD_SET_C0(brcm_config)
 __BUILD_SET_C0(brcm_mode)
 
+/*
+ * Return low 10 bits of ebase.
+ * Note that under KVM (MIPSVZ) this returns vcpu id.
+ */
+static inline unsigned int get_ebase_cpunum(void)
+{
+       return read_c0_ebase() & 0x3ff;
+}
+
 #endif /* !__ASSEMBLY__ */
 
 #endif /* _ASM_MIPSREGS_H */
index b1b580d69db07e15d046c3235ab8c28fd6de29b1..d74f957c561ee8108f1ba3687002939ab508c0d1 100644 (file)
@@ -423,7 +423,7 @@ static void decode_configs(struct cpuinfo_mips *c)
 
 #ifndef CONFIG_MIPS_CPS
        if (cpu_has_mips_r2) {
-               c->core = read_c0_ebase() & 0x3ff;
+               c->core = get_ebase_cpunum();
                if (cpu_has_mipsmt)
                        c->core >>= fls(core_nvpes()) - 1;
        }