[PATCH] nvme: skip I/O Command Set specific Identify Controller on pre-2.0 devices

Bean Huo posted 1 patch 1 month, 1 week ago
drivers/nvme/host/core.c | 6 ++++++
1 file changed, 6 insertions(+)
[PATCH] nvme: skip I/O Command Set specific Identify Controller on pre-2.0 devices
Posted by Bean Huo 1 month, 1 week ago
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
Re: [PATCH] nvme: skip I/O Command Set specific Identify Controller on pre-2.0 devices
Posted by Christoph Hellwig 1 month, 1 week ago
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.
Re: [PATCH] nvme: skip I/O Command Set specific Identify Controller on pre-2.0 devices
Posted by Keith Busch 1 month, 1 week ago
On Mon, May 04, 2026 at 06:36:55AM +0200, Christoph Hellwig wrote:
> 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.

The proper solution is that vendors need to have their controllers stop
logging pointless errors that don't help anything.
Re: [PATCH] nvme: skip I/O Command Set specific Identify Controller on pre-2.0 devices
Posted by Bean Huo 1 month, 1 week ago
On Wed, 2026-05-06 at 15:29 +0200, Keith Busch wrote:
> On Mon, May 04, 2026 at 06:36:55AM +0200, Christoph Hellwig wrote:
> > 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.
> 
> The proper solution is that vendors need to have their controllers stop
> logging pointless errors that don't help anything.

Thanks Christoph, Keith.

I wasn't aware that TPs can be implemented independently of the spec version
claimed by the device. I'll drop this patch and follow up with the vendor
instead.

Kind regards, 
Bean