[PATCH] nvme: skip I/O Command Set specific Identify Controller on pre-2.0 devices
Bean Huo
beanhuo at iokpp.de
Sun May 3 13:02:43 PDT 2026
From: Bean Huo <beanhuo at micron.com>
The I/O Command Set specific Identify Controller (CNS 06h) is only
defined in NVMe 2.0 and later. Pre-2.0 controllers return an Invalid
Field error for this command, which shows up as noise in the NVMe
error log visible via nvme-cli. Avoid sending a command that is
guaranteed to fail by checking the controller version upfront.
Note that the analogous CNS 05h (I/O Command Set specific Identify
Namespace) is intentionally not gated on version, as commit 823340b7e877
("nvme: always issue I/O Command Set specific Identify Namespace")
allows pre-2.0 controllers to optionally implement it with graceful
error handling.
Signed-off-by: Bean Huo <beanhuo at micron.com>
---
drivers/nvme/host/core.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 1e33af94c24b..71eeab8f661a 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3400,7 +3400,13 @@ static int nvme_init_non_mdts_limits(struct nvme_ctrl *ctrl)
else
ctrl->max_zeroes_sectors = 0;
+ /*
+ * I/O Command Set specific Identify Controller (CNS 06h) is only
+ * defined in NVMe 2.0 and later. Sending it to pre-2.0 controllers
+ * results in an Invalid Field error from the device.
+ */
if (!nvme_is_io_ctrl(ctrl) ||
+ ctrl->vs < NVME_VS(2, 0, 0) ||
!nvme_id_cns_ok(ctrl, NVME_ID_CNS_CS_CTRL) ||
test_bit(NVME_CTRL_SKIP_ID_CNS_CS, &ctrl->flags))
return 0;
--
2.34.1
More information about the Linux-nvme
mailing list