Libnvme: Add support for command & feature lockdown log page This change applies a patch to add the enum definition and helper functions to support the command and feature lockdown log page This commit only includes the interface definition. The actual implementation to handle the log page command will be in a subsequent CL This is to support E1.S SSD left shift development Platforms-Affected: All w/ NVMe devices Tested: Successfully built the libnvme recipe with the patch and pulled the command and feature lockdown log page for redfish Google-Bug-Id: 439949469 Change-Id: I02d983002183bf9a1339840ca2d0ef687b17c61c Signed-off-by: Agrim Bharat <agrimbharat@google.com> (cherry picked from commit 2afcd4f2bb9d53e9ab6919d61c6a312e04cb3452)
diff --git a/recipes-connectivity/libnvme/libnvme/0013-Add-support-for-command-feature-lockdown-log-page.patch b/recipes-connectivity/libnvme/libnvme/0013-Add-support-for-command-feature-lockdown-log-page.patch new file mode 100644 index 0000000..0077b7b --- /dev/null +++ b/recipes-connectivity/libnvme/libnvme/0013-Add-support-for-command-feature-lockdown-log-page.patch
@@ -0,0 +1,95 @@ +From 35b33c06617e30438e331bcad719c93f65ab7a3c Mon Sep 17 00:00:00 2001 +From: Agrim Bharat <agrimbharat@google.com> +Date: Thu, 25 Sep 2025 17:29:40 +0000 +Subject: [PATCH] Add support for command & feature lockdown log page + +--- + src/nvme/mi.h | 30 ++++++++++++++++++++++++++++++ + src/nvme/types.h | 16 ++++++++++++++++ + 2 files changed, 46 insertions(+) + +diff --git a/src/nvme/mi.h b/src/nvme/mi.h +index 56591595..d4f02fe2 100644 +--- a/src/nvme/mi.h ++++ b/src/nvme/mi.h +@@ -2274,6 +2274,36 @@ static inline int nvme_mi_admin_get_log_persistent_event(nvme_mi_ctrl_t ctrl, + return nvme_mi_admin_get_log(ctrl, &args); + } + ++/** ++ * nvme_mi_admin_get_log_lockdown() - Retrieve lockdown Log ++ * @ctrl: Controller to query ++ * @cnscp: Contents and Scope of Command and Feature Identifier Lists ++ * @lockdown_log: Buffer to store the lockdown log ++ * ++ * Return: The nvme command status if a response was received (see ++ * &enum nvme_status_field) or -1 with errno set otherwise. ++ */ ++static inline int nvme_mi_admin_get_log_lockdown(nvme_mi_ctrl_t ctrl, ++ __u8 cnscp, struct nvme_lockdown_log *lockdown_log) ++{ ++ struct nvme_get_log_args args = { ++ .lpo = 0, ++ .result = NULL, ++ .log = lockdown_log, ++ .args_size = sizeof(args), ++ .lid = NVME_LOG_LID_CMD_AND_FEAT_LOCKDOWN, ++ .len = sizeof(*lockdown_log), ++ .nsid = NVME_NSID_ALL, ++ .csi = NVME_CSI_NVM, ++ .lsi = NVME_LOG_LSI_NONE, ++ .lsp = cnscp, ++ .uuidx = NVME_UUID_NONE, ++ .rae = false, ++ .ot = false, ++ }; ++ return nvme_mi_admin_get_log(ctrl, &args); ++} ++ + /** + * nvme_mi_admin_security_send() - Perform a Security Send command on a + * controller. +diff --git a/src/nvme/types.h b/src/nvme/types.h +index 94066fc2..922dc2c0 100644 +--- a/src/nvme/types.h ++++ b/src/nvme/types.h +@@ -3816,6 +3816,20 @@ struct nvme_supported_cap_config_list_log { + struct nvme_capacity_config_desc cap_config_desc[]; + }; + ++/** ++ * struct nvme_lockdown_log - Command and Feature Lockdown Log ++ * @cfila: Contents of the Command and Feature Identifier List field in the log page. ++ * @rsvd1: Reserved ++ * @lngth: Length of Command and Feature Identifier List field ++ * @cfil: Command and Feature Identifier List ++ */ ++struct nvme_lockdown_log { ++ __u8 cfila; ++ __u8 rsvd1[2]; ++ __u8 lngth; ++ __u8 cfil[508]; ++}; ++ + /** + * struct nvme_resv_notification_log - Reservation Notification Log + * @lpc: Log Page Count +@@ -6375,6 +6389,7 @@ enum nvme_identify_cns { + * @NVME_LOG_LID_SUPPORTED_CAP_CONFIG_LIST: Supported Capacity Configuration Lis + * @NVME_LOG_LID_FID_SUPPORTED_EFFECTS: Feature Identifiers Supported and Effects + * @NVME_LOG_LID_MI_CMD_SUPPORTED_EFFECTS: NVMe-MI Commands Supported and Effects ++ * @NVME_LOG_LID_CMD_AND_FEAT_LOCKDOWN: Command and Feature Lockdown + * @NVME_LOG_LID_BOOT_PARTITION: Boot Partition + * @NVME_LOG_LID_DISCOVER: Discovery + * @NVME_LOG_LID_RESERVATION: Reservation Notification +@@ -6402,6 +6417,7 @@ enum nvme_cmd_get_log_lid { + NVME_LOG_LID_SUPPORTED_CAP_CONFIG_LIST = 0x11, + NVME_LOG_LID_FID_SUPPORTED_EFFECTS = 0x12, + NVME_LOG_LID_MI_CMD_SUPPORTED_EFFECTS = 0x13, ++ NVME_LOG_LID_CMD_AND_FEAT_LOCKDOWN = 0x14, + NVME_LOG_LID_BOOT_PARTITION = 0x15, + NVME_LOG_LID_DISCOVER = 0x70, + NVME_LOG_LID_RESERVATION = 0x80, +-- +2.51.0.618.g983fd99d29-goog +
diff --git a/recipes-connectivity/libnvme/libnvme_git.bb b/recipes-connectivity/libnvme/libnvme_git.bb index 489a7d3..393ed04 100644 --- a/recipes-connectivity/libnvme/libnvme_git.bb +++ b/recipes-connectivity/libnvme/libnvme_git.bb
@@ -24,7 +24,8 @@ file://0009-mi-use-nvme_mi_msg-macro-for-nvme-mi-message.patch \ file://0010-mi-trace-NVMe-MI-command-request-after-failure.patch \ file://0011-mi-Set-RAE-1-for-Get-Log-Page-Requests.patch \ - file://0012-examples-fix-incorrect-controller-status.patch \ + file://0012-examples-fix-incorrect-controller-status.patch \ + file://0013-Add-support-for-command-feature-lockdown-log-page.patch \ " S = "${WORKDIR}/git"