Re: [PATCH v7 00/11] powerpc/powernv/cpuidle: Add support for POWER ISA v3 idle states

From: Michael Neuling
Date: Thu Jul 07 2016 - 22:49:25 EST


Except for the issue with patch 7 I've already commented on the rest of
this series is good with me. ÂFWIW:

Acked-by: Michael Neuling <mikey@xxxxxxxxxxx>

Thanks.

On Fri, 2016-07-08 at 02:17 +0530, Shreyas B. Prabhu wrote:
> POWER ISA v3 defines a new idle processor core mechanism. In summary,
> Âa) new instruction named stop is added. This instruction replaces
> instructions like nap, sleep, rvwinkle.
> Âb) new per thread SPR named PSSCR is added which controls the behavior
> of stop instruction.Â
>
> PSSCR has following key fields
> Bits 0:3ÂÂ- Power-Saving Level Status. This field indicates the
> lowest power-saving state the thread entered since stop
> instruction was last executed.
>
> Bit 42 - Enable State LossÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ
> 0 - No state is lost irrespective of other fieldsÂÂ
> 1 - Allows state loss
>
> Bits 44:47 - Power-Saving Level LimitÂÂÂÂÂÂ
> This limits the power-saving level that can be entered into.
>
> Bits 60:63 - Requested LevelÂÂÂÂÂÂÂÂÂÂÂÂÂÂ
> Used to specify which power-saving level must be entered on
> executing stop instruction
>
> Stop idle states and their properties like name, latency, target
> residency, psscr value are exposed via device tree.
>
> This patch series adds support for this new mechanism.
>
> Patches 1-6 are cleanups and code movement.
> Patch 7 adds platform specific support for stop and psscr handling.
> Patch 8 and 9 are minor cleanup in cpuidle driver.
> Patch 10 adds cpuidle driver support.
> Patch 11 makes offlined cpu use deepest stop state.
>
> Note: Documentation for the device tree bindings is posted here-
> http://patchwork.ozlabs.org/patch/629125/
>
> Changes in v7
> =============
> Â- File renamed to idle_book3s.S instead of idle_power_common.S
> Â- Comment changes
> Â- power_stop0, power_stop renamed to power9_idle and power_idle_stop
> Â- PSSCR template is now a macro instead of storing in paca
> Â- power9_idle in C file instead of assembly
> Â- Fixed TOC related bug
> Â- Handling subcore within FTR section
> Â- Functions in idle.c reordered and broken into multiple functions
> Â- calling __restore_cpu_power8/9 via cur_cpu_spec->cpu_restoreÂ
> Â- Added a minor patch with minor cleanups in cpuidle-powernv.c . This
> ÂÂÂwas mainly to make the existing code consistent with the review
> ÂÂÂcomments for new code
> Â- Using stack for variables while probing for idle states instead of
> ÂÂÂkzalloc/kcalloc
>
> Changes in v6
> =============
> Â- Restore new POWER ISA v3 SPRS when waking up from deep idle
>
> Changes in v5
> =============
> Â- Use generic cpuidle constant CPUIDLE_NAME_LEN
> Â- Fix return code handling for of_property_read_string_array
> Â- Use DT flags to determine if are using stop instruction, instead of
> ÂÂÂcpu_has_feature
> Â- Removed uncessary cast with names
> Â- &stop_loop -> stop_loop
> Â- Added POWERNV_THRESHOLD_LATENCY_NS to filter out idle states with high latency
>
> Changes in v4
> =============
> Â- Added a patch to use PNV_THREAD_WINKLE macro while requesting for winkle
> Â- Moved power7_powersave_common rename to more appropriate patch
> Â- renaming power7_enter_nap_mode to pnv_enter_arch207_idle_mode
> Â- Added PSSCR layout to Patch 7's commit message
> Â- Improved / Fixed comments
> Â- Fixed whitespace error in paca.h
> Â- Using MAX_POSSIBLE_STOP_STATE macro instead of hardcoding 0xF has
> ÂÂÂmax possible stop state
>
> Changes in v3
> =============
> Â- Rebased on powerpc-next
> Â- Dropping patch 1 since we are not adding a new file for P9 idle support
> Â- Improved comments in multiple places
> Â- Moved GET_PACA from power7_restore_hyp_resource to System Reset
> Â- Instead of moving few functions from idle_power7 to idle_power_common,
> ÂÂÂrenaming idle_power7.S to idle_power_common.S
> Â- Moved HSTATE_HWTHREAD_STATE updation to power_powersave_common
> Â- Dropped earlier patch 5 which moved few macros from idle_power_common to
> ÂÂÂasm/cpuidle.h.Â
> Â- Added a patch to rename reusable power7_* idle functions to pnv_*
> Â- Added new patch that creates abstraction for saving SPRs before
> ÂÂÂentering deep idle states
> Â- Instead of introducing new file idle_power_stop.S, P9 idle support
> ÂÂÂis added to idle_power_common.S using CPU_FTR sections.
> Â- Fixed r4 reg clobbering in power_stop0
>
> Changes in v2
> =============
> Â- Rebased on v4.6-rc6
> Â- Using CPU_FTR_ARCH_300 bit instead of CPU_FTR_STOP_INST
>
> Cc: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
> Cc: Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>
> Cc: linux-pm@xxxxxxxxxxxxxxx
> Cc: Benjamin Herrenschmidt <benh@xxxxxxxxxxx>
> Cc: Michael Ellerman <mpe@xxxxxxxxxxxxxx>
> Cc: Paul Mackerras <paulus@xxxxxxxxxx>
> Cc: Michael Neuling <mikey@xxxxxxxxxxx>
> Cc: linuxppc-dev@xxxxxxxxxxxxxxxx
> Cc: Rob Herring <robh+dt@xxxxxxxxxx>
> Cc: Lorenzo Pieralisi <Lorenzo.Pieralisi@xxxxxxx>
>
> Shreyas B. Prabhu (11):
> Â powerpc/powernv: Use PNV_THREAD_WINKLE macro while requesting for
> ÂÂÂÂwinkle
> Â powerpc/kvm: make hypervisor state restore a function
> Â powerpc/powernv: Rename idle_power7.S to idle_book3s.S
> Â powerpc/powernv: Rename reusable idle functions to hardware agnostic
> ÂÂÂÂnames
> Â powerpc/powernv: Make pnv_powersave_common more generic
> Â powerpc/powernv: abstraction for saving SPRs before entering deep idle
> ÂÂÂÂstates
> Â powerpc/powernv: Add platform support for stop instruction
> Â cpuidle/powernv: Use CPUIDLE_STATE_MAX instead of
> ÂÂÂÂMAX_POWERNV_IDLE_STATES
> Â cpuidle/powernv: cleanup powernv_add_idle_states
> Â cpuidle/powernv: Add support for POWER ISA v3 idle states
> Â powerpc/powernv: Use deepest stop state when cpu is offlined
>
> Âarch/powerpc/include/asm/cpuidle.hÂÂÂÂÂÂÂÂ|ÂÂÂ2 +
> Âarch/powerpc/include/asm/kvm_book3s_asm.h |ÂÂÂ2 +-
> Âarch/powerpc/include/asm/opal-api.hÂÂÂÂÂÂÂ|ÂÂ11 +-
> Âarch/powerpc/include/asm/ppc-opcode.hÂÂÂÂÂ|ÂÂÂ4 +
> Âarch/powerpc/include/asm/processor.hÂÂÂÂÂÂ|ÂÂÂ2 +
> Âarch/powerpc/include/asm/reg.hÂÂÂÂÂÂÂÂÂÂÂÂ|ÂÂ10 +
> Âarch/powerpc/kernel/MakefileÂÂÂÂÂÂÂÂÂÂÂÂÂÂ|ÂÂÂ2 +-
> Âarch/powerpc/kernel/exceptions-64s.SÂÂÂÂÂÂ|ÂÂ30 +-
> Âarch/powerpc/kernel/idle_book3s.SÂÂÂÂÂÂÂÂÂ| 664 ++++++++++++++++++++++++++++++
> Âarch/powerpc/kernel/idle_power7.SÂÂÂÂÂÂÂÂÂ| 515 -----------------------
> Âarch/powerpc/kvm/book3s_hv_rmhandlers.SÂÂÂ|ÂÂÂ4 +-
> Âarch/powerpc/platforms/powernv/idle.cÂÂÂÂÂ| 185 +++++++--
> Âarch/powerpc/platforms/powernv/powernv.hÂÂ|ÂÂÂ1 +
> Âarch/powerpc/platforms/powernv/smp.cÂÂÂÂÂÂ|ÂÂÂ4 +-
> Âdrivers/cpuidle/cpuidle-powernv.cÂÂÂÂÂÂÂÂÂ|ÂÂ99 ++++-
> Â15 files changed, 940 insertions(+), 595 deletions(-)
> Âcreate mode 100644 arch/powerpc/kernel/idle_book3s.S
> Âdelete mode 100644 arch/powerpc/kernel/idle_power7.S
>