public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Bean Huo <beanhuo@iokpp.de>
To: Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@kernel.dk>,
	Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>
Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org,
	Bean Huo <beanhuo@micron.com>
Subject: [PATCH] nvme: skip I/O Command Set specific Identify Controller on pre-2.0 devices
Date: Sun,  3 May 2026 22:02:43 +0200	[thread overview]
Message-ID: <20260503200243.2968366-1-beanhuo@iokpp.de> (raw)

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


             reply	other threads:[~2026-05-03 20:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-03 20:02 Bean Huo [this message]
2026-05-04  4:36 ` [PATCH] nvme: skip I/O Command Set specific Identify Controller on pre-2.0 devices Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260503200243.2968366-1-beanhuo@iokpp.de \
    --to=beanhuo@iokpp.de \
    --cc=axboe@kernel.dk \
    --cc=beanhuo@micron.com \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox