MIPS: MT: core_nvpes function to retrieve VPE count
authorPaul Burton <paul.burton@imgtec.com>
Thu, 27 Mar 2014 10:57:01 +0000 (10:57 +0000)
committerRalf Baechle <ralf@linux-mips.org>
Mon, 31 Mar 2014 16:17:12 +0000 (18:17 +0200)
This function simply returns the number of VPEs present in the current
core, or 1 if the core does not implement the MT ASE. In SMP kernels
this will typically equal smp_num_siblings, however it will also be
usable in UP kernels and helps prepare for the possibility of a
heterogenous system where the VPE count is not the same across all
cores.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6665/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/include/asm/mipsmtregs.h

index 38b7704ee376917450621baf67bf635d23524792..6efa79a27b6a02e1fad11c60f5a801878f0d92a5 100644 (file)
 
 #ifndef __ASSEMBLY__
 
+static inline unsigned core_nvpes(void)
+{
+       unsigned conf0;
+
+       if (!cpu_has_mipsmt)
+               return 1;
+
+       conf0 = read_c0_mvpconf0();
+       return ((conf0 & MVPCONF0_PVPE) >> MVPCONF0_PVPE_SHIFT) + 1;
+}
+
 static inline unsigned int dvpe(void)
 {
        int res = 0;
This page took 0.042676 seconds and 5 git commands to generate.