Skip to contentSkip to conversation

hw/nvme: Add OCP SMART / Health Information Extended Log Page

PATCH Applied Stephen Bates 2 participants 2 messages Nov 29, 2024 – Jan 10, 2025

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 hw/nvme: Add OCP SMART / Health Information Extended Log Page

The Open Compute Project [1] includes a Datacenter NVMe
SSD Specification [2]. The most recent version of this specification (as of November 2024) is 2.6.1. This specification layers on top of the NVM Express specifications [3] to provide additional functionality. A key part of of this is the 512 Byte OCP SMART / Health Information Extended log page that is defined in Section 4.8.6 of the specification.

We add a controller argument (ocp) that toggles on/off the SMART log extended structure. To accommodate different vendor specific specifications like OCP, we add a multiplexing function (nvme_vendor_specific_log) which will route to the different log functions based on arguments and log ids. We only return the OCP extended SMART log when the command is 0xC0 and ocp has been turned on in the nvme argumants.

Though we add the whole nvme SMART log extended structure, we only populate the physical_media_units_{read,written}, log_page_version and log_page_uuid.

This patch is based on work done by Joel but has been modified enough that he requested a co-developed-by tag rather than a signed-off-by.

[1]: https://www.opencompute.org/
[2]: https://www.opencompute.org/documents/datacenter-nvme-ssd-specification-v2-6-1-pdf
[3]: https://nvmexpress.org/specifications/

---
 docs/system/devices/nvme.rst |  7 +++++
 hw/nvme/ctrl.c               | 59 ++++++++++++++++++++++++++++++++++++
 hw/nvme/nvme.h               |  1 +
 include/block/nvme.h         | 41 +++++++++++++++++++++++++
 4 files changed, 108 insertions(+)
docs/system/devices/nvme.rst +7 -0
index d2b1ca9645..6509b35fcb 100644
@@ -53,6 +53,13 @@ parameters.
   Vendor ID. Set this to ``on`` to revert to the unallocated Intel ID
   previously used.
 
+``ocp`` (default: ``off``)
+  The Open Compute Project defines the Datacenter NVMe SSD Specification that
+  sits on top of NVMe. It describes additional commands and NVMe behaviors
+  specific for the Datacenter. When this option is ``on`` OCP features such as
+  the SMART / Health information extended log become available in the
+  controller. We emulate version 5 of this log page.
+
 Additional Namespaces
 ---------------------
 
hw/nvme/ctrl.c +59 -0

83 lines not on this page · raw message

hw/nvme/nvme.h +1 -0
index 781985754d..099f40f3e9 100644
@@ -538,6 +538,7 @@ typedef struct NvmeParams {
     uint32_t  sriov_max_vq_per_vf;
     uint32_t  sriov_max_vi_per_vf;
     bool     msix_exclusive_bar;
+    bool     ocp;
 } NvmeParams;
 
 typedef struct NvmeCtrl {
include/block/nvme.h +41 -0

59 lines not on this page · raw message

Signature · 1 line
2.43.0
Reviewed-by on v2 1/1 Applied
#1 lore raw
Quoted 22 lines · Stephen Bates

The Open Compute Project [1] includes a Datacenter NVMe
SSD Specification [2]. The most recent version of this specification (as of November 2024) is 2.6.1. This specification layers on top of the NVM Express specifications [3] to provide additional functionality. A key part of of this is the 512 Byte OCP SMART / Health Information Extended log page that is defined in Section 4.8.6 of the specification.

We add a controller argument (ocp) that toggles on/off the SMART log extended structure. To accommodate different vendor specific specifications like OCP, we add a multiplexing function (nvme_vendor_specific_log) which will route to the different log functions based on arguments and log ids. We only return the OCP extended SMART log when the command is 0xC0 and ocp has been turned on in the nvme argumants.

Though we add the whole nvme SMART log extended structure, we only populate the physical_media_units_{read,written}, log_page_version and log_page_uuid.

This patch is based on work done by Joel but has been modified enough that he requested a co-developed-by tag rather than a signed-off-by.

Quoted 6 lines

[1]: https://www.opencompute.org/
[2]: https://www.opencompute.org/documents/datacenter-nvme-ssd-specification-v2-6-1-pdf
[3]: https://nvmexpress.org/specifications/

Hi Stephen,

Thanks! Applied to nvme-next!