[Skiboot] [PATCH v5 0/4] Support for Self Save API in OPAL

Pratik Rajesh Sampat psampat at linux.ibm.com
Mon Feb 24 22:35:04 AEDT 2020

v4: https://lists.ozlabs.org/pipermail/skiboot/2020-February/016404.html
v4 --> v5
1. Based on Michael Neuling, updated SPR in device tree list
2. Updated documentation in doc/power-management.rst to elaborate on the
saving and restoring mechanism, along with highlighting the differences
between self-save and self-restore APIs.

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 to add support for the Self saving of registers
and advertises the support for self save and restore along with the list
of SPRs it supports to the device tree.

The node for self-save or self-restore has the attribute:
sprn-bitmask = bitmask where each bit signifies the presence of a SPR

The key difference between self-save and self-restore is the
use-case. If the Kernel expects the SPR to contain a particular value
on waking up from a deep-stop state, that wasn't the value of that SPR
before entering deep stop-state, then self-restore is preferable.
When deep stop states are to be supported in an Ultravisor
environment, since HOMER is in a secure region, the stop-api cannot
update the HOMER if invoked from a context when the OPAL/Kernel is
executing without the ultravisor privilege. In this scenario, at the
time of early OPAL boot, while OPAL has ultravisor privileges, it can
make the self-save stop-api call for all the supported SPRs, so that
the microcode in the HOMER will always save and restore all the
supported SPRs during entry/exit from a deep stop state.

Commit adds support calling into the self save firmware API.
Also adds abstraction for making platform agnostic calls.

Commit adds wrappers for the Self Save API for which an OPAL call can be

Commit adds API to determine the version of the STOP API. This helps to
identify support for self save in the firmware

Commit adds device tree attributes to advertise self save and self
restore functionality along with the register set as a bitmask currently
supported in the firmware. It also uses the versioning API to determine
support for the self-save feature as a whole.

Pratik Rajesh Sampat (2):
  Self save API integration
  Advertise the self-save and self-restore attributes in the device tree

Prem Shanker Jha (2):
  Self Save: Introducing Support for SPR Self Save
  API to verify the STOP API and image compatibility

 .../ibm,opal/power-mgt/self-restore.rst       |  25 +
 .../ibm,opal/power-mgt/self-save.rst          |  25 +
 doc/opal-api/opal-slw-self-save-reg-181.rst   |  49 +
 doc/opal-api/opal-slw-set-reg-100.rst         |   5 +
 doc/power-management.rst                      |  44 +
 hw/slw.c                                      | 201 ++++
 include/opal-api.h                            |   3 +-
 include/p9_stop_api.H                         | 122 ++-
 include/skiboot.h                             |   4 +
 libpore/p9_cpu_reg_restore_instruction.H      |  11 +-
 libpore/p9_hcd_memmap_base.H                  |   7 +
 libpore/p9_stop_api.C                         | 964 ++++++++++--------
 libpore/p9_stop_api.H                         | 141 ++-
 libpore/p9_stop_data_struct.H                 |   4 +-
 libpore/p9_stop_util.H                        |  27 +-
 15 files changed, 1200 insertions(+), 432 deletions(-)
 create mode 100644 doc/device-tree/ibm,opal/power-mgt/self-restore.rst
 create mode 100644 doc/device-tree/ibm,opal/power-mgt/self-save.rst
 create mode 100644 doc/opal-api/opal-slw-self-save-reg-181.rst


More information about the Skiboot mailing list