aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Ellerman <mpe@ellerman.id.au>2014-05-23 04:15:27 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2014-05-27 23:35:35 -0400
commit5853aef1ac5c5d83076203e840ca463857a7515d (patch)
tree0446a6c5855dd6cf1e7aec37b9ea6f5651c4f579
parent8d6f7c5aa3db6f3e5e43d09f8a0166c7d96f33f3 (diff)
powerpc: Add threads_per_subcore
On POWER8 we have a new concept of a subcore. This is what happens when you take a regular core and split it. A subcore is a grouping of two or four SMT threads, as well as a handfull of SPRs which allows the subcore to appear as if it were a core from the point of view of a guest. Unlike threads_per_core which is fixed at boot, threads_per_subcore can change while the system is running. Most code will not want to use threads_per_subcore. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--arch/powerpc/include/asm/cputhreads.h7
-rw-r--r--arch/powerpc/kernel/setup-common.c4
2 files changed, 10 insertions, 1 deletions
diff --git a/arch/powerpc/include/asm/cputhreads.h b/arch/powerpc/include/asm/cputhreads.h
index ac3eedb9b74a..2bf8e9307be9 100644
--- a/arch/powerpc/include/asm/cputhreads.h
+++ b/arch/powerpc/include/asm/cputhreads.h
@@ -18,10 +18,12 @@
18 18
19#ifdef CONFIG_SMP 19#ifdef CONFIG_SMP
20extern int threads_per_core; 20extern int threads_per_core;
21extern int threads_per_subcore;
21extern int threads_shift; 22extern int threads_shift;
22extern cpumask_t threads_core_mask; 23extern cpumask_t threads_core_mask;
23#else 24#else
24#define threads_per_core 1 25#define threads_per_core 1
26#define threads_per_subcore 1
25#define threads_shift 0 27#define threads_shift 0
26#define threads_core_mask (CPU_MASK_CPU0) 28#define threads_core_mask (CPU_MASK_CPU0)
27#endif 29#endif
@@ -74,6 +76,11 @@ static inline int cpu_thread_in_core(int cpu)
74 return cpu & (threads_per_core - 1); 76 return cpu & (threads_per_core - 1);
75} 77}
76 78
79static inline int cpu_thread_in_subcore(int cpu)
80{
81 return cpu & (threads_per_subcore - 1);
82}
83
77static inline int cpu_first_thread_sibling(int cpu) 84static inline int cpu_first_thread_sibling(int cpu)
78{ 85{
79 return cpu & ~(threads_per_core - 1); 86 return cpu & ~(threads_per_core - 1);
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 3cf25c89469d..aa0f5edd8570 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -390,9 +390,10 @@ void __init check_for_initrd(void)
390 390
391#ifdef CONFIG_SMP 391#ifdef CONFIG_SMP
392 392
393int threads_per_core, threads_shift; 393int threads_per_core, threads_per_subcore, threads_shift;
394cpumask_t threads_core_mask; 394cpumask_t threads_core_mask;
395EXPORT_SYMBOL_GPL(threads_per_core); 395EXPORT_SYMBOL_GPL(threads_per_core);
396EXPORT_SYMBOL_GPL(threads_per_subcore);
396EXPORT_SYMBOL_GPL(threads_shift); 397EXPORT_SYMBOL_GPL(threads_shift);
397EXPORT_SYMBOL_GPL(threads_core_mask); 398EXPORT_SYMBOL_GPL(threads_core_mask);
398 399
@@ -401,6 +402,7 @@ static void __init cpu_init_thread_core_maps(int tpc)
401 int i; 402 int i;
402 403
403 threads_per_core = tpc; 404 threads_per_core = tpc;
405 threads_per_subcore = tpc;
404 cpumask_clear(&threads_core_mask); 406 cpumask_clear(&threads_core_mask);
405 407
406 /* This implementation only supports power of 2 number of threads 408 /* This implementation only supports power of 2 number of threads