diff mbox series

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

Message ID 20220531091457.2208488-6-npiggin@gmail.com
State New
Headers show
Series [01/10] sbefifo: correct typo in thread target name | expand

Commit Message

Nicholas Piggin May 31, 2022, 9:14 a.m. UTC
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@gmail.com>
---
 libpdbg/libpdbg.h | 2 ++
 libpdbg/p10chip.c | 3 +++
 libpdbg/p8chip.c  | 3 +++
 libpdbg/p9chip.c  | 3 +++
 4 files changed, 11 insertions(+)

Comments

Joel Stanley Aug. 4, 2022, 5:45 a.m. UTC | #1
On Tue, 31 May 2022 at 09:15, Nicholas Piggin <npiggin@gmail.com> wrote:
>
> 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@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;

There were a few typos here that I fixed when applying:

-       thread_state.lppar_per_thread = false;
-       thread_state.fused_core_mode = false;
+       thread_status.lpar_per_thread = false;
+       thread_status.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
>
> --
> Pdbg mailing list
> Pdbg@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/pdbg
diff mbox series

Patch

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;
 }