public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme: skip I/O Command Set specific Identify Controller on pre-2.0 devices
@ 2026-05-03 20:02 Bean Huo
  2026-05-04  4:36 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Bean Huo @ 2026-05-03 20:02 UTC (permalink / raw)
  To: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg
  Cc: linux-nvme, linux-kernel, Bean Huo

From: Bean Huo <beanhuo@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@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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] nvme: skip I/O Command Set specific Identify Controller on pre-2.0 devices
  2026-05-03 20:02 [PATCH] nvme: skip I/O Command Set specific Identify Controller on pre-2.0 devices Bean Huo
@ 2026-05-04  4:36 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2026-05-04  4:36 UTC (permalink / raw)
  To: Bean Huo
  Cc: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
	linux-nvme, linux-kernel, Bean Huo

No.  NVMe allow TPs to be implemented on devices claiming earlier
compliance.  We've had this patch and this answer probably half a
dozen times now.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-05-04  4:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-03 20:02 [PATCH] nvme: skip I/O Command Set specific Identify Controller on pre-2.0 devices Bean Huo
2026-05-04  4:36 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox