xref: /openbmc/docs/designs/multi-host-postcode.md (revision f4febd002df578bad816239b70950f84ea4567e8)
1# Multi-host Postcode Support
2
3Author: Manikandan Elumalai, [manikandan.hcl.ers.epl@gmail.com]
4
5Other contributors: None
6
7Created: 2020-07-02
8
9## Problem Description
10
11The current implementation in the phosphor-host-postd supports only single host
12postcode access through LPC interface.
13
14As the open BMC architecture is evolving, the single host support becomes
15contingent and needs multiple-host post code access to be implemented.
16
17## Background and References
18
19The below component diagram shows the design for single-host postcode and
20history at high-level overview. The single-host design is updated slightly from
21the original to better comply with community conventions (using suffix 0 on
22D-Bus objects).
23
24Diagram Legend: |Label|Signifies| |-----|---------| |`I:` |D-Bus interface|
25|`S:` |D-Bus service name (well-known bus name)| |`R:` |Repository name| |`U:`
26|Systemd service unit name| |`A:` |Executable name| |`H:` |HW Module|
27
28```
29                                         +-----------+
30                       +------+          | 7 segment |
31                       | Host |          |  display  |
32                       +--+---+          +-----^-----+
33                          |                    |
34+-------------------------+--------------------+--------+
35| BMC                     |                    |        |
36|                      +--v----+         +-----+-----+  |
37|                      | H:LPC +---------> H:(S)GPIO |  |
38|                      +--+----+         +-----------+  |
39|                         |                             |
40| +-----------------------v--------------+              |
41| | U:lpcsnoop                           |              |
42| |                                      |              |
43| | Current POST code:                   |              |
44| | S:xyz.openbmc_project.State.Boot.Raw |              |
45| | /xyz/openbmc_project/state/boot/raw0 |              |
46| | I:xyz.openbmc_project.State.Boot.Raw >----+         |
47| +--------------------------------------+    |         |
48|                                             |         |
49| +-------------------------------------------v---+     |
50| | U:xyz.openbmc_project.State.Boot.PostCode     |     |
51| | POST code history:                            |     |
52| | +-------------------------------------------+ |     |
53| | | S:xyz.openbmc_project.State.Boot.PostCode0| |     |
54| | | /xyz/openbmc_project/State/Boot/PostCode0 | |     |
55| | | I:xyz.openbmc_project.State.Boot.PostCode >----+  |
56| | +-------------------------------------------+ |  |  |
57| +-----------------------------------------------+  |  |
58|                                                    |  |
59|      +--------------------------------+            |  |
60|      | Other consumers of POST codes: <------------+  |
61|      | Redfish, etc...                |               |
62|      +--------------------------------+               |
63+-------------------------------------------------------+
64```
65
66Since multiple hosts cannot coherently write their POST codes to the same place,
67an additional datapath is needed to receive POST codes from each host. Since
68this new datapath would not have built-in support in ASPEED hardware, additional
69logic is also needed drive the 7-segment display.
70
71## Requirements
72
73- Read postcode from all servers.
74- Display the host postcode to the 7 segment display based on host position
75  selection.
76- Provide a command interface for user to see any server(multi-host) current
77  postcode.
78- Provide a command interface for user to see any server(multi-host) postcode
79  history.
80- Support for hot-plug-able host.
81
82## Proposed Design
83
84This document proposes a new design engaging the IPMB interface to read the
85port-80 post code from multiple-host. The existing single host LPC snooping
86mechanism remains unaffected, and is not shown in diagrams below. This design
87also supports host discovery including the hot-plug-able host connected in the
88slot.
89
90Following modules will be updated for this implementation
91
92- phosphor-host-postd.
93- phosphor-post-code-manager.
94- platform specific OEM handler (fb-ipmi-oem).
95- bmcweb (redfish logging service).
96
97**Interface Diagram**
98
99Provided below the post code interface diagram with flow sequence
100
101```
102+---------------------------------------------------+
103| BMC                                               |
104|                                                   |
105|  +-----------------------+    +----------------+  |         +----+-------------+
106|  | A:ipmid               |    | IPMB Bridge    <--+--IPMB-+-|BIC |             |
107|  |                       |    | (R:ipmbbridge) |  |       | |    |     Host1   |
108|  | +-------------------+ |    +--------+-------+  |       | +------------------+
109|  | | OEM IPMI Handlers | |             |          |       |           .
110|  | | (R:fb-ipmi-oem)   <-+-------------+          |       |           .
111|  | --------------------+ |   +----------------+   |       |           .
112|  +-+---------------------+   | Host selection |   |       | +------------------+
113|    |                         | monitoring     <---+--+    +-|BIC |             |
114|    |                         +---------+------+   |  |      |    |     HostN   |
115|    |                                   |          |  |      +------------------+
116|    | +---------------------------------v------+   |  |
117|    | | R:phosphor-host-postd (1 process)      |   |  |      +---------------+
118|    | | Per-host POST code object:             |   |  +-GPIO-| Button/switch |
119|    | | /xyz/openbmc_project/state/boot/raw<N> |   |         | input device  |
120|    +-> I:xyz.openbmc_project.State.Boot.Raw   >-+ |         +---------------+
121|      +---------------------------------+------+ | |
122|                                        |        | |         +-------------------+
123|                                        +--------+-+----GPIO-> 7-segment display |
124|                                                 | |         +-------------------+
125|                                                 | +------+
126|                                                 |        |
127|  +----------------------------------------------v---+    |
128|  | R:phosphor-post-code-manager (N processes)       |    |
129|  | Per-host POST code history service:              |    |
130|  | +----------------------------------------------+ |    |
131|  | | S:xyz.openbmc_project.State.Boot.PostCode<N> | |    |
132|  | | /xyz/openbmc_project/State/Boot/PostCode<N>  | |    |
133|  | | I:xyz.openbmc_project.State.Boot.PostCode    >-+-+  |
134|  | +----------------------------------------------+ | |  |
135|  |                        ...                       | |  |
136|  +--------------------------------------------------+ |  |
137|                                                       |  |
138|       +--------------------------------+              |  |
139|       | Other consumers of POST codes: <--------------+  |
140|       | Redfish, CLI, etc...           |                 |
141|       +--------------------------------+                 |
142|                                                          |
143+----------------------------------------------------------+
144```
145
146**Postcode Flow:**
147
148- BMC power-on the host.
149- Host starts sending the postcode IPMI message continuously to the BMC.
150- The ipmbbridged (phosphor-ipmi-ipmb) passes along the message to IPMI daemon.
151- The ipmid (phosphor-ipmi-host) appends host information with postcode and
152  writes value to appropriate D-Bus object hosted by phosphor-host-postd.
153- phosphor-host-postd displays postcode in the seven segment display based on
154  host position reads through D-bus interface.
155- phosphor-post-code-manager receives new POST codes via D-Bus signal and stores
156  the postcode as history in the /var directory.
157
158## Platform Specific OEM Handler (fb-ipmi-oem)
159
160This library is part of the
161[phosphor-ipmi-host](https://github.com/openbmc/phosphor-host-ipmid) and gets
162the postcode from host through
163[phosphor-ipmi-ipmb](https://github.com/openbmc/ipmbbridge).
164
165- Register IPMI OEM postcode callback handler.
166- Extract postcode from IPMI message (phosphor-ipmi-host/phosphor-ipmi-ipmb).
167- Sets `Value` property on appropriate D-Bus `Raw` object hosted by
168  `phosphor-host-postd`. Other programs (e.g. `phosphor-post-code-manager`) can
169  subscribe to `PropertiesChanged` signals on this object to get the updates.
170
171## phosphor-host-postd
172
173This implementation involves the following changes in the phosphor-host-postd.
174
175- `phosphor-host-postd` handles property set events for the `Value` property on
176  each instance of the `xyz.openbmc_project.State.Boot.Raw` interface.
177- phosphor-host-postd reads the host selection from the dbus property.
178- Display the latest postcode of the selected host read through D-Bus on a
179  7-segment display.
180
181**D-Bus interface**
182
183The following D-Bus names need to be created for the multi-host post-code.
184
185    Service name      -- xyz.openbmc_project.State.Boot.Raw
186
187    Obj path name     -- /xyz/openbmc_project/State/Boot/RawX(1,2..N)
188
189    Interface name    -- xyz.openbmc_project.State.Boot.Raw
190
191## phosphor-post-code-manager
192
193The phosphor-post-code-manager is a multi service design for multi-host. The
194single host postcode handling D-bus naming conventions will be updated to comply
195with the community naming scheme.
196
197- Create D-Bus service names for single-host and multi-host system accordingly.
198  The community follows conventions Host0 for single host and Host1 to N for
199  multi-host.
200- phosphor-post-code-manager subscribes to changes on the `Raw<N>` object hosted
201  by `phosphor-host-postd`.
202- Store/retrieve post-code from directory (/var/lib/phosphor-post-code-manager/
203  hostX(1,2,3..N)) based on event received from phosphor-host-postd.
204
205**D-Bus interface**
206
207The following D-Bus names needs to be created for multi-host post-code.
208
209    Service name     -- xyz.openbmc_project.State.Boot.PostCodeX(1,2..N)
210
211    Obj path name    -- /xyz/openbmc_project/State/Boot/PostCodeX(1,2..N)
212
213    Interface name   -- xyz.openbmc_project.State.Boot.PostCode
214
215## bmcweb
216
217The postcode history needs to be handled for the multi-host through redfish
218logging service.
219
220## Alternate design
221
222**phosphor-post-code-manager single process approach**
223
224This implementation consider single service to handle multi-host postcode. In
225this approach, all D-Bus handling will taken care by the single process.
226
227Single service is different than existing x86-power-control and obmc-console
228where multi-service approach is used.
229
230Multi-service approach is more scalable to handle multi-host than the single
231service.
232