1c2690852SChris Sides# Entity-Manager HW ID: VPD Discovery via Device-Tree Properties 2c2690852SChris Sides 3c2690852SChris SidesAuthor: Christopher Sides (citysides) 4c2690852SChris Sides 5c2690852SChris SidesOther contributors: 6c2690852SChris Sides 7c2690852SChris SidesCreated: September 14, 2023 8c2690852SChris Sides 9c2690852SChris Sides## Problem Description 10c2690852SChris Sides 11c2690852SChris SidesBMC needs a process to identify and handle HPE GXP baseboards that provide HW ID 12c2690852SChris Sidesdata via non-I2C channels and in a proprietary format that is not covered by 13c2690852SChris SidesEntity-Manager's 'fru-device' daemon that most platforms rely on. 14c2690852SChris Sides 15c2690852SChris SidesThis proposal describes a method of handling for hardware where HW ID data is 16c2690852SChris Sidesgathered from device tree file paths for Entity-Manager consumption. 17c2690852SChris Sides 18c2690852SChris Sides## Background and References 19c2690852SChris Sides 20c2690852SChris SidesTypical platforms provide HW ID data - often referred to as 'vital product data' 21c2690852SChris Sides(VPD) - for the baseboard as a FRU storage blob held in a physical EEPROM. 22c2690852SChris Sides 23c2690852SChris Sides[As described in Entity-Manager documentation](https://github.com/openbmc/entity-manager/blob/master/docs/my_first_sensors.md), 24c2690852SChris Sidesthis blob is discovered and read over I2C, then is decoded before the data is 25c2690852SChris Sidescopied to D-Bus as properties of the `xyz.openbmc_project.FruDevice` interface 26c2690852SChris Sidesby Entity-Manager's fru-device daemon. The current FRU-device daemon is able to 27c2690852SChris Sidesdecode IPMI-FRU storage formatted blobs, as well as the Tyan data format. 28c2690852SChris Sides 29c2690852SChris SidesAdditionally, a separate daemon for handling OpenPower format VPD is hosted in 30c2690852SChris Sidesthe 'openpower-vpd-parser' subproject. This daemon is relied on for the 31c2690852SChris Sidesidentification of certain IBM-supported hardware. 32c2690852SChris Sides 33c2690852SChris SidesHPE hardware uses different channels and data formats from the above, relying on 34c2690852SChris Sidesmodifications to the device-tree to output properties as one file handle per 35c2690852SChris Sidesattribute. 36c2690852SChris Sides 37c2690852SChris SidesOnce VPD is made available on D-Bus, it can be referenced by the Entity-Manager 38c2690852SChris Sidesconfiguration 'probe' statements that are used as hardware/configuration 39c2690852SChris Sidesdetection triggers. 40c2690852SChris Sides 41c2690852SChris SidesHPE platforms provide the following properties for baseboard VPD: 42c2690852SChris Sides 43c2690852SChris Sides- server_id (platform model id) 44c2690852SChris Sides- pca_part_number (baseboard part no) 45c2690852SChris Sides- pca_serial_number (baseboard serial no) 46c2690852SChris Sides- part_number (platform product no, set at assembly by factory) 47c2690852SChris Sides- serial_number (system serial no, assigned at assembly by factory) 48c2690852SChris Sides- mac0 (if present: MAC address for dedicated BMC network interface) 49c2690852SChris Sides- mac1 (if present: MAC address for secondary network interface that may or may 50c2690852SChris Sides not be shared with host) 51c2690852SChris Sides 52c2690852SChris SidesHPE platforms in Gen 10 and earlier provided VPD through a standard 53c2690852SChris SidesI2C-accessible EEPROM (but still in a proprietary data format). That avenue is 54c2690852SChris Sidesno longer available on newer HPE systems. 55c2690852SChris Sides 56c2690852SChris SidesFor GXP-based Gen 11 HPE platforms, proprietary HPE-controlled bootblock 57c2690852SChris Sidesfirmware communicates with a secure element to provide necessary VPD. This 58c2690852SChris Sidesprocess uses a driver whose implementation is strictly license-controlled and 59c2690852SChris Sidescannot be publicly released. The open source portions of the boot chain must 60c2690852SChris Sidesadapt to the bootblock's reserved memory application binary interface (ABI) for 61c2690852SChris Sidesproviding VPD from the secure element. 62c2690852SChris Sides 63c2690852SChris SidesEarly in the boot process, an HPE-proprietary bootblock is validated, then an 64c2690852SChris SidesHPE-specific bootloader in the block fetches the VPD blob from the secure 65c2690852SChris Sideselement via third party driver. From here, the data blob is copied to a 66c2690852SChris Sidespredetermined location in RAM, where it is retrieved and parsed by HPE-specific 67c2690852SChris Sidescode in u-Boot (open-sourced, and available at 68c2690852SChris Sideshttps://github.com/HewlettPackard/gxp-uboot). In the future, we'll be aiming to 69c2690852SChris Sidesupstream as much 'HPE-critical' u-boot code as needed so that an HPE-specific 70c2690852SChris Sidesu-boot fork will not be needed to boot HPE hardware. 71c2690852SChris Sides 72c2690852SChris SidesAdditionally, code in u-Boot gathers MAC addresses for the BMC's network 73c2690852SChris Sidesinterfaces, along with retrieving a 'server_id' value from an embedded 74c2690852SChris SidesCPLD-based memory device. This value is unique to each model of HPE platform, 75c2690852SChris Sidesand will be used for platform-wide identification. In comparison, the data in 76c2690852SChris Sidesthe aforementioned blob may be used for recognizing finer details like specific 77c2690852SChris Sidesboard revisions for a given platform. 78c2690852SChris Sides 79c2690852SChris SidesThe HPE process described above relies on shared memory instead of u-boot env 80c2690852SChris Sidesvariables because the HPE bootloader does not know that u-boot will run next, 81c2690852SChris Sidesand does not know where the u-boot variable store is, if it exists at all -- 82c2690852SChris Sidessince a customer could decide to use something other than u-boot, or to store 83c2690852SChris Sidestheir environmental variables in a different place or format. 84c2690852SChris Sides 85c2690852SChris SidesAfter that, u-Boot makes relevant data available to Linux via modifications to 86c2690852SChris Sidesthe flattened device tree, setting the values for ['/model' and 87c2690852SChris Sides'/serial-number,' which both have well-known paths in the device tree 88c2690852SChris Sidesroot][dt-spec-chap3-root-node], along with ['local-mac-address,' a property 89c2690852SChris Sidesprovided by the network binding][dt-spec-chap4-device-bindings]. 90c2690852SChris Sides 91c2690852SChris Sides[dt-spec-chap3-root-node]: 92c2690852SChris Sides https://github.com/devicetree-org/devicetree-specification/blob/main/source/chapter3-devicenodes.rst#root-node 93c2690852SChris Sides[dt-spec-chap4-device-bindings]: 94c2690852SChris Sides https://github.com/devicetree-org/devicetree-specification/blob/main/source/chapter4-device-bindings.rst#local-mac-address-property 95c2690852SChris Sides 96c2690852SChris SidesFrom there, the GXP product data must be published to D-Bus, or there will be no 97c2690852SChris Sidesway for Entity-Manager to reference it during the probe evaluations used in 98c2690852SChris Sidesdetecting supported hardware configurations. The contents of 'device-tree/model' 99c2690852SChris Sidesbeing made available on D-Bus will be enough to enable basic Entity-Manager 100c2690852SChris Sidesidentification of HPE baseboard hardware. 101c2690852SChris Sides 102c2690852SChris SidesIn the future, HPE's behind-the-scenes reliance on u-Boot for this process may 103c2690852SChris Sidesbe reduced or removed entirely, but but those implementation details should not 104c2690852SChris Sidesaffect how a service would collect data from the device-tree passed to the 105c2690852SChris Sideskernel from u-Boot. One alternative to modifying the flat device-tree would be 106c2690852SChris Sidesto have values like 'model' set in the platform's device-tree source at image 107c2690852SChris Sidesbuild time. 108c2690852SChris Sides 109c2690852SChris SidesThis document discusses leveraging a 'device-tree -> D-Bus' daemon in 110c2690852SChris SidesEntity-Manager to enable BMC detection and handling of HPE Gen 11 hardware (and 111c2690852SChris Sidespotentially for other hardware as well). 112c2690852SChris Sides 113c2690852SChris Sides## Requirements 114c2690852SChris Sides 115c2690852SChris Sides- Vital product data must be parsed and published to D-Bus 116c2690852SChris Sides 117*46902afdSChris Sides- D-Bus properties for interface(s) at path `xyz/openbmc_project/MachineContext` 118*46902afdSChris Sides may be populated using retrieved VPD values as appropriate to offer a D-Bus 119*46902afdSChris Sides path for common specific model identifying details. 120c2690852SChris Sides 121c2690852SChris Sides- Vital product data properties should be referenced in Entity-Manager config 122c2690852SChris Sides 'probe' statement(s) in order to key configuration enablement off them. 123c2690852SChris Sides 124c2690852SChris Sides## Proposed Design 125c2690852SChris Sides 126c2690852SChris SidesHigh Level Flow: 127c2690852SChris Sides 128c2690852SChris Sides- At boot, a proprietary HPE bootblock is validated, then HPE GXP-bootloader 129c2690852SChris Sides code (proprietary) included in the block retrieves data from a secure element. 130c2690852SChris Sides Specific hardware identifying information is transferred into a pre-determined 131c2690852SChris Sides memory location in RAM for pickup. 132c2690852SChris Sides 133c2690852SChris Sides- u-Boot code (via an 134c2690852SChris Sides [open source, but HPE-specific process](https://github.com/HewlettPackard/gxp-uboot)) 135c2690852SChris Sides gathers MAC addresses and moves product data from the RAM location, plus a 136c2690852SChris Sides CPLD-based memory device, and exposes it in Linux under /proc/device-tree/ 137c2690852SChris Sides 138c2690852SChris Sides- A daemon in DeviceTree-VPD-Parser retrieves product data from known device 139c2690852SChris Sides tree paths, then parses and publishes to D-Bus 140c2690852SChris Sides 141c2690852SChris Sides- Entity-Manager probes that reference properties from the 142c2690852SChris Sides `xyz.openbmc_project.Inventory.Decorator.Asset` (.Model & .SerialNumber 143c2690852SChris Sides properties) interface on D-Bus can key off GXP hardware data and react 144c2690852SChris Sides accordingly. 145c2690852SChris Sides 146c2690852SChris Sides## Alternatives Considered 147c2690852SChris Sides 148c2690852SChris Sides### Entity-Manager probes are extended to handle reading data from arbitrary<br/>device-tree nodes 149c2690852SChris Sides 150c2690852SChris Sides#### Pros: 151c2690852SChris Sides 152c2690852SChris Sides1. No new daemon required 153c2690852SChris Sides 154c2690852SChris Sides#### Cons: 155c2690852SChris Sides 156c2690852SChris Sides1. May encourage undesired device-tree exploitation 157c2690852SChris Sides 158c2690852SChris Sides### A reserved-memory node in device-tree is used for transport of<br/>'serial-number' and 'model' ID data 159c2690852SChris Sides 160c2690852SChris Sides#### Pros: 161c2690852SChris Sides 162c2690852SChris Sides1. Reserved-memory is commonly used for passing data from firmware 163c2690852SChris Sides 164c2690852SChris Sides#### Cons: 165c2690852SChris Sides 166c2690852SChris Sides1. Has no well-known handles for common properties like /model or /serial-number 167c2690852SChris Sides like device-tree does; makes more sense for keeping arbitrary data instead of 168c2690852SChris Sides 'well-known' properties 169c2690852SChris Sides2. The critical identifier HPE wants to rely on for platform identification 170c2690852SChris Sides (/model) comes from a different behind-the-scenes source vs. the rest of the 171c2690852SChris Sides data planned for output through reserved-memory. Using reserved-memory for 172c2690852SChris Sides 'model' instead of the well known device-tree /model handle would add 173c2690852SChris Sides additional complexity. 174c2690852SChris Sides3. Since /model is well described in device-tree documentation, there is 175c2690852SChris Sides potential for non-HPE platform to make easy use of it. Relying on 'model' as 176c2690852SChris Sides an arbitrary property in reserved-memory has less potential to be useful 177c2690852SChris Sides outside of HPE-specific applications. 178c2690852SChris Sides 179c2690852SChris Sides### All VPD is exposed as devicetree attributes under /chosen/ 180c2690852SChris Sides 181c2690852SChris Sides#### Pros: 182c2690852SChris Sides 183c2690852SChris Sides1. Is a well-established device-tree node 184c2690852SChris Sides2. Is not being used by other BMC platforms, so easy to enable/disable service 185c2690852SChris Sides based on whether or not 'chosen' path exists 186c2690852SChris Sides3. Values can be set from u-Boot via modifications to the flattened device tree 187c2690852SChris Sides available to it (applicable to arbitrary device-tree paths) 188c2690852SChris Sides 189c2690852SChris Sides#### Cons: 190c2690852SChris Sides 191c2690852SChris Sides1. Not a 'usual' location for passing this kind HW-tied data. Unlikely to ever 192c2690852SChris Sides be used for moving product data by other entities, so such a daemon would be 193c2690852SChris Sides defacto HPE-specific code. 194c2690852SChris Sides2. Presenting HW-specific data here appears to go against the intended use of 195c2690852SChris Sides 'chosen' node 196c2690852SChris Sides 197c2690852SChris Sides### Vital product data is published to u-Boot environment variables, then<br/>transferred to D-Bus 198c2690852SChris Sides 199c2690852SChris Sides#### Pros: 200c2690852SChris Sides 201c2690852SChris Sides1. Would increase code reuse and testing 202c2690852SChris Sides 203c2690852SChris Sides#### Cons: 204c2690852SChris Sides 205c2690852SChris Sides1. Potential issues with limited writes to memory where u-boot env variables are 206c2690852SChris Sides stored in memory. 207c2690852SChris Sides2. HPE component that retrieves VPD from HPE's secure element has no 208c2690852SChris Sides knowledge/ability to alter u-boot environmental variables 209c2690852SChris Sides 210c2690852SChris Sides### Use an HPE-specific daemon instead of a generalized'[channel]-> D-Bus'<br/>daemon 211c2690852SChris Sides 212c2690852SChris Sides#### Pros: 213c2690852SChris Sides 214c2690852SChris Sides1. Simpler (slightly?) code 215c2690852SChris Sides2. Would only fire for HPE platforms 216c2690852SChris Sides3. Better abstraction 217c2690852SChris Sides 218c2690852SChris Sides#### Cons: 219c2690852SChris Sides 220c2690852SChris Sides1. Doesn't save much effort compared to a generalized non-HPE-specific solution 221c2690852SChris Sides2. Harder to leverage code for potential future cases 222c2690852SChris Sides 223*46902afdSChris Sides### Service is hosted in Entity-Manager [ACCEPTED after TOF re-examination] 224c2690852SChris Sides 225c2690852SChris Sides#### Pros: 226c2690852SChris Sides 227c2690852SChris Sides1. Would operate in parallel to existing Fru_Device daemon 228c2690852SChris Sides 229c2690852SChris Sides#### Cons: 230c2690852SChris Sides 231c2690852SChris Sides1. Community doesn't want to host VPD -> DBus daemons in Entity-Manager repo 232c2690852SChris Sides 233*46902afdSChris SidesFollow-up: A Technical Oversight Forum discussion has reached consensus that it 234*46902afdSChris Sideswould be better to host this device-tree VPD daemon in Entity-Manager alongside 235*46902afdSChris Sidesthe existing fru-device daemon rather than to create a dedicated repo for a 236*46902afdSChris Sidesdaemon as simple as this one, or to force into another even less-related repo. 237*46902afdSChris Sides 238*46902afdSChris Sideshttps://github.com/openbmc/technical-oversight-forum/issues/38 239*46902afdSChris Sides 240c2690852SChris Sides### Service is hosted in Phosphor-u-boot-env-mgr 241c2690852SChris Sides 242c2690852SChris Sides#### Pros: 243c2690852SChris Sides 244c2690852SChris Sides1. Repo is already associated with u-boot operations 245c2690852SChris Sides 246c2690852SChris Sides#### Cons: 247c2690852SChris Sides 248c2690852SChris Sides1. Current repo maintainer feels the service doesn't fit this repo because the 249c2690852SChris Sides purpose is explicitly to deal with manipulation of u-boot env variables, 250c2690852SChris Sides which this service is not involved with. 251c2690852SChris Sides 252c2690852SChris Sides https://gerrit.openbmc.org/c/openbmc/phosphor-u-boot-env-mgr/+/71512 253c2690852SChris Sides 254c2690852SChris Sides### Addendum: Rejected D-Bus interfaces for pending device-tree -> D-Bus<br/>daemon 255c2690852SChris Sides 256c2690852SChris Sides#### Existing interfaces (rejected): 257c2690852SChris Sides 258c2690852SChris Sides1. Proposal: xyz.openbmc_project.Decorator.\* 259c2690852SChris Sides 260c2690852SChris Sides Rejection: "doesn't represent anything about the physical board" -Ed Tanous 261c2690852SChris Sides 262c2690852SChris Sides Followup: Phosphor-dbus-interfaces maintenance (Patrick Williams) has 263c2690852SChris Sides rejected hosting an interface with properties like 'Model' and 'SerialNumber' 264c2690852SChris Sides that already exist as part of other interfaces, and has specifically 265c2690852SChris Sides suggested relying on xyz.openbmc_project.Inventory.Decorator.Asset (for 266c2690852SChris Sides .model and .serialnumber properties) along with 267c2690852SChris Sides xyz.openbmc_project.Inventory.Item.NetworkInterface (for .MACAddress 268c2690852SChris Sides property). 269c2690852SChris Sides 270c2690852SChris Sides Discussion @ 271c2690852SChris Sides https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/73260/comment/e0226ae4_d7e514dd/ 272c2690852SChris Sides 273c2690852SChris Sides Follow-up 2: Sticking with Inventory.Decorator.Asset, but removing MAC 274c2690852SChris Sides address properties to reduce unneeded complexity. 275c2690852SChris Sides 276c2690852SChris Sides2. Proposal: xyz.openbmc_project.FRUDevice 277c2690852SChris Sides 278c2690852SChris Sides Rejection: The data is not coming from a FRU device 279c2690852SChris Sides 280c2690852SChris Sides#### Proposed interfaces (rejected): 281c2690852SChris Sides 282c2690852SChris Sides1. Proposal: xyz.openbmc_project.DeviceTree 283c2690852SChris Sides2. Proposal: xyz.openbmc_project.uBootHWID 284c2690852SChris Sides3. Proposal: xyz.openbmc_project.GXPFRU 285c2690852SChris Sides 286c2690852SChris Sides Rejection: Above interfaces do not reflect underlying hardware 287c2690852SChris Sides 288c2690852SChris Sides4. Proposal: xyz.openbmc_project.BMCPrebootContext 289c2690852SChris Sides 290c2690852SChris Sides Rejection: Arguably doesn't represent a hardware concept. 291c2690852SChris Sides 292c2690852SChris Sides5. Proposal: xyz.openbmc_project.UbootDeviceModel 293c2690852SChris Sides 294c2690852SChris Sides Rejection: There are ongoing efforts to enable dynamic device-tree 295c2690852SChris Sides modifications post-u-boot. The nodes this daemon reads are unlikely to be 296c2690852SChris Sides affected, but there's no guarantee of that. 297c2690852SChris Sides 298c2690852SChris Sides6. Proposal: xyz.openbmc_project.Platform 299c2690852SChris Sides 300c2690852SChris Sides Rejection: Some attributes like serial-number or MAC don't apply across a 301c2690852SChris Sides given platform 302c2690852SChris Sides 303c2690852SChris Sides7. Proposal: xyz.openbmc_project.Machine 304c2690852SChris Sides 305c2690852SChris Sides Rejection: Promising, but the name seems vague re: its purpose. 306c2690852SChris Sides xyz.openbmc_project.MachineContext has been offered as an alternative. 307c2690852SChris Sides 308c2690852SChris Sides8. Proposal: xyz.openbmc_project.MachineContext 309c2690852SChris Sides 310c2690852SChris Sides Rejection: "We have all this stuff [.Model, .SerialNumber, ect. properties] defined 311c2690852SChris Sides already. I'm not going to accept a new "bunch of random properties HPe thinks 312c2690852SChris Sides are important [today] globbed into a new interface" interface" 313c2690852SChris Sides 314c2690852SChris Sides - Patrick Williams, Phosphor-dbus-interfaces maintainer. 315c2690852SChris Sides 316c2690852SChris Sides Counter-proposal: "Reuse the existing dbus interfaces and put them at a 317c2690852SChris Sides well-defined location? Inventory.Decorator.[Asset] = Model 318c2690852SChris Sides Inventory.Decorator.Asset = SerialNumber Inventory.Item.NetworkInterace = 319c2690852SChris Sides MACAddress.." - Patrick Williams 320c2690852SChris Sides 321c2690852SChris Sides Discussion @ 322c2690852SChris Sides https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/73260/comment/e0226ae4_d7e514dd/ 323c2690852SChris Sides 324c2690852SChris Sides Follow-up: Landed on interface: xyz.openbmc_project.Inventory.Decorator.Asset 325*46902afdSChris Sides @ path xyz/openbmc_project/MachineContext 326c2690852SChris Sides 327c2690852SChris Sides## Impacts 328c2690852SChris Sides 329c2690852SChris SidesThe above-described process is only intended to scan selected paths -if they 330c2690852SChris Sidesexist- once during initial service startup. 331c2690852SChris Sides 332c2690852SChris SidesIf the path(s) in question do not exist (device-tree/model or 333c2690852SChris Sidesdevice-tree/serial-number), no further work will be done, so there is expected 334c2690852SChris Sidesto be no noticeable performance or functional impact to platforms that don't 335c2690852SChris Sidesrely on this service for Entity-Manager HW/config detection. 336c2690852SChris Sides 337c2690852SChris Sides## Organizational: 338c2690852SChris Sides 339c2690852SChris Sides### Does this design require a new repository? 340c2690852SChris Sides 341*46902afdSChris SidesNo. After some discussion, a Technical Oversight Forum consensus was reached to 342*46902afdSChris Sideshave the device-tree VPD parser daemon hosted in the Entity-Manager repo 343*46902afdSChris Sidesalongside the existing fru-device daemon. 344c2690852SChris Sides 345c2690852SChris Sides### Which repositories are expected to be modified to execute this design? 346c2690852SChris Sides 347*46902afdSChris SidesTechnical Oversight Forums consensus has been reached that this device-tree VPD 348*46902afdSChris Sidesdaemon will be hosted in Entity-Manager alongside the existing FRU-device VPD 349*46902afdSChris Sidesdaemon. 350*46902afdSChris Sides 351*46902afdSChris SidesEntity-Manager will also have configuration files added for HPE hardware that 352*46902afdSChris Sidesmake use of the new interface properties via probe statements. 353c2690852SChris Sides 354c2690852SChris Sides## Testing 355c2690852SChris Sides 356c2690852SChris SidesAny platform that has a device-tree 'model' or 'serial-number' node populated in 357c2690852SChris SidesDevice-Tree (this can be done by hardcoding a value into the DTS file before 358c2690852SChris Sidesbuilding an image, if desired) can be checked by confirming the contents of the 359c2690852SChris Sidesdevice-tree/model and/or serial-number node matches the contents of 'model' and 360c2690852SChris Sides'serial-number' properties of D-Bus interface at D-Bus path 361c2690852SChris Sides'xyz/openbmc_project/MachineContext' 362c2690852SChris Sides 363c2690852SChris SidesPractically, the whole of the service stack (including Entity-Manager probe 364c2690852SChris Sidesvalidation) of the new D-Bus path can be validated on an HPE system by setting 365c2690852SChris Sidesan Entity-Manager config's probe to trigger on match with a known HPE-HW 366c2690852SChris Sidesidentifying property, then by confirming 367c2690852SChris Sides`busctl tree xyz.openbmc_project.EntityManager` shows a listing of objects that 368c2690852SChris Sidesmatches what's described in the modified EM config file. 369c2690852SChris Sides 370c2690852SChris SidesAt this time, HPE hardware requires forked (publicly available) OBMC components 371c2690852SChris Sidesto fully boot, so automated testing of HPE hardware against 'mainstream' OBMC 372c2690852SChris Sidesimages is not yet a viable option. Enabling this type of testing is a longer 373c2690852SChris Sidesterm goal. 374