1# System Power Mode and Idle Power Saver Support 2 3Author: 4Chris Cain 5 6Other contributors: 7Martha Broyles 8 9Created: 1012/03/2020 11 12## Problem Description 13 14Power management on POWER platforms needs assistance from the BMC for 15managing the system power mode and idle power save modes. 16We need the ability to set and query the system power mode and also 17the ability to control and set idle power save parameters. 18This design is only applicable to POWER processors. 19 20## Background and References 21 22Each POWER processor contains an embedded PowerPC 405 processor that is 23referred to as the On Chip Controller or OCC. The OCC provides real time 24power and thermal monitoring and control. 25When a system is powered on, the OCCs will go to an Active state. 26Anytime the OCC state changes to active, the BMC will need to send a 27mode change and idle power saver (IPS) settings to the OCC. It will also 28need to send the commands if the user changes the mode or idle power save 29parameters. 30 31## Requirements 32 33When a system is booted, the OCC will move to an ACTIVE state. In the 34ACTIVE state, the OCC is managing the processor frequency, power consumption, 35and monitoring the systems thermal sensors. For certain error conditions 36it may be necessary to reset the OCC. When this happens, the OCC will move 37out of ACTIVE state. After recovery, the OCC will be put back into the 38ACTIVE state. 39Anytime the OCC state changes to ACTIVE or the customer updates these new 40parameters at runtime, the BMC will need to send the mode and the idle 41power saver settings to the OCC. 42 43PowerMode was added to version 2021.1 Redfish Schema Supplement: 44https://www.dmtf.org/sites/default/files/standards/documents/DSP0268_2021.1.pdf 45 46Current Customer Settable System Power Modes that will be sent to the OCCs: 47 - Static 48 - Power Saver 49 - Maximum Performance 50 51A proposal for adding Idle Power Saving parameters was submitted to the 52Redfish committee and will be used if/when approved. 53 54Customer Settable Idle Power Save Parameters: 55 - Enabled / Disabled 56 - Enter Delay Time (in seconds) 57 - Enter Utilization threshold (percentage) 58 - Exit Delay Time (in seconds) 59 - Exit Utilization threshold (percentage) 60 61Defaults will need to be configurable by the system owner (via JSON file) 62 63## Proposed Design 64The new code would be part of the openpower-occ-control repository. 65New code will be triggered by the following: 66 - OCC poll response data showing a new state of Active (0x03) 67 - OCC Active sensor is enabled (may be covered in above bullet) 68 - Customer updates system power mode user interface or Redfish interface 69 - Customer updates idle power save setting or Redfish interface 70 71Code will need to trigger off of OCC state changes. The kernel currently 72sends a POLL command to the OCC periodically (every second). The OCC state 73is available in the OCC poll response data. 74 75When initiated, the new code will send a SET_MODE_AND_STATE command (0x20) 76to the OCC and a SET_CONFIG_DATA (0x21) command with the Idle Power 77Saver parameters. 78These commands are defined in the OCC Interface Spec: 79https://github.com/open-power/docs/blob/master/occ/OCC_P9_FW_Interfaces.pdf 80 81Default values will also be defined for Power Mode and Idle Power Saver 82parameters for the system. If the customer has not yet set any of these 83parameters, these default values will be used. If/when the customer does 84set any of these, that new customer parameter will become current and the 85default value will no longer be used. 86 87The customer requested PowerMode and Idle Power Saver parameters will 88be stored as D-Bus object in the phosphor-dbus-interfaces repository: 89 xyz/openbmc_project/Control/Power/Mode.interface.yaml 90Once set, these values will be retained across power cycles, AC loss, 91code updates, etc. 92 93## Alternatives Considered 94- Using hardcoded power mode and Idle Power Save parameters (no flexibility 95to control system power usage) 96 97## Impacts 98New interfaces that were described in the requirements section will be 99implemented. Parameters should be able to be set via user interface or 100via Redfish. 101API impact - Add Redfish support for new parameters as well as new user 102interface to allow customer to set power mode and idle power saver settings 103Security impact - update of these parameters should be able to be restricted 104to specific users/groups (may not want any user updating these parameters) 105Documentation impact - need to document new parameters 106Performance impact - minimal, new code will only execute on OCC state change 107which should normally happen once at boot time or when user changes parameters. 108The new code is only sending 2 additional commands which should complete 109within a few seconds. 110Developer impact - code to be written by OCC team with guidance from 111OpenBMC power management team 112Upgradability impact - None 113 114## Testing 115This will be able to be tested by directly updating the power mode and 116idle power saver setting. 117This testing will be automated 118