xref: /openbmc/docs/designs/nvmemi-over-smbus.md (revision f4febd002df578bad816239b70950f84ea4567e8)
12654988cSPatrick Williams### NVMe-MI over SMBus
22654988cSPatrick Williams
3*f4febd00SPatrick WilliamsAuthor: Tony Lee <tony.lee@quantatw.com>
46ac6f3dfSPatrick Williams
5*f4febd00SPatrick WilliamsCreated: 3-8-2019
62654988cSPatrick Williams
72654988cSPatrick Williams#### Problem Description
82654988cSPatrick Williams
92654988cSPatrick WilliamsCurrently, OpenBMC does not support NVMe drive information. NVMe-MI
102654988cSPatrick Williamsspecification defines a command that can read the NVMe drive information via
112654988cSPatrick WilliamsSMBus directly. The NVMe drive can provide its information or status, like
122654988cSPatrick Williamsvendor ID, temperature, etc. The aim of this proposal is to allow users to
132654988cSPatrick Williamsmonitor NVMe drives so appropriate action can be taken.
142654988cSPatrick Williams
152654988cSPatrick Williams#### Background and References
162654988cSPatrick Williams
172654988cSPatrick WilliamsNVMe-MI specification defines a command called
18*f4febd00SPatrick Williams`NVM Express Basic Management Command` that can read the NVMe drives information
19*f4febd00SPatrick Williamsvia SMBus directly. [1]. This command uses SMBus Block Read protocol specified
20*f4febd00SPatrick Williamsby the SMBus specification. [2].
212654988cSPatrick Williams
222654988cSPatrick WilliamsFor our purpose is retrieve NVMe drives information, therefore, using NVM
232654988cSPatrick WilliamsExpress Basic Management Command where describe in NVMe-MI specification to
242654988cSPatrick Williamscommunicate with NVMe drives. According to different platforms, temperature
252654988cSPatrick Williamssensor, present status, LED and power sequence will be customized.
262654988cSPatrick Williams
272654988cSPatrick Williams[1] NVM Express Management Interface Revision 1.0a April 8, 2017 in Appendix A.
282654988cSPatrick Williams(https://nvmexpress.org/wp-content/uploads/NVM_Express_Management_Interface_1_0a_2017.04.08_-_gold.pdf)
292654988cSPatrick Williams[2] System Management Bus (SMBus) Specification Version 3.0 20 Dec 2014
302654988cSPatrick Williams(http://smbus.org/specs/SMBus_3_0_20141220.pdf)
312654988cSPatrick Williams
322654988cSPatrick Williams#### Requirements
332654988cSPatrick Williams
342654988cSPatrick WilliamsThe implementation should:
352654988cSPatrick Williams
36*f4febd00SPatrick Williams- Provide a daemon to monitor NVMe drives. Parameters to be monitored are Status
37*f4febd00SPatrick Williams  Flags, SMART Warnings, Temperature, Percentage Drive Life Used, Vendor ID, and
38*f4febd00SPatrick Williams  Serial Number.
392654988cSPatrick Williams- Provide a D-bus interface to allow other services to access data.
402654988cSPatrick Williams- Capability of communication over hardware channel I2C to NVMe drives.
412654988cSPatrick Williams- Ability to turn the fault LED on/off for each drive by SmartWarnings if the
422654988cSPatrick Williams  object path of fault LED is defined in the configuration file.
432654988cSPatrick Williams
442654988cSPatrick Williams#### Proposed Design
452654988cSPatrick Williams
462654988cSPatrick WilliamsCreate a D-bus service "xyz.openbmc_project.nvme.manager" with object paths for
472654988cSPatrick Williamseach NVMe sensor: "/xyz/openbmc_project/sensors/temperature/nvme0",
48*f4febd00SPatrick Williams"/xyz/openbmc_project/sensors/temperature/nvme1", etc. There is a JSON
49*f4febd00SPatrick Williamsconfiguration file for drive index, bus ID, and the fault LED object path for
50*f4febd00SPatrick Williamseach drive. For example,
512654988cSPatrick Williams
522654988cSPatrick Williams```json
532654988cSPatrick Williams{
542654988cSPatrick Williams  "NvmeDriveIndex": 0,
552654988cSPatrick Williams  "NVMeDriveBusID": 16,
562654988cSPatrick Williams  "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_0_fault",
572654988cSPatrick Williams  "NVMeDrivePresentPin": 148,
582654988cSPatrick Williams  "NVMeDrivePwrGoodPin": 161
592654988cSPatrick Williams},
602654988cSPatrick Williams{
612654988cSPatrick Williams  "NvmeDriveIndex": 1,
622654988cSPatrick Williams  "NVMeDriveBusID": 17,
632654988cSPatrick Williams  "NVMeDriveFaultLEDGroupPath": "/xyz/openbmc_project/led/groups/led_u2_0_fault",
642654988cSPatrick Williams  "NVMeDrivePresentPin": 149,
652654988cSPatrick Williams  "NVMeDrivePwrGoodPin": 162
662654988cSPatrick Williams}
672654988cSPatrick Williams```
682654988cSPatrick Williams
692654988cSPatrick WilliamsStructure like:
702654988cSPatrick Williams
712654988cSPatrick WilliamsUnder the D-bus named "xyz.openbmc_project.nvme.manager":
722654988cSPatrick Williams
732654988cSPatrick Williams```
742654988cSPatrick Williams    /xyz/openbmc_project
752654988cSPatrick Williams    └─/xyz/openbmc_project/sensors
762654988cSPatrick Williams      └─/xyz/openbmc_project/sensors/temperature/nvme0
772654988cSPatrick Williams```
782654988cSPatrick Williams
79*f4febd00SPatrick Williams/xyz/openbmc_project/sensors/temperature/nvme0 Which implements:
802654988cSPatrick Williams
812654988cSPatrick Williams- xyz.openbmc_project.Sensor.Value
822654988cSPatrick Williams- xyz.openbmc_project.Sensor.Threshold.Warning
832654988cSPatrick Williams- xyz.openbmc_project.Sensor.Threshold.Critical
842654988cSPatrick Williams
852654988cSPatrick WilliamsUnder the D-bus named "xyz.openbmc_project.Inventory.Manager":
862654988cSPatrick Williams
872654988cSPatrick Williams```
882654988cSPatrick Williams/xyz/openbmc_project
892654988cSPatrick Williams    └─/xyz/openbmc_project/inventory
902654988cSPatrick Williams      └─/xyz/openbmc_project/inventory/system
912654988cSPatrick Williams        └─/xyz/openbmc_project/inventory/system/chassis
922654988cSPatrick Williams          └─/xyz/openbmc_project/inventory/system/chassis/motherboard
932654988cSPatrick Williams           └─/xyz/openbmc_project/inventory/system/chassis/motherboard/nvme0
942654988cSPatrick Williams```
952654988cSPatrick Williams
96*f4febd00SPatrick Williams/xyz/openbmc_project/inventory/system/chassis/motherboard/nvme0 Which
97*f4febd00SPatrick Williamsimplements:
982654988cSPatrick Williams
992654988cSPatrick Williams- xyz.openbmc_project.Inventory.Item
1002654988cSPatrick Williams- xyz.openbmc_project.Inventory.Decorator.Asset
1012654988cSPatrick Williams- xyz.openbmc_project.Nvme.Status
1022654988cSPatrick Williams
1032654988cSPatrick WilliamsInterface `xyz.openbmc_project.Sensor.Value`, it's for hwmon to monitor
1042654988cSPatrick Williamstemperature and with the following properties:
1052654988cSPatrick Williams
1062654988cSPatrick Williams| Property | Type   | Description          |
107*f4febd00SPatrick Williams| -------- | ------ | -------------------- |
1082654988cSPatrick Williams| MaxValue | int64  | Sensor maximum value |
1092654988cSPatrick Williams| MinValue | int64  | Sensor minimum value |
1102654988cSPatrick Williams| Scale    | int64  | Sensor value scale   |
1112654988cSPatrick Williams| Unit     | string | Sensor unit          |
1122654988cSPatrick Williams| Value    | int64  | Sensor value         |
1132654988cSPatrick Williams
1142654988cSPatrick WilliamsInterface `xyz.openbmc_project.Nvme.Status` with the following properties:
1152654988cSPatrick Williams
1162654988cSPatrick Williams| Property          | Type   | Description                                  |
117*f4febd00SPatrick Williams| ----------------- | ------ | -------------------------------------------- |
1182654988cSPatrick Williams| SmartWarnings     | string | Indicates smart warnings for the state       |
1192654988cSPatrick Williams| StatusFlags       | string | Indicates the status of the drives           |
1202654988cSPatrick Williams| DriveLifeUsed     | string | A vendor specific estimate of the percentage |
1212654988cSPatrick Williams| TemperatureFault  | bool   | If warning type about temperature happened   |
1222654988cSPatrick Williams| BackupdrivesFault | bool   | If warning type about backup drives happened |
1232654988cSPatrick Williams| CapacityFault     | bool   | If warning type about capacity happened      |
1242654988cSPatrick Williams| DegradesFault     | bool   | If warning type about degrades happened      |
1252654988cSPatrick Williams| MediaFault        | bool   | If warning type about media happened         |
1262654988cSPatrick Williams
1272654988cSPatrick WilliamsInterface `xyz.openbmc_project.Inventory.Item` with the following properties:
1282654988cSPatrick Williams
1292654988cSPatrick Williams| Property   | Type   | Description                         |
130*f4febd00SPatrick Williams| ---------- | ------ | ----------------------------------- |
1312654988cSPatrick Williams| PrettyName | string | The human readable name of the item |
1322654988cSPatrick Williams| Present    | bool   | Whether or not the item is present  |
1332654988cSPatrick Williams
1342654988cSPatrick WilliamsInterface `xyz.openbmc_project.Inventory.Decorator.Asset` with the following
1352654988cSPatrick Williamsproperties:
1362654988cSPatrick Williams
1372654988cSPatrick Williams| Property     | Type   | Description                                       |
138*f4febd00SPatrick Williams| ------------ | ------ | ------------------------------------------------- |
1392654988cSPatrick Williams| PartNumber   | string | The item part number, typically a stocking number |
1402654988cSPatrick Williams| SerialNumber | string | The item serial number                            |
1412654988cSPatrick Williams| Manufacturer | string | The item manufacturer                             |
1422654988cSPatrick Williams| BuildDate    | bool   | The date of item manufacture in YYYYMMDD format   |
1432654988cSPatrick Williams| Model        | bool   | The model of the item                             |
1442654988cSPatrick Williams
1452654988cSPatrick Williams##### xyz.openbmc_project.nvme.manager.service
1462654988cSPatrick Williams
1472654988cSPatrick WilliamsThis service has several steps:
1482654988cSPatrick Williams
1492654988cSPatrick Williams1. It will register a D-bus called `xyz.openbmc_project.nvme.manager`
1502654988cSPatrick Williams   description above.
1512654988cSPatrick Williams2. Obtain the drive index, bus ID, GPIO present pin, power good pin and fault
1522654988cSPatrick Williams   LED object path from the json file mentioned above.
1532654988cSPatrick Williams3. Each cycle will do following steps:
1542654988cSPatrick Williams   1. Check if the present pin of target drive is true, if true, means drive
155*f4febd00SPatrick Williams      exists and go to next step. If not, means drive does not exists and remove
156*f4febd00SPatrick Williams      object path from D-bus by drive index.
1572654988cSPatrick Williams   2. Check if the power good pin of target drive is true, if true means drive
1582654988cSPatrick Williams      is ready then create object path by drive index and go to next step. If
1592654988cSPatrick Williams      not, means drive power abnormal, turn on fault LED and log in journal.
1602654988cSPatrick Williams   3. Send a NVMe-MI command via SMBus Block Read protocol by bus ID of target
161*f4febd00SPatrick Williams      drive to get data. Data get from NVMe drives are "Status Flags", "SMART
162*f4febd00SPatrick Williams      Warnings", "Temperature", "Percentage Drive Life Used", "Vendor ID", and
163*f4febd00SPatrick Williams      "Serial Number".
1642654988cSPatrick Williams   4. The data will be set to the properties in D-bus.
1652654988cSPatrick Williams
1662654988cSPatrick WilliamsThis service will run automatically and look up NVMe drives every second.
1672654988cSPatrick Williams
1682654988cSPatrick Williams##### Fault LED
1692654988cSPatrick Williams
1702654988cSPatrick WilliamsWhen the value obtained from the command corresponds to one of the warning
1712654988cSPatrick Williamstypes, it will trigger the fault LED of corresponding device and issue events.
1722654988cSPatrick Williams
1732654988cSPatrick Williams##### Add SEL related to NVMe
1742654988cSPatrick Williams
175*f4febd00SPatrick WilliamsThe events `TemperatureFault`, `BackupdrivesFault`, `CapacityFault`,
176*f4febd00SPatrick Williams`DegradesFault` and `MediaFault` will be generated for the NVMe errors.
1772654988cSPatrick Williams
1782654988cSPatrick Williams- Temperature Fault log : when the property `TemperatureFault` set to true
1792654988cSPatrick Williams- Backupdrives Fault log : when the property `BackupdrivesFault` set to true
1802654988cSPatrick Williams- Capacity Fault log : when the property `CapacityFault` set to true
1812654988cSPatrick Williams- Degrades Fault log : when the property `DegradesFault` set to true
1822654988cSPatrick Williams- Media Fault log: when the property `MediaFault` set to true
1832654988cSPatrick Williams
1842654988cSPatrick Williams#### Alternatives Considered
1852654988cSPatrick Williams
186*f4febd00SPatrick WilliamsNVMe-MI specification defines multiple commands that can communicate with NVMe
187*f4febd00SPatrick Williamsdrives over MCTP protocol. The NVMe-MI over MCTP has the following key
1882654988cSPatrick Williamscapabilities:
1892654988cSPatrick Williams
1902654988cSPatrick Williams- Discover drives that are present and learn capabilities of each drives.
1912654988cSPatrick Williams- Store data about the host environment enabling a Management Controller to
1922654988cSPatrick Williams  query the data later.
1932654988cSPatrick Williams- A standard format for VPD and defined mechanisms to read/write VPD contents.
1942654988cSPatrick Williams- Inventorying, configuring and monitoring.
1952654988cSPatrick Williams
1962654988cSPatrick WilliamsFor monitoring NVMe drives, using NVM Express Basic Management Command over
1972654988cSPatrick WilliamsSMBus directly is much simpler than NVMe-MI over MCTP protocol.
1982654988cSPatrick Williams
1992654988cSPatrick Williams#### Impacts
2002654988cSPatrick Williams
2012654988cSPatrick WilliamsThis application is monitoring NVMe drives via SMbus and set values to D-bus.
2022654988cSPatrick WilliamsThe impacts should be small in the system.
2032654988cSPatrick Williams
2042654988cSPatrick Williams#### Testing
2052654988cSPatrick Williams
2062654988cSPatrick WilliamsThis implementation is to use NVMe-MI-Basic command over SMBus and then set the
207*f4febd00SPatrick Williamsresponse data to D-bus. Testing will send SMBus command to the drives to get the
208*f4febd00SPatrick Williamsinformation and compare with the properties in D-bus to make sure they are the
209*f4febd00SPatrick Williamssame. The testing can be performed on different NVMe drives by different
210*f4febd00SPatrick Williamsmanufacturers. For example: Intel P4500/P4600 and Micron 9200 Max/Pro.
2112654988cSPatrick Williams
2122654988cSPatrick WilliamsUnit tests will test by function:
2132654988cSPatrick Williams
214*f4febd00SPatrick Williams- It tests the length of responded data is as same as design in the function of
215*f4febd00SPatrick Williams  getting NVMe information.
2162654988cSPatrick Williams- It tests the function of setting values to D-bus is as same as design.
2172654988cSPatrick Williams- It tests the function of turn the corresponding LED ON/OFF by different
2182654988cSPatrick Williams  Smartwarnings values.
219