xref: /openbmc/docs/designs/state-management-and-external-interfaces.md (revision f4febd002df578bad816239b70950f84ea4567e8)
1838fa962SJason M. Bills# OpenBMC State Management and External Interfaces
2838fa962SJason M. Bills
3838fa962SJason M. BillsAuthor: Andrew Geissler (geissonator)
4838fa962SJason M. Bills
5*f4febd00SPatrick WilliamsOther contributors: Jason Bills (jmbills)
6838fa962SJason M. Bills
7838fa962SJason M. BillsCreated: Jan 22, 2020
8838fa962SJason M. Bills
9838fa962SJason M. Bills## Problem Description
10838fa962SJason M. Bills
11838fa962SJason M. BillsAs OpenBMC moves to fully supporting the Redfish protocol, it's important to
12838fa962SJason M. Billshave the appropriate support within OpenBMC for the [ResetType][1] within the
13838fa962SJason M. BillsResource schema. OpenBMC currently has limited support and the goal with this
14838fa962SJason M. Billsdesign is to get that support more complete.
15838fa962SJason M. Bills
16838fa962SJason M. BillsPlease note that the focus of this document is on the following `ResetType`
17838fa962SJason M. Billsinstance: `redfish/v1/Systems/system/Actions/ComputerSystem.Reset`
18838fa962SJason M. Bills
19838fa962SJason M. BillsThis support will also map to the existing IPMI Chassis Control command.
20838fa962SJason M. Bills
21838fa962SJason M. Bills## Background and References
22838fa962SJason M. Bills
23838fa962SJason M. Bills[phoshor-state-manager][2] implements the xyz.openbmc_project.State.\*
24838fa962SJason M. Billsinterfaces. These interfaces control and track the state of the BMC, Chassis,
25*f4febd00SPatrick Williamsand Host within an OpenBMC managed system. The README within the repository can
26*f4febd00SPatrick Williamsprovide some further background information. [bmcweb][3], OpenBMC's web server
27*f4febd00SPatrick Williamsand front end Redfish interface, then maps commands to the ResetType object to
28*f4febd00SPatrick Williamsthe appropriate xyz.openbmc_project.State.\* D-Bus interface.
29838fa962SJason M. Bills
30*f4febd00SPatrick WilliamsThe goal with this design is to enhance the xyz.openbmc_project.State.\*
31*f4febd00SPatrick Williamsinterfaces to support more of the Redfish ResetType. Specifically this design is
32*f4febd00SPatrick Williamslooking to support the capability to reboot an operating system on a system
33838fa962SJason M. Billswithout cycling power to the chassis.
34838fa962SJason M. Bills
35838fa962SJason M. BillsCurrently phosphor-state-manager supports the following:
36*f4febd00SPatrick Williams
37838fa962SJason M. Bills- Chassis: On/Off
38838fa962SJason M. Bills- Host: On/Off/Reboot
39838fa962SJason M. Bills
40838fa962SJason M. BillsThe `Reboot` to the host currently causes a power cycle to the chassis.
41838fa962SJason M. Bills
42838fa962SJason M. Bills### Redfish
43838fa962SJason M. Bills
44838fa962SJason M. BillsThe Redfish [ResetType][1] has the following operations associated with it:
45*f4febd00SPatrick Williams
46838fa962SJason M. Bills```
47838fa962SJason M. Bills"ResetType": {
48838fa962SJason M. Bills    "enum": [
49838fa962SJason M. Bills        "On",
50838fa962SJason M. Bills        "ForceOff",
51838fa962SJason M. Bills        "GracefulShutdown",
52838fa962SJason M. Bills        "GracefulRestart",
53838fa962SJason M. Bills        "ForceRestart",
54838fa962SJason M. Bills        "Nmi",
55838fa962SJason M. Bills        "ForceOn",
56838fa962SJason M. Bills        "PushPowerButton",
57838fa962SJason M. Bills        "PowerCycle"
58838fa962SJason M. Bills    ],
59838fa962SJason M. Bills    "enumDescriptions": {
60838fa962SJason M. Bills        "ForceOff": "Turn off the unit immediately (non-graceful shutdown).",
61838fa962SJason M. Bills        "ForceOn": "Turn on the unit immediately.",
62838fa962SJason M. Bills        "ForceRestart": "Shut down immediately and non-gracefully and restart
63838fa962SJason M. Bills          the system.",
64838fa962SJason M. Bills        "GracefulRestart": "Shut down gracefully and restart the system.",
65838fa962SJason M. Bills        "GracefulShutdown": "Shut down gracefully and power off.",
66838fa962SJason M. Bills        "Nmi": "Generate a diagnostic interrupt, which is usually an NMI on x86
67838fa962SJason M. Bills          systems, to stop normal operations, complete diagnostic actions, and,
68838fa962SJason M. Bills          typically, halt the system.",
69838fa962SJason M. Bills        "On": "Turn on the unit.",
70838fa962SJason M. Bills        "PowerCycle": "Power cycle the unit.",
71838fa962SJason M. Bills        "PushPowerButton": "Simulate the pressing of the physical power button
72838fa962SJason M. Bills          on this unit."
73838fa962SJason M. Bills    },
74838fa962SJason M. Bills    "type": "string"
75838fa962SJason M. Bills},
76838fa962SJason M. Bills```
77838fa962SJason M. Bills
78838fa962SJason M. Bills### IPMI
79838fa962SJason M. Bills
80*f4febd00SPatrick WilliamsThe IPMI specification defines a Chassis Control Command with a chassis control
81*f4febd00SPatrick Williamsparameter as follows:
82838fa962SJason M. Bills
83838fa962SJason M. Bills| Option                         | Description                                                                                                                                                                                                                                                                                                                                                            |
84*f4febd00SPatrick Williams| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
85838fa962SJason M. Bills| power down                     | Force system into soft off (S4/S45) state. This is for ‘emergency’ management power down actions. The command does not initiate a clean shut-down of the operating system prior to powering down the system.                                                                                                                                                           |
86838fa962SJason M. Bills| power up                       |                                                                                                                                                                                                                                                                                                                                                                        |
87838fa962SJason M. Bills| power cycle                    | This command provides a power off interval of at least 1 second following the deassertion of the system’s POWERGOOD status from the main power subsystem. It is recommended that no action occur if system power is off (S4/S5) when this action is selected, and that a D5h “Request parameter(s) not supported in present state.” error completion code be returned. |
88838fa962SJason M. Bills| hard reset                     | In some implementations, the BMC may not know whether a reset will cause any particular effect and will pulse the system reset signal regardless of power state.                                                                                                                                                                                                       |
89838fa962SJason M. Bills| pulse Diagnostic Interrupt     | Pulse a version of a diagnostic interrupt that goes directly to the processor(s). This is typically used to cause the operating system to do a diagnostic dump (OS dependent).                                                                                                                                                                                         |
90838fa962SJason M. Bills| Initiate a soft-shutdown of OS |                                                                                                                                                                                                                                                                                                                                                                        |
91838fa962SJason M. Bills
92838fa962SJason M. Bills## Requirements
93838fa962SJason M. Bills
94838fa962SJason M. Bills- Keep legacy support where `xyz.openbmc_project.State.Host.Transition.Reboot`
95*f4febd00SPatrick Williams  causes a graceful shutdown of the host, a power cycle of the chassis, and a
96*f4febd00SPatrick Williams  starting of the host.
97838fa962SJason M. Bills- Support a reboot of the host with chassis power on
98838fa962SJason M. Bills  - Support `GracefulRestart` (where the host is notified of the reboot)
99838fa962SJason M. Bills  - Support `ForceRestart` (where the host is not notified of the reboot)
100838fa962SJason M. Bills- Map `PowerCycle` to a host or chassis operation depending on the current state
101838fa962SJason M. Bills  of the system.
102838fa962SJason M. Bills  - If host is running, then a `PowerCycle` should cycle power to the chassis
103838fa962SJason M. Bills    and boot the host.
104838fa962SJason M. Bills  - If host is not running, then a `PowerCycle` should only cycle power to the
105838fa962SJason M. Bills    chassis.
106838fa962SJason M. Bills
107838fa962SJason M. Bills## Proposed Design
108838fa962SJason M. Bills
109838fa962SJason M. BillsCreate two new `xyz.openbmc_project.State.Host.Transition` options:
110*f4febd00SPatrick Williams
111838fa962SJason M. Bills- `ForceWarmReboot`, `GracefulWarmReboot`
112838fa962SJason M. Bills
113838fa962SJason M. BillsCreate a new `xyz.openbmc_project.State.Chassis.Transition` option:
114*f4febd00SPatrick Williams
115838fa962SJason M. Bills- `PowerCycle`
116838fa962SJason M. Bills
117*f4febd00SPatrick WilliamsThe existing bmcweb code uses some additional xyz.openbmc_project.State.\*
118838fa962SJason M. Billsinterfaces that are not defined within phosphor-dbus-interfaces. These are
119838fa962SJason M. Billsimplemented within the x86-power-control repository which is an alternate
120*f4febd00SPatrick Williamsimplementation to phosphor-state-manager. It has the following mapping for these
121*f4febd00SPatrick Williamsnon-phosphor-dbus-interfaces
122*f4febd00SPatrick Williams
123838fa962SJason M. Bills- `ForceRestart` -> `xyz.openbmc_project.State.Chassis.Transition.Reset`
124838fa962SJason M. Bills- `PowerCycle` -> `xyz.openbmc_project.State.Chassis.Transition.PowerCycle`
125838fa962SJason M. Bills
126838fa962SJason M. BillsA `ForceRestart` should restart the host, not the chassis. The proposal is to
127838fa962SJason M. Billschange the current bmcweb mapping for `ForceRestart` to a new host transition:
128838fa962SJason M. Bills`xyz.openbmc_project.State.Host.Transition.ForceWarmReboot`
129838fa962SJason M. Bills
130838fa962SJason M. BillsA `GracefulRestart` will map to our new host transition:
131838fa962SJason M. Bills`xyz.openbmc_project.State.Host.Transition.GracefulWarmReboot`
132838fa962SJason M. Bills
133*f4febd00SPatrick WilliamsThe `PowerCycle` operation is dependent on the current state of the host. If
134*f4febd00SPatrick Williamshost is on, it will map to `xyz.openbmc_project.State.Host.Transition.Reboot`
135838fa962SJason M. Billsotherwise it will map to
136838fa962SJason M. Bills`xyz.openbmc_project.State.Chassis.Transition.PowerCycle`
137838fa962SJason M. Bills
138*f4febd00SPatrick WilliamsTo summarize the new Redfish to xyz.openbmc_project.State.\* mappings:
139*f4febd00SPatrick Williams
140838fa962SJason M. Bills- `ForceRestart` -> `xyz.openbmc_project.State.Host.Transition.ForceWarmReboot`
141*f4febd00SPatrick Williams- `GracefulRestart`->
142*f4febd00SPatrick Williams  `xyz.openbmc_project.State.Host.Transition.GracefulWarmReboot`
143838fa962SJason M. Bills- `PowerCycle`:
144838fa962SJason M. Bills  - If host on: `xyz.openbmc_project.State.Host.Transition.Reboot`
145838fa962SJason M. Bills  - If host off: `xyz.openbmc_project.State.Chassis.Transition.PowerCycle`
146838fa962SJason M. Bills
147*f4febd00SPatrick WilliamsThe full mapping of Redfish and IPMI to xyz.openbmc_project.State.\* is as
148838fa962SJason M. Billsfollows:
149838fa962SJason M. Bills
150838fa962SJason M. Bills| Redfish               | IPMI        | xyz.openbmc_project.State.Transition |
151*f4febd00SPatrick Williams| --------------------- | ----------- | ------------------------------------ |
152838fa962SJason M. Bills| ForceOff              | power down  | Chassis.Off                          |
153838fa962SJason M. Bills| ForceOn               | power up    | Host.On                              |
154838fa962SJason M. Bills| ForceRestart          | hard reset  | Host.ForceWarmReboot                 |
155838fa962SJason M. Bills| GracefulRestart       |             | Host.GracefulWarmReboot              |
156838fa962SJason M. Bills| GracefulShutdown      | soft off    | Host.Off                             |
157838fa962SJason M. Bills| On                    | power up    | Host.On                              |
158838fa962SJason M. Bills| PowerCycle (host on)  | power cycle | Host.Reboot                          |
159838fa962SJason M. Bills| PowerCycle (host off) |             | Chassis.PowerCycle                   |
160838fa962SJason M. Bills
161838fa962SJason M. Bills## Alternatives Considered
162838fa962SJason M. Bills
163838fa962SJason M. BillsNo other alternatives considered.
164838fa962SJason M. Bills
165838fa962SJason M. Bills## Impacts
166838fa962SJason M. Bills
167838fa962SJason M. BillsExisting interfaces will be kept the same. Some changes in x86-power-control
168838fa962SJason M. Billswould be needed to ensure the bmcweb mappings work as expected with the new
169838fa962SJason M. Billsinterfaces.
170838fa962SJason M. Bills
171838fa962SJason M. BillsSome changes in phosphor-host-ipmid would be needed to support the new state
172838fa962SJason M. Billstransitions.
173838fa962SJason M. Bills
174838fa962SJason M. Bills## Testing
175838fa962SJason M. Bills
176838fa962SJason M. BillsThese new state transitions will be backed by systemd targets. These targets
177838fa962SJason M. Billswill be thoroughly tested. OpenBMC test team will be approached to ensure these
178838fa962SJason M. Billsare tested in automation.
179838fa962SJason M. Bills
180838fa962SJason M. Bills[1]: http://redfish.dmtf.org/schemas/v1/Resource.json#/definitions/ResetType
181838fa962SJason M. Bills[2]: https://github.com/openbmc/phosphor-state-manager
182838fa962SJason M. Bills[3]: https://github.com/openbmc/bmcweb
1830ee8da09SNodeMan97[4]: https://gerrit.openbmc.org/c/openbmc/docs/+/22358
184