xref: /openbmc/docs/designs/vpd-collection.md (revision 67032dffe31f98a8638927f74a7a35990d6a1fbc)
14b935218SSantosh Puranik# VPD collection app on OpenBMC
24b935218SSantosh Puranik
34b935218SSantosh PuranikAuthor: Santosh Puranik <santosh.puranik@in.ibm.com> <santosh.puranik>
44b935218SSantosh Puranik
54b935218SSantosh PuranikCreated: 2019-06-11
64b935218SSantosh Puranik
74b935218SSantosh Puranik## Problem Description
8f4febd00SPatrick Williams
94b935218SSantosh PuranikOn OpenBMC, Vital Product Data (VPD) collection is limited to only one or two
10f4febd00SPatrick WilliamsField Replaceable Units (FRUs) today - one example is the BMC FRU. On OpenPower
11*67032dffSPeter Delevoryassystems, the BMC also supports just one VPD format, the [OpenPower VPD] [1]
12*67032dffSPeter Delevoryasformat. As a part of its enterprise class servers, IBM will use the IPZ format
13*67032dffSPeter DelevoryasVPD, which the BMC currently does not support. Certain FRUs also have keyword
14*67032dffSPeter Delevoryasformat VPD.
154b935218SSantosh Puranik
164b935218SSantosh PuranikThe BMC requires to read VPD for all FRUs for several reasons:
174b935218SSantosh Puranik
184b935218SSantosh Puranik- Some of the VPD information such as FRU part number, serial number need to be
194b935218SSantosh Puranik  included in the Platform Error Logs (PELs) for calling out FRUs for service.
204b935218SSantosh Puranik
214b935218SSantosh Puranik- Several use cases on the BMC require that the applications decide on a certain
224b935218SSantosh Puranik  code path based on what level of FRU is plugged in. For example, the
23f4febd00SPatrick Williams  application that controls voltage regulators might need to set different
24f4febd00SPatrick Williams  registers based on the version of the voltage regulator FRU.
254b935218SSantosh Puranik
264b935218SSantosh Puranik- There are use cases for the BMC to send VPD data to the host
274b935218SSantosh Puranik  hypervisor/operating system (over PLDM). This is mainly so that the host can
284b935218SSantosh Puranik  get VPD that is not directly accessible to it.
294b935218SSantosh Puranik
30f4febd00SPatrick WilliamsThe VPD data itself may reside on an EEPROM (typical) or may be synthesized out
31f4febd00SPatrick Williamsof certain parameters of the FRU (atypical - for FRUs that do not have an
32f4febd00SPatrick WilliamsEEPROM).
334b935218SSantosh Puranik
344b935218SSantosh PuranikThis design document aims to define a high level design for VPD collection and
35f4febd00SPatrick WilliamsVPD access on OpenBMC. It does _not_ cover low level API details.
364b935218SSantosh Puranik
374b935218SSantosh Puranik## Background and References
38f4febd00SPatrick Williams
394b935218SSantosh PuranikEssentially, the IPZ VPD structure consists of key-value pairs called keywords.
404b935218SSantosh PuranikEach keyword can be used to contain specific data about the FRU. For example,
414b935218SSantosh Puranikthe SN keyword will contain a serial number that can uniquely identify an
424b935218SSantosh Puranikinstance of a part. Keywords themselves can be combined or grouped into records.
434b935218SSantosh PuranikFor example, a single record can be used to group keywords that have similar
444b935218SSantosh Puranikfunction, such as serial number, part number.
454b935218SSantosh Puranik
464b935218SSantosh PuranikThe keyword format VPD does not contain records, but instead has just keywords
474b935218SSantosh Puraniklaid out one after another.
484b935218SSantosh Puranik
494b935218SSantosh PuranikThe IPZ format is quite similar in its structure to the OpenPower format except
504b935218SSantosh Puranikfor the following details:
514b935218SSantosh Puranik
524b935218SSantosh Puranik- IPZ VPD has different records and keywords.
534b935218SSantosh Puranik
544b935218SSantosh Puranik- IPZ VPD is required to implement and validate ECC as defined in the OpenPower
554b935218SSantosh Puranik  specification. The BMC code currently does not validate/use ECC although the
564b935218SSantosh Puranik  specification does define it, but will need to use the ECC for IBM's
574b935218SSantosh Puranik  enterprise class of servers.
584b935218SSantosh Puranik
594b935218SSantosh Puranik- The keyword format VPD is also something that consists of key-value pairs, but
604b935218SSantosh Puranik  has no concept of a record to group keywords together. The ECC for the keyword
614b935218SSantosh Puranik  format VPD is simply a CRC.
624b935218SSantosh Puranik
634b935218SSantosh Puranik## Requirements
64f4febd00SPatrick Williams
654b935218SSantosh PuranikThe following are requirements for the VPD function on OpenBMC:
664b935218SSantosh Puranik
674b935218SSantosh Puranik- The BMC must collect VPD for all FRUs that it has direct access to by the time
684b935218SSantosh Puranik  the BMC reaches Standby (aka the Ready state, a state from where the BMC can
694b935218SSantosh Puranik  begin CEC poweron). This is needed for several reasons:
704b935218SSantosh Puranik
714b935218SSantosh Puranik  BMC applications need to be able to read VPD for FRUs to determine, for ex.,
724b935218SSantosh Puranik  the hardware level of the FRU.
734b935218SSantosh Puranik
744b935218SSantosh Puranik  Some of the VPD will need to be exchanged with the host.
754b935218SSantosh Puranik
76f4febd00SPatrick Williams  Manufacturing and Service engineers need the ability to view and program the
77f4febd00SPatrick Williams  FRU VPD without powering the system ON.
784b935218SSantosh Puranik
794b935218SSantosh Puranik  Certain system level VPD is also used by applications on the BMC to determine
804b935218SSantosh Puranik  the system type, model on which it is running.
814b935218SSantosh Puranik
824b935218SSantosh Puranik- If a FRU does not have a VPD store such as an EEPROM, the BMC should be able
834b935218SSantosh Puranik  to synthesize VPD for such FRUs. Details on VPD synthesis will be in its own
844b935218SSantosh Puranik  design document and are not covered here.
854b935218SSantosh Puranik
864b935218SSantosh Puranik- The BMC should be able to recollect VPD for FRUs that can be hotplugged or
874b935218SSantosh Puranik  serviced when the BMC is running.
884b935218SSantosh Puranik
894b935218SSantosh Puranik- The BMC must log errors if any of the VPD cannot be properly parsed or fails
904b935218SSantosh Puranik  ECC checks.
914b935218SSantosh Puranik
924b935218SSantosh Puranik- The BMC must create/update FRU inventory objects for all FRUs that it collects
934b935218SSantosh Puranik  VPD for. The inventory D-Bus object must contain (among other details), the
944b935218SSantosh Puranik  serial number, part number and CCIN (an IBM way of differentiating different
954b935218SSantosh Puranik  versions of a FRU) of the FRU.
964b935218SSantosh Puranik
974b935218SSantosh Puranik- Applications on the BMC need to have the ability to query any given VPD
984b935218SSantosh Puranik  keyword for a given FRU.
994b935218SSantosh Puranik
1004b935218SSantosh Puranik- Applications also need to have the ability to update the VPD contents in a
1014b935218SSantosh Puranik  FRU. For example, the BMC needs to have the ability to update the system VPD
1024b935218SSantosh Puranik  in scenarios where the FRU containing the system VPD is repaired in the field.
1034b935218SSantosh Puranik
1044b935218SSantosh Puranik- There needs to be a tool/API that allows viewing and updating VPD for any
1054b935218SSantosh Puranik  given FRU. This includes FRUs that the BMC does not directly collect VPD for
1064b935218SSantosh Puranik  (such as FRUs that can be accessed both by the BMC and the host, but the host
1074b935218SSantosh Puranik  collects VPD for)
1084b935218SSantosh Puranik
1094b935218SSantosh Puranik## Proposed Design
110f4febd00SPatrick Williams
1114b935218SSantosh PuranikThis document covers the architectural, interface, and design details. It
1124b935218SSantosh Puranikprovides recommendations for implementations, but implementation details are
1134b935218SSantosh Puranikoutside the scope of this document.
1144b935218SSantosh Puranik
1154b935218SSantosh PuranikThe proposal here is to build upon the existing VPD collection design used by
1164b935218SSantosh Puranikopen power. The current implementation consists of the following entities:
1174b935218SSantosh Puranik
118f4febd00SPatrick Williams- [op-vpd-parser] [2] service, which parses the contents of an EEPROM containing
119f4febd00SPatrick Williams  VPD in the OpenPower VPD format.
1204b935218SSantosh Puranik
1214b935218SSantosh Puranik- A udev [rule] [3] that is used by systemd to launch the above service as
1224b935218SSantosh Puranik  EEPROM devices are connected.
1234b935218SSantosh Puranik
1244b935218SSantosh Puranik- A set of config [files] [4] that describe the inventory objects and D-Bus
1254b935218SSantosh Puranik  properties to update for a given FRU.
1264b935218SSantosh Puranik
1274b935218SSantosh PuranikIn order to meet the requirements noted in the previous section, the following
1284b935218SSantosh Puranikupdates will be made:
1294b935218SSantosh Puranik
1304b935218SSantosh Puranik- Two new services will be created to handle the new VPD formats. ipz-vpd-parser
1314b935218SSantosh Puranik  and a keyword-vpd-parser. These services shall be templated to allow for
1324b935218SSantosh Puranik  multiple instances to be run.
1334b935218SSantosh Puranik
1344b935218SSantosh Puranik- Another service will be created to update the inventory with location code
1354b935218SSantosh Puranik  information. Since the location code expansion comes from the system VPD, this
1364b935218SSantosh Puranik  service can only be launched after the system VPD (stored on the backplane) is
1374b935218SSantosh Puranik  collected.
1384b935218SSantosh Puranik
1394b935218SSantosh Puranik- There will be one udev rule per EEPROM on the system from which the BMC has to
1404b935218SSantosh Puranik  collect VPD. We could also have just a single rule, but that would mean we
1414b935218SSantosh Puranik  would have to filter out non-VPD EEPROMs somehow.
1424b935218SSantosh Puranik
1434b935218SSantosh Puranik- Each udev rule will be setup to launch an instance of one of the VPD parser
144f4febd00SPatrick Williams  services (The format of the VPD in any given EEPROM are known at build time as
145f4febd00SPatrick Williams  they are system specific)
1464b935218SSantosh Puranik
1474b935218SSantosh Puranik- The service (one instance of ipz-vpd-parser or keyword-vpd-parser), when
148f4febd00SPatrick Williams  launched, will read the EEPROM, parse its contents and use config files to
149f4febd00SPatrick Williams  determine what VPD contents to store in the inventory.
1504b935218SSantosh Puranik
1514b935218SSantosh Puranik- The service will update the inventory D-Bus object with the contents of the
152f4febd00SPatrick Williams  VPD in the following format: There will be one interface per record (ex, VINI
153f4febd00SPatrick Williams  record) which will have each keyword as a property (ex, FN, PN). This will
154f4febd00SPatrick Williams  allow us to support multiple records that can have the same keyword and will
155f4febd00SPatrick Williams  also serve as means to logically group keywords in the inventory, quite
156f4febd00SPatrick Williams  similar to how they are grouped in the actual VPD. For example (some names
157f4febd00SPatrick Williams  here are made up, but they help illustrate the point), for the VINI record
158f4febd00SPatrick Williams  containing keywords SN, FN and CCIN, the representation in D-Bus would look
159f4febd00SPatrick Williams  like:
1604b935218SSantosh Puranik
1614b935218SSantosh Puranik```
1624b935218SSantosh PuranikInterface: com.ibm.ipzvpd.VINI
1634b935218SSantosh PuranikProperties:
1644b935218SSantosh Puranik    SN
1654b935218SSantosh Puranik    FN
1664b935218SSantosh Puranik    CCIN
1674b935218SSantosh Puranik```
1684b935218SSantosh Puranik
1694b935218SSantosh Puranik- In case of keyword format VPD, all keywords shall be placed as properties
1704b935218SSantosh Puranik  under a single interface.
1714b935218SSantosh Puranik
1724b935218SSantosh Puranik- The parser services will not format or transform the data in VPD in any way
1734b935218SSantosh Puranik  before updating the properties noted above, the properties shall be stored as
1744b935218SSantosh Puranik  byte arrays. Note, however, that the services will continue updating the
1754b935218SSantosh Puranik  commonly used FRU properties such as SerialNumber, PartNumber as strings, just
1764b935218SSantosh Puranik  as the openpower-vpd-parser does.
1774b935218SSantosh Puranik
1784b935218SSantosh Puranik- To handle VPD writes, another systemd service will be launched once all the
1794b935218SSantosh Puranik  VPD read services have completed. This service shall be a daemon that will
1804b935218SSantosh Puranik  manage parallel writes to EEPROMs. The VPD writer service will expose D-bus
1814b935218SSantosh Puranik  interfaces to update VPD for a FRU given its inventory path.
1824b935218SSantosh Puranik
183f4febd00SPatrick Williams- Generation of the udev rules and configs shall be layered such that they can
184f4febd00SPatrick Williams  be tweaked on a per-system basis.
1854b935218SSantosh Puranik
1864b935218SSantosh Puranik### Open topics
187f4febd00SPatrick Williams
1884b935218SSantosh PuranikSome open questions:
1894b935218SSantosh Puranik
1904b935218SSantosh Puranik- Some more thought is needed on how concurrent maintenance (replacing a FRU
1914b935218SSantosh Puranik  when the host is up and running) will be handled. That will be presented in
1924b935218SSantosh Puranik  its own design document.
1934b935218SSantosh Puranik
1944b935218SSantosh Puranik## Alternatives Considered
195f4febd00SPatrick Williams
1964b935218SSantosh PuranikThe following alternative designs were considered:
197f4febd00SPatrick Williams
1984b935218SSantosh Puranik### Write a standalone VPD server app
199f4febd00SPatrick Williams
2004b935218SSantosh PuranikOne option considered was to develop a standalone, do-it-all VPD application on
2014b935218SSantosh Puranikthe BMC that collects all of the VPD by BMC standby. The application has to be a
2024b935218SSantosh Puranikdaemon that will expose a set of D-bus interfaces to:
2034b935218SSantosh Puranik
2044b935218SSantosh Puranik- Collect/recollect all VPD.
2054b935218SSantosh Puranik- Query a given FRU for its VPD. Example read the serial number of the VRM.
2064b935218SSantosh Puranik- Update the VPD keyword(s) for a given FRU.
2074b935218SSantosh Puranik- Concurrently maintain a FRU, which will in turn perform a remove/add/replace
2084b935218SSantosh Puranik  operation.
2094b935218SSantosh Puranik
2104b935218SSantosh PuranikThe application would be driven off of a configuration file that lists the FRUs
2114b935218SSantosh Puranikavailable for a given system, their I2C bus address, slave address etc.
2124b935218SSantosh Puranik
2134b935218SSantosh PuranikThis option was rejected for the following reasons:
2144b935218SSantosh Puranik
2154b935218SSantosh Puranik- Design would make the application very specific to a given system or a set of
2164b935218SSantosh Puranik  VPD formats. Although the application could be written in a way that allows
2174b935218SSantosh Puranik  plugging in support for different VPD formats, it was deemed that the current
2184b935218SSantosh Puranik  approach of small applications that target a very specific requirement is
2194b935218SSantosh Puranik  better.
2204b935218SSantosh Puranik- The design does not leverage upon the layered design approach that the chosen
2214b935218SSantosh Puranik  option allows us to do.
2224b935218SSantosh Puranik
2234b935218SSantosh Puranik### Build upon the entity manager
224f4febd00SPatrick Williams
225f4febd00SPatrick WilliamsUsing the entity manager: https://github.com/openbmc/entity-manager. The Entity
226f4febd00SPatrick Williamsmanager has an application called the FruDevice, which probes /dev/i2c/ for
227f4febd00SPatrick WilliamsEEPROMs, reads (IPMI format) VPD and stores it on DBUS.
2284b935218SSantosh Puranik
2294b935218SSantosh PuranikThe application could be enhanced to:
230f4febd00SPatrick Williams
2314b935218SSantosh Puranik- Add support for other VPD formats such as the IPZ and keyword format.
2324b935218SSantosh Puranik- Perhaps update a different set of data into a different DBUS object, like the
2334b935218SSantosh Puranik  Inventory manager.
2344b935218SSantosh Puranik- Change the external DBUS interfaces that read/write FRU data to take an
2354b935218SSantosh Puranik  inventory path (instead of the I2C path, address it takes in today).
2364b935218SSantosh Puranik
2374b935218SSantosh PuranikThis option was rejected for the following reasons:
2384b935218SSantosh Puranik
2394b935218SSantosh Puranik- We do not need the full spectrum of functions offered by the entity manager,
2404b935218SSantosh Puranik  that is we do not want to replace the existing inventory manager. Moving away
2414b935218SSantosh Puranik  from the inventory manager for Power systems is outside of the scope of this
2424b935218SSantosh Puranik  document.
2434b935218SSantosh Puranik- The code did not appear very pluggable to add support for new VPD formats, we
2444b935218SSantosh Puranik  might have to end up just utilizing #ifdef's to separate functions.
2454b935218SSantosh Puranik- Does not have a way to determine system blueprint for FRU devices, scans the
2464b935218SSantosh Puranik  entire /dev/ tree to pick out EEPROMs.
2474b935218SSantosh Puranik
2484b935218SSantosh Puranik## Impacts
249f4febd00SPatrick Williams
2504b935218SSantosh PuranikThe following impacts have been identified:
251f4febd00SPatrick Williams
2524b935218SSantosh Puranik- The services to parse VPD and store it in the inventory will add some time to
2534b935218SSantosh Puranik  the BMC boot flow. The impact should be kept to a minimum by achieving maximum
2544b935218SSantosh Puranik  possible parallelism in the launching of these services.
2554b935218SSantosh Puranik- Applications that need to read VPD keywords will be impacted in the sense that
2564b935218SSantosh Puranik  they would have to use the inventory interfaces to fetch the data they are
2574b935218SSantosh Puranik  interested in.
2584b935218SSantosh Puranik
2594b935218SSantosh Puranik## Testing
260f4febd00SPatrick Williams
2614b935218SSantosh PuranikVPD parsing function can be tested by faking out the VPD EEPROMs as files on the
2624b935218SSantosh Puranikfilesystem. Such testing can also ensure that the right set of VPD data makes
2634b935218SSantosh Puranikits way into the OpenBMC Inventory. There is also a proposal to build in a file
2644b935218SSantosh Puranikmode into the application. The file mode will not need real hardware to test the
2654b935218SSantosh Puranikcode functions, but can use files on the BMC to mimic the EEPROMs.
2664b935218SSantosh Puranik
267f4febd00SPatrick WilliamsVPD writes can be tested by writing a small command line utility that can invoke
268f4febd00SPatrick Williamsthe VPD write application's APIs to write VPD.
2694b935218SSantosh Puranik
270f4febd00SPatrick Williams[1]:
271f4febd00SPatrick Williams  https://www-355.ibm.com/systems/power/openpower/posting.xhtml?postingId=1D060729AC96891885257E1B0053BC95
272f4febd00SPatrick Williams[2]:
273f4febd00SPatrick Williams  https://github.com/openbmc/meta-openpower/blob/master/recipes-phosphor/vpd/openpower-fru-vpd/op-vpd-parser.service
274f4febd00SPatrick Williams[3]:
275f4febd00SPatrick Williams  https://github.com/openbmc/meta-openpower/blob/master/recipes-phosphor/vpd/openpower-fru-vpd/70-op-vpd.rules
276f4febd00SPatrick Williams[4]:
277f4febd00SPatrick Williams  https://github.com/openbmc/meta-openpower/blob/master/recipes-phosphor/vpd/openpower-fru-vpd-layout/layout.yaml
278