powerpc/powernv/idle: add a basic stop 0-3 driver for POWER10
Subsystems (2)
Nicholas Piggin
reviewerPATCH 1/1 powerpc/powernv/idle: add a basic stop 0-3 driver for POWER10
This driver does not restore stop > 3 state, so it limits itself to states which do not lose full state or TB.
The POWER10 SPRs are sufficiently different from P9 that it seems easier to split out the P10 code. The POWER10 deep sleep code (e.g., the BHRB restore) has been taken out, but it can be re-added when stop > 3 support is added.
---
re-sending with linuxppc-dev list actually cc'ed
arch/powerpc/include/asm/machdep.h | 2 - arch/powerpc/include/asm/processor.h | 2 +- arch/powerpc/include/asm/reg.h | 1 + arch/powerpc/platforms/powernv/idle.c | 304 ++++++++++++++++++-------- drivers/cpuidle/cpuidle-powernv.c | 2 +- 5 files changed, 213 insertions(+), 98 deletions(-)
arch/powerpc/include/asm/machdep.h +0 -2
@@ -222,8 +222,6 @@ struct machdep_calls {extern void e500_idle (void );extern void power4_idle (void ); -extern void power7_idle (void ); -extern void power9_idle (void );extern void ppc6xx_idle (void );extern void book3e_idle (void );
arch/powerpc/include/asm/processor.h +1 -1
@@ -432,7 +432,7 @@ enum idle_boot_override {IDLE_NO_OVERRIDE = 0, IDLE_POWERSAVE_OFF};extern int powersave_nap;/* set if nap mode can be used in idle loop */ extern void power7_idle_type (unsigned long type); -extern void power9_idle_type (unsigned long stop_psscr_val, +extern void arch300_idle_type (unsigned long stop_psscr_val,unsigned long stop_psscr_mask);extern void flush_instruction_cache (void );
arch/powerpc/include/asm/reg.h +1 -0
@@ -1353,6 +1353,7 @@#define PVR_POWER8NVL 0x004C#define PVR_POWER8 0x004D#define PVR_POWER9 0x004E +#define PVR_POWER10 0x0080#define PVR_BE 0x0070#define PVR_PA6T 0x0090
arch/powerpc/platforms/powernv/idle.c +210 -94
380 lines not on this page · raw message
drivers/cpuidle/cpuidle-powernv.c +1 -1
@@ -141,7 +141,7 @@ static int stop_loop(struct cpuidle_device *dev,struct cpuidle_driver *drv, int index) { - power9_idle_type(stop_psscr_table[index].val, + arch300_idle_type(stop_psscr_table[index].val, stop_psscr_table[index].mask);return index; }
Signature · 1 line
2.23.0
Quoted 8 lines · Nicholas Piggin
This driver does not restore stop > 3 state, so it limits itself to states which do not lose full state or TB.
The POWER10 SPRs are sufficiently different from P9 that it seems easier to split out the P10 code. The POWER10 deep sleep code (e.g., the BHRB restore) has been taken out, but it can be re-added when stop > 3 support is added.
Quoted 5 lines
Cc Ryan P Grimm <[email protected]>Cc Michael Neuling <[email protected]>Cc Gautham R. Shenoy <[email protected]>Cc Pratik Rajesh Sampat <[email protected]>Signed-off-by Nicholas Piggin <[email protected]>
This patch series was tested on P9 and P10. Correct set of stop states were discovered and enabled in the platform.
Further the SPRs saved and restored by this code has also been tested along with cpuidle state tests and cpu offline/online tests.
Thank for patch.
--Vaidy
Quoted 7 lines · Nicholas Piggin
This driver does not restore stop > 3 state, so it limits itself to states which do not lose full state or TB.
The POWER10 SPRs are sufficiently different from P9 that it seems easier to split out the P10 code. The POWER10 deep sleep code (e.g., the BHRB restore) has been taken out, but it can be re-added when stop > 3 support is added.
MMCRA[BHRB] save/restore was in the shallow stop-state path. But we can add it back later.
Quoted 6 lines
Cc Ryan P Grimm <[email protected]>Cc Michael Neuling <[email protected]>Cc Gautham R. Shenoy <[email protected]>Cc Pratik Rajesh Sampat <[email protected]>Signed-off-by Nicholas Piggin <[email protected]>
Just a minor comment below. But otherwise the patch looks good to me.
[..snip..]
Quoted 18 lines
arch/powerpc/platforms/powernv/idle.c +5
-1@@ -1093,11 +1200,15 @@ int validate_psscr_val_mask(u64 *psscr_val, u64 *psscr_mask, u32 flags)* @dt_idle_states: Number of idle state entries * Returns 0 on success */ -static void __init pnv_power9_idle_init (void ) +static void __init pnv_arch300_idle_init (void ) {u64 max_residency_ns =0 ;int i; +/* stop is not really architected, we only have p9,p10 drivers */ +if (!pvr_version_is (PVR_POWER10 ) && !pvr_version_is (PVR_POWER9 )) +return ; +/* * pnv_deepest_stop_{val,mask} should be set to values corresponding to * the deepest stop state.
arch/powerpc/platforms/powernv/idle.c static void __init pnv_power9_idle_init(void) · line 1230
Quoted 8 lines
arch/powerpc/platforms/powernv/idle.c +5
-0@@ -1112,6 +1223,11 @@ static void __init pnv_power9_idle_init(void)struct pnv_idle_states_t *state = &pnv_idle_states[i];u64 psscr_rl = state->psscr_val &PSSCR_RL_MASK ; +/* No deep loss driver implemented for POWER10 yet */ +if (pvr_version_is (PVR_POWER10 ) && + state->flags & (OPAL_PM_TIMEBASE_STOP |OPAL_PM_LOSE_FULL_CONTEXT )) +continue ; +
Should we have a pr_info() informing the user the kernel is skipping over these stop states ?
arch/powerpc/platforms/powernv/idle.c static void __init pnv_power9_idle_init(void) · line 1233
Quoted 3 lines
arch/powerpc/platforms/powernv/idle.c +0
-0if ((state->flags &OPAL_PM_TIMEBASE_STOP ) && (pnv_first_tb_loss_level > psscr_rl)) pnv_first_tb_loss_level = psscr_rl;
--
Thanks and Regards
gautham.
Quoted 8 lines · Nicholas Piggin
This driver does not restore stop > 3 state, so it limits itself to states which do not lose full state or TB.
The POWER10 SPRs are sufficiently different from P9 that it seems easier to split out the P10 code. The POWER10 deep sleep code (e.g., the BHRB restore) has been taken out, but it can be re-added when stop > 3 support is added.
Quoted 6 lines
Cc Ryan P Grimm <[email protected]>Cc Michael Neuling <[email protected]>Cc Gautham R. Shenoy <[email protected]>Cc Pratik Rajesh Sampat <[email protected]>Signed-off-by Nicholas Piggin <[email protected]>
The patch fixes the commit 8747bf36f312 which had setup idle for only for the P9 PVR.
---
Thanks for fixing this!
Pratik
Quoted 8 lines · Nicholas Piggin
This driver does not restore stop > 3 state, so it limits itself to states which do not lose full state or TB.
The POWER10 SPRs are sufficiently different from P9 that it seems easier to split out the P10 code. The POWER10 deep sleep code (e.g., the BHRB restore) has been taken out, but it can be re-added when stop > 3 support is added.
Quoted 6 lines
Cc Ryan P Grimm <[email protected]>Cc Michael Neuling <[email protected]>Cc Gautham R. Shenoy <[email protected]>Cc Pratik Rajesh Sampat <[email protected]>Signed-off-by Nicholas Piggin <[email protected]>
I've tested the patch on P9 and P10, can verify the corresponding code paths are being taken for their respective architecture and cpuidle is being exercised with the correct set of advertised stop states in each case.
The patch looks good to me.
---
Thanks,
Pratik
Michael Ellerman
AppliedQuoted 7 lines · Nicholas Piggin
This driver does not restore stop > 3 state, so it limits itself to states which do not lose full state or TB.
The POWER10 SPRs are sufficiently different from P9 that it seems easier to split out the P10 code. The POWER10 deep sleep code (e.g., the BHRB restore) has been taken out, but it can be re-added when stop > 3 support is added.
Applied to powerpc/next.
[1/1] powerpc/powernv/idle: add a basic stop 0-3 driver for POWER10
https://git.kernel.org/powerpc/c/ffd2961bb41f797eb00b58e019b707555197275e
cheers