[Pdbg] [PATCH 05/10] libpdbg: implement fused-core and lpar-per-thread thread status

Nicholas Piggin npiggin at gmail.com
Tue May 31 19:14:52 AEST 2022


Like smt_state, these are really a per-core state but for now they are
put in the thread_state. A future change will use fused-core, and the
lpar mode may be generally useful to know in some situations.

Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
---
 libpdbg/libpdbg.h | 2 ++
 libpdbg/p10chip.c | 3 +++
 libpdbg/p8chip.c  | 3 +++
 libpdbg/p9chip.c  | 3 +++
 4 files changed, 11 insertions(+)

diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h
index 05e54f76..252b1b16 100644
--- a/libpdbg/libpdbg.h
+++ b/libpdbg/libpdbg.h
@@ -1043,6 +1043,8 @@ enum pdbg_smt_state {
 struct thread_state {
 	bool active;
 	bool quiesced;
+	bool lpar_per_thread;
+	bool fused_core_mode;
 	enum pdbg_sleep_state sleep_state;
 	enum pdbg_smt_state smt_state;
 };
diff --git a/libpdbg/p10chip.c b/libpdbg/p10chip.c
index 70481f1f..632a1a9c 100644
--- a/libpdbg/p10chip.c
+++ b/libpdbg/p10chip.c
@@ -107,6 +107,9 @@ struct thread_state p10_thread_state(struct thread *thread)
 	else
 		thread_state.sleep_state = PDBG_THREAD_STATE_RUN;
 
+	thread_state.lpar_per_thread = !(value & PPC_BIT(62));
+	thread_state.fused_core_mode = !!(value & PPC_BIT(63));
+
 	return thread_state;
 }
 
diff --git a/libpdbg/p8chip.c b/libpdbg/p8chip.c
index 5b2a90a9..0592ca08 100644
--- a/libpdbg/p8chip.c
+++ b/libpdbg/p8chip.c
@@ -247,6 +247,9 @@ static struct thread_state p8_thread_state(struct thread *thread)
 	/* Clear debug mode */
 	pib_write(&thread->target, RAS_MODE_REG, mode_reg);
 
+	thread_state.lppar_per_thread = false;
+	thread_state.fused_core_mode = false;
+
 	return thread_status;
 }
 
diff --git a/libpdbg/p9chip.c b/libpdbg/p9chip.c
index 0040402c..036be521 100644
--- a/libpdbg/p9chip.c
+++ b/libpdbg/p9chip.c
@@ -128,6 +128,9 @@ struct thread_state p9_thread_state(struct thread *thread)
 	else
 		thread_state.sleep_state = PDBG_THREAD_STATE_RUN;
 
+	thread_state.lpar_per_thread = !(value & PPC_BIT(62));
+	thread_state.fused_core_mode = !!(value & PPC_BIT(63));
+
 	return thread_state;
 }
 
-- 
2.35.1



More information about the Pdbg mailing list