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