aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2020-08-04 23:02:19 +0530
committerOliver O'Halloran <oohall@gmail.com>2020-08-07 16:00:20 +1000
commit6b403d06b7a72590648fe4f791214c13caacc674 (patch)
treef9290e663ad36b0e578a3b1531c97e64460d965d /core
parent1629c851c57e5f86ce92516de778afa8aa12f712 (diff)
downloadskiboot-6b403d06b7a72590648fe4f791214c13caacc674.zip
skiboot-6b403d06b7a72590648fe4f791214c13caacc674.tar.gz
skiboot-6b403d06b7a72590648fe4f791214c13caacc674.tar.bz2
cpu: Make cpu_get_core_index() return the fused core number
cpu_get_core_index() currently uses pir_to_core_id() which returns an EC number always (ie, a normal core number) even in fused core mode. This is inconsistent with cpu_get_thread_index() which returns a thread within a fused core (0...7) on P9. So let's make things consistent and document it. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Vaidyanathan Srinivasan <svaidy@linux.ibm.com> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Diffstat (limited to 'core')
-rw-r--r--core/chip.c13
-rw-r--r--core/cpu.c2
2 files changed, 14 insertions, 1 deletions
diff --git a/core/chip.c b/core/chip.c
index c57694a..f1269d3 100644
--- a/core/chip.c
+++ b/core/chip.c
@@ -34,6 +34,19 @@ uint32_t pir_to_core_id(uint32_t pir)
assert(false);
}
+uint32_t pir_to_fused_core_id(uint32_t pir)
+{
+ if (proc_gen == proc_gen_p9) {
+ if (this_cpu()->is_fused_core)
+ return P9_PIR2FUSEDCOREID(pir);
+ else
+ return P9_PIR2COREID(pir);
+ } else if (proc_gen == proc_gen_p8)
+ return P8_PIR2COREID(pir);
+ else
+ assert(false);
+}
+
uint32_t pir_to_thread_id(uint32_t pir)
{
if (proc_gen == proc_gen_p9) {
diff --git a/core/cpu.c b/core/cpu.c
index 9d2cd56..ff0442a 100644
--- a/core/cpu.c
+++ b/core/cpu.c
@@ -866,7 +866,7 @@ struct cpu_thread *first_available_core_in_chip(u32 chip_id)
uint32_t cpu_get_core_index(struct cpu_thread *cpu)
{
- return pir_to_core_id(cpu->pir);
+ return pir_to_fused_core_id(cpu->pir);
}
void cpu_remove_node(const struct cpu_thread *t)