Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme: fix cns check
@ 2024-10-09 21:40 Keith Busch
  2024-10-10  7:56 ` Christoph Hellwig
  0 siblings, 1 reply; 7+ messages in thread
From: Keith Busch @ 2024-10-09 21:40 UTC (permalink / raw)
  To: linux-nvme, hch; +Cc: Keith Busch

From: Keith Busch <kbusch@kernel.org>

The 1.1 spec defined two bits for the Identify CNS field, so such an
implementation wouldn't be expected to check the full byte for a
decoding it. Provide a different helper function to make these
decisions as the existing check only separates the single-bit from the
two-bit spec versions.

Signed-off-by: Keith Busch <kbusch@kernel.org>
---
 drivers/nvme/host/core.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 10eca7660ca7c..0f7ff5f417f17 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1412,6 +1412,11 @@ static bool nvme_ctrl_limited_cns(struct nvme_ctrl *ctrl)
 	return ctrl->vs < NVME_VS(1, 1, 0);
 }
 
+static bool nvme_ctrl_byte_cns(struct nvme_ctrl *ctrl)
+{
+	return ctrl->vs >= NVME_VS(1, 2, 0);
+}
+
 static int nvme_identify_ctrl(struct nvme_ctrl *dev, struct nvme_id_ctrl **id)
 {
 	struct nvme_command c = { };
@@ -3113,7 +3118,7 @@ static int nvme_init_non_mdts_limits(struct nvme_ctrl *ctrl)
 		ctrl->max_zeroes_sectors = 0;
 
 	if (ctrl->subsys->subtype != NVME_NQN_NVME ||
-	    nvme_ctrl_limited_cns(ctrl) ||
+	    !nvme_ctrl_byte_cns(ctrl) ||
 	    test_bit(NVME_CTRL_SKIP_ID_CNS_CS, &ctrl->flags))
 		return 0;
 
-- 
2.43.5



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

end of thread, other threads:[~2024-10-15 15:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-09 21:40 [PATCH] nvme: fix cns check Keith Busch
2024-10-10  7:56 ` Christoph Hellwig
2024-10-10 15:11   ` Keith Busch
2024-10-11  8:09     ` Christoph Hellwig
2024-10-15 14:36       ` Keith Busch
2024-10-15 15:16         ` Christoph Hellwig
2024-10-15 15:20           ` Keith Busch

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