blob: 0077b7b4272d3817230fe0484af730be6c6258f8 [file] [log] [blame] [edit]
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