[PATCH v5 0/3] Introduce Self-Save API for deep stop states
Pratik Rajesh Sampat
psampat at linux.ibm.com
Wed Mar 18 01:10:15 AEDT 2020
Skiboot patches v4: https://lists.ozlabs.org/pipermail/skiboot/2020-February/016404.html
Linux patches v4: https://lkml.org/lkml/2020/2/12/446
Changelog
v4 --> v5
Based on Michael Ellerman's comments, in patch3:
1. Added documentation in power-mgt.txt for self-save and self-restore
2. Used bitmap abstractions while parsing device tree
3. Fixed scenario where zero or less SPRs were treated as a success
4. Removed redundant device_node pointer
5. Removed unnecessary pr_warn messages
6. Changed the old of_find_node_by_path calls to of_find_compatible_node
7. Fixed leaking reference of the parsed device_node pointer
Currently the stop-API supports a mechanism called as self-restore
which allows us to restore the values of certain SPRs on wakeup from a
deep-stop state to a desired value. To use this, the Kernel makes an
OPAL call passing the PIR of the CPU, the SPR number and the value to
which the SPR should be restored when that CPU wakes up from a deep
stop state.
Recently, a new feature, named self-save has been enabled in the
stop-api, which is an alternative mechanism to do the same, except
that self-save will save the current content of the SPR before
entering a deep stop state and also restore the content back on
waking up from a deep stop state.
This patch series aims at introducing and leveraging the self-save feature in
the kernel.
Now, as the kernel has a choice to prefer one mode over the other and
there can be registers in both the save/restore SPR list which are sent
from the device tree, a new interface has been defined for the seamless
handing of the modes for each SPR.
A list of preferred SPRs are maintained in the kernel which contains two
properties:
1. supported_mode: Helps in identifying if it strictly supports self
save or restore or both.
Initialized using the information from device tree.
2. preferred_mode: Calls out what mode is preferred for each SPR. It
could be strictly self save or restore, or it can also
determine the preference of mode over the other if both
are present by encapsulating the other in bitmask from
LSB to MSB.
Initialized statically.
Below is a table to show the Scenario::Consequence when the self save and
self restore modes are available or disabled in different combinations as
perceived from the device tree thus giving complete backwards compatibly
regardless of an older firmware running a newer kernel or vise-versa.
Support for self save or self-restore is embedded in the device tree,
along with the set of registers it supports.
SR = Self restore; SS = Self save
.-----------------------------------.----------------------------------------.
| Scenario | Consequence |
:-----------------------------------+----------------------------------------:
| Legacy Firmware. No SS or SR node | Self restore is called for all |
| | supported SPRs |
:-----------------------------------+----------------------------------------:
| SR: !active SS: !active | Deep stop states disabled |
:-----------------------------------+----------------------------------------:
| SR: active SS: !active | Self restore is called for all |
| | supported SPRs |
:-----------------------------------+----------------------------------------:
| SR: active SS: active | Goes through the preferences for each |
| | SPR and executes of the modes |
| | accordingly. Currently, Self restore is|
| | called for all the SPRs except PSSCR |
| | which is self saved |
:-----------------------------------+----------------------------------------:
| SR: active(only HID0) SS: active | Self save called for all supported |
| | registers expect HID0 (as HID0 cannot |
| | be self saved currently) |
:-----------------------------------+----------------------------------------:
| SR: !active SS: active | currently will disable deep states as |
| | HID0 is needed to be self restored and |
| | cannot be self saved |
'-----------------------------------'----------------------------------------'
Pratik Rajesh Sampat (3):
powerpc/powernv: Interface to define support and preference for a SPR
powerpc/powernv: Introduce Self save support
powerpc/powernv: Parse device tree, population of SPR support
.../bindings/powerpc/opal/power-mgt.txt | 10 +
arch/powerpc/include/asm/opal-api.h | 3 +-
arch/powerpc/include/asm/opal.h | 1 +
arch/powerpc/platforms/powernv/idle.c | 416 +++++++++++++++---
arch/powerpc/platforms/powernv/opal-call.c | 1 +
5 files changed, 373 insertions(+), 58 deletions(-)
--
2.17.1
More information about the Linuxppc-dev
mailing list