[Skiboot] [PATCH v3 3/8] chip: Fix pir_to_thread_id for fused cores

Vaidyanathan Srinivasan svaidy at linux.vnet.ibm.com
Mon Mar 25 04:25:38 AEDT 2019


From: Benjamin Herrenschmidt <benh at kernel.crashing.org>

pir_to_core_id() and pir_to_thread_id() are extensively
used by the direct controls code and are expected to return
the "normal" (non-fused, aka EC) core/thread IDs.

Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
Signed-off-by: Michael Neuling <mikey at neuling.org>
---
 core/chip.c    | 6 +++---
 include/chip.h | 7 +++++++
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/core/chip.c b/core/chip.c
index 2b9b6ef9..902327e1 100644
--- a/core/chip.c
+++ b/core/chip.c
@@ -37,12 +37,12 @@ uint32_t pir_to_chip_id(uint32_t pir)
 
 uint32_t pir_to_core_id(uint32_t pir)
 {
-	if (proc_gen == proc_gen_p9)
+	if (proc_gen == proc_gen_p9) {
 		if (this_cpu()->is_fused_core)
 			return P9_PIRFUSED2NORMALCOREID(pir);
 		else
 			return P9_PIR2COREID(pir);
-	else if (proc_gen == proc_gen_p8)
+	} else if (proc_gen == proc_gen_p8)
 		return P8_PIR2COREID(pir);
 	else
 		return P7_PIR2COREID(pir);
@@ -52,7 +52,7 @@ uint32_t pir_to_thread_id(uint32_t pir)
 {
 	if (proc_gen == proc_gen_p9) {
 		if (this_cpu()->is_fused_core)
-			return P9_PIR2FUSEDTHREADID(pir);
+			return P9_PIRFUSED2NORMALTHREADID(pir);
 		else
 			return P9_PIR2THREADID(pir);
 	} else if (proc_gen == proc_gen_p8)
diff --git a/include/chip.h b/include/chip.h
index a73a52d7..afb2e3e9 100644
--- a/include/chip.h
+++ b/include/chip.h
@@ -133,6 +133,8 @@
 	(P9_PIR2FUSEDCOREID(pir) << 1) | \
 	(P9_PIR2FUSEDTHREADID(pir) & 1)
 
+#define P9_PIRFUSED2NORMALTHREADID(pir) (((pir) >> 1) & 0x3)
+
 /* P9 specific ones mostly used by XIVE */
 #define P9_PIR2LOCALCPU(pir) ((pir) & 0xff)
 #define P9_PIRFROMLOCALCPU(chip, cpu)	(((chip) << 8) | (cpu))
@@ -258,6 +260,11 @@ struct proc_chip {
 };
 
 extern uint32_t pir_to_chip_id(uint32_t pir);
+
+/*
+ * Note: In P9 fused-core mode, these will return the "normal"
+ * core ID and thread ID (ie, thread ID 0..3)
+ */
 extern uint32_t pir_to_core_id(uint32_t pir);
 extern uint32_t pir_to_thread_id(uint32_t pir);
 
-- 
2.20.1



More information about the Skiboot mailing list