Skip to content

Commit 968a073

Browse files
paulburtonralfbaechle
authored andcommitted
MIPS: MT: core_nvpes function to retrieve VPE count
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>
1 parent d94c90f commit 968a073

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎arch/mips/include/asm/mipsmtregs.h‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,17 @@
176176

177177
#ifndef __ASSEMBLY__
178178

179+
static inline unsigned core_nvpes(void)
180+
{
181+
unsigned conf0;
182+
183+
if (!cpu_has_mipsmt)
184+
return 1;
185+
186+
conf0 = read_c0_mvpconf0();
187+
return ((conf0 & MVPCONF0_PVPE) >> MVPCONF0_PVPE_SHIFT) + 1;
188+
}
189+
179190
static inline unsigned int dvpe(void)
180191
{
181192
int res = 0;

0 commit comments

Comments
 (0)