[Skiboot] [RFC PATCH 0/2] New device-tree format & Opal based idle save-restore

Akshay Adiga akshay.adiga at linux.vnet.ibm.com
Thu Aug 2 14:45:05 AEST 2018


The series include two major things:
1) Proposed new device tree format for idle states.
2) Support for OPAL based idle save-restore

Here is a proposal for a new device-tree format :
       power-mgt {
            ...
         ibm,enabled-stop-levels = <0xec000000>;
         ibm,cpu-idle-state-psscr-mask = <0x0 0x3003ff 0x0 0x3003ff>;
         ibm,cpu-idle-state-latencies-ns = <0x3e8 0x7d0>;
         ibm,cpu-idle-state-psscr = <0x0 0x330 0x0 0x300330>;
         ibm,cpu-idle-state-flags = <0x100000 0x101000>;
         ibm,cpu-idle-state-residency-ns = <0x2710 0x4e20>;
         ibm,idle-states {
                     stop4 {
                         flags = <0x207000>;
                         compatible = "ibm,state-v1",
                                      "cpuidle",
                                      "opal-supported";
                         psscr-mask = <0x0 0x3003ff>;
                         handle = <0x102>;
                         latency-ns = <0x186a0>;
                         residency-ns = <0x989680>;
                         psscr = <0x0 0x300374>;
                  };
                    ...
                    stop11 {
                     ...
                         compatible = "ibm,state-v1",
                                      "cpuoffline",
                                      "opal-supported";
                         ...
                  };
             };

TODO:
 - Add seperate latency/residency for OPAL call.

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.

Using the new format 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 . Also has been tested for
regression on POWER8.

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

Akshay Adiga (1):
  SLW: Add new idle device-tree format

 hw/chiptod.c        |   7 +-
 hw/slw.c            | 271 ++++++++++++++++++++++++++++++++++++++++----
 include/opal-api.h  |   6 +-
 include/processor.h |  13 +++
 4 files changed, 275 insertions(+), 22 deletions(-)

-- 
2.18.0.rc2.85.g1fb9df7



More information about the Skiboot mailing list