diff options
author | Cyril Bur <cyrilbur@gmail.com> | 2018-04-12 16:01:55 +1000 |
---|---|---|
committer | Alistair Popple <alistair@popple.id.au> | 2018-04-24 13:10:09 +1000 |
commit | 09bc9478937c4ac3b620cff8812fcd44ebca1979 (patch) | |
tree | efafdb5de7bce68724fc63571d29b4fdb0604e53 /libpdbg/p8chip.c | |
parent | cf7daf476c218cbca433cbccc52f53b629083181 (diff) | |
download | pdbg-09bc9478937c4ac3b620cff8812fcd44ebca1979.tar.gz pdbg-09bc9478937c4ac3b620cff8812fcd44ebca1979.zip |
libpdbg/p8chip: Return thread SMT state
Thread status can return the current hardware smt state of a thread
pretty easily, the information is in POW_STATUS_REG which we already
read.
It should be noted that the value read by the scom has nothing to do
with the ppc64_cpu --smt value. The value returned by the hardware is
really how the hardware is operating, it will happy be in SMT1 and
having a thread using the entire core. The other threads to not need to
be asleep for SMT1 to be reported, something like the Linux idle loop
(but without sleep states) will do it. This means that an SMT1 thread
with three others active threads spinning could at any time jump report
SMT4 depending on the load of the system.
Signed-off-by: Cyril Bur <cyrilbur@gmail.com>
Diffstat (limited to 'libpdbg/p8chip.c')
-rw-r--r-- | libpdbg/p8chip.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libpdbg/p8chip.c b/libpdbg/p8chip.c index d68a521..0123042 100644 --- a/libpdbg/p8chip.c +++ b/libpdbg/p8chip.c @@ -42,6 +42,7 @@ #define RAS_STATUS_TS_QUIESCE PPC_BIT(49) #define POW_STATUS_REG 0x4 #define PMC_POW_STATE PPC_BITMASK(4, 5) +#define PMC_POW_SMT PPC_BITMASK(6, 8) #define CORE_POW_STATE PPC_BITMASK(23, 25) #define THREAD_ACTIVE_REG 0x1310e #define THREAD_ACTIVE PPC_BITMASK(0, 7) @@ -124,7 +125,7 @@ static uint64_t get_thread_status(struct thread *thread) /* Read POW status */ CHECK_ERR(pib_read(&thread->target, POW_STATUS_REG, &val)); thread_status = SETFIELD(THREAD_STATUS_STATE, thread_status, GETFIELD(PMC_POW_STATE, val)); - + thread_status = SETFIELD(THREAD_STATUS_SMT, thread_status, GETFIELD(PMC_POW_SMT, val)); /* Clear debug mode */ mode_reg &= ~MR_THREAD_IN_DEBUG; CHECK_ERR(pib_write(&thread->target, RAS_MODE_REG, mode_reg)); |