public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] nvme: respect NVME_QUIRK_DISABLE_WRITE_ZEROES when wzsl is set
@ 2026-03-20 19:22 Bob Beckett
  2026-03-20 19:22 ` [PATCH 2/2] nvme-pci: add NVME_QUIRK_DISABLE_WRITE_ZEROES for Kingston OM3SGP4 Bob Beckett
  2026-03-24 15:05 ` [PATCH 1/2] nvme: respect NVME_QUIRK_DISABLE_WRITE_ZEROES when wzsl is set Keith Busch
  0 siblings, 2 replies; 3+ messages in thread
From: Bob Beckett @ 2026-03-20 19:22 UTC (permalink / raw)
  To: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg
  Cc: kernel, Robert Beckett, stable, linux-nvme, linux-kernel

From: Robert Beckett <bob.beckett@collabora.com>

The NVM Command Set Identify Controller data may report a non-zero
Write Zeroes Size Limit (wzsl). When present, nvme_init_non_mdts_limits()
unconditionally overrides max_zeroes_sectors from wzsl, even if
NVME_QUIRK_DISABLE_WRITE_ZEROES previously set it to zero.

This effectively re-enables write zeroes for devices that need it
disabled, defeating the quirk. Several Kingston OM* drives rely on
this quirk to avoid firmware issues with write zeroes commands.

Check for the quirk before applying the wzsl override.

Fixes: 5befc7c26e5a ("nvme: implement non-mdts command limits")
Cc: stable@vger.kernel.org
Signed-off-by: Robert Beckett <bob.beckett@collabora.com>
Assisted-by: claude-opus-4-6-v1
---
 drivers/nvme/host/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 766e9cc4ffca..ce25c8a4e84b 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3388,7 +3388,7 @@ static int nvme_init_non_mdts_limits(struct nvme_ctrl *ctrl)
 
 	ctrl->dmrl = id->dmrl;
 	ctrl->dmrsl = le32_to_cpu(id->dmrsl);
-	if (id->wzsl)
+	if (id->wzsl && !(ctrl->quirks & NVME_QUIRK_DISABLE_WRITE_ZEROES))
 		ctrl->max_zeroes_sectors = nvme_mps_to_sectors(ctrl, id->wzsl);
 
 free_data:
-- 
2.48.1


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

end of thread, other threads:[~2026-03-24 15:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-20 19:22 [PATCH 1/2] nvme: respect NVME_QUIRK_DISABLE_WRITE_ZEROES when wzsl is set Bob Beckett
2026-03-20 19:22 ` [PATCH 2/2] nvme-pci: add NVME_QUIRK_DISABLE_WRITE_ZEROES for Kingston OM3SGP4 Bob Beckett
2026-03-24 15:05 ` [PATCH 1/2] nvme: respect NVME_QUIRK_DISABLE_WRITE_ZEROES when wzsl is set Keith Busch

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