[Skiboot] [RFC 0/1] Saving and restoring of SPRs in opal

Abhishek Goel huntbag at linux.vnet.ibm.com
Fri Jul 20 21:00:50 AEST 2018


Currently before we enter the stop state, Kernel saves the state
of the resources that can get lost on entering a stop state, and on
subsequently waking up from the stop state, it restores
back/reinitializes the state of those resources. The knowledge of what
is lost and restored is currently hard-coded in the kernel. As newer
stop states are defined, or as the old stop states are redefined on
newer platforms, this code will become hard to maintain.

There is a proposal for a new device-tree format
[Ref:https://patchwork.ozlabs.org/patch/923120/] where we would want
to quantify which resources etc are lost. While we would be able to
effectively describe the extent of state loss for the shallow stop
states (list of SPRs), in the case of deeper stop states, which can
end up losing timebase, SCOMs and any other things, it may not be
possible to completely describe the extent of the state-loss via
device tree.

In this work, we propose to address this problem by adding the
capability to perform the pre-stop-entry and post-stop-wakeup actions
inside OPAL. The compatibility string in the new device-tree format
can indicate whether the OPAL support exists for particular stop
states. When a kernel discovers a stop state through the device-tree,
it can enable the stop state as long as the OPAL support exists for
it, even if the Kernel is not aware of it. This also helps in
forward-compatibility where a older kernel can still utilize a newly
defined stop states or a redefined stop-state on a new platform, as
long as it is running on the right version of OPAL.

To achieve this, in this work, we need to add a pair of OPAL calls for
the kernel to call into , for saving the state before entering stop
and subsequently restoring the state while exiting from stop.

The kernel code is also modified to call into OPAL for
saving/restoring states for deeper stop states.

This patch is posted to get feedback on the approach and the ABI of the
new OPAL calls, if anything needs to be added/removed.

The current patch has been tested on POWER9 where we have validated
that the CPUs enter/exit stop4 and stop5.

The patch has been tested for regression on POWER8.

Abhishek Goel (1):
  OPAL : Support spr save-restore using new opal call

 hw/chiptod.c        |   7 ++-
 hw/slw.c            | 145 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 include/opal-api.h  |   6 ++-
 include/processor.h |  12 +++++
 4 files changed, 168 insertions(+), 2 deletions(-)

-- 
2.14.1



More information about the Skiboot mailing list