+++ /dev/null
-From d3205ab75e99a47539ec91ef85ba488f4ddfeaa9 Mon Sep 17 00:00:00 2001
-From: Keith Busch <kbusch@kernel.org>
-Date: Mon, 3 Apr 2023 13:09:25 -0700
-Subject: nvme: fix discard support without oncs
-
-From: Keith Busch <kbusch@kernel.org>
-
-commit d3205ab75e99a47539ec91ef85ba488f4ddfeaa9 upstream.
-
-The device can report discard support without setting the ONCS DSM bit.
-When not set, the driver clears max_discard_size expecting it to be set
-later. We don't know the size until we have the namespace format,
-though, so setting it is deferred until configuring one, but the driver
-was abandoning the discard settings due to that initial clearing.
-
-Move the max_discard_size calculation above the check for a '0' discard
-size.
-
-Fixes: 1a86924e4f46475 ("nvme: fix interpretation of DMRSL")
-Reported-by: Laurence Oberman <loberman@redhat.com>
-Signed-off-by: Keith Busch <kbusch@kernel.org>
-Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com>
-Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
-Tested-by: Laurence Oberman <loberman@redhat.com>
-Signed-off-by: Christoph Hellwig <hch@lst.de>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- drivers/nvme/host/core.c | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
---- a/drivers/nvme/host/core.c
-+++ b/drivers/nvme/host/core.c
-@@ -1718,6 +1718,9 @@ static void nvme_config_discard(struct g
- struct request_queue *queue = disk->queue;
- u32 size = queue_logical_block_size(queue);
-
-+ if (ctrl->dmrsl && ctrl->dmrsl <= nvme_sect_to_lba(ns, UINT_MAX))
-+ ctrl->max_discard_sectors = nvme_lba_to_sect(ns, ctrl->dmrsl);
-+
- if (ctrl->max_discard_sectors == 0) {
- blk_queue_flag_clear(QUEUE_FLAG_DISCARD, queue);
- return;
-@@ -1736,9 +1739,6 @@ static void nvme_config_discard(struct g
- if (blk_queue_flag_test_and_set(QUEUE_FLAG_DISCARD, queue))
- return;
-
-- if (ctrl->dmrsl && ctrl->dmrsl <= nvme_sect_to_lba(ns, UINT_MAX))
-- ctrl->max_discard_sectors = nvme_lba_to_sect(ns, ctrl->dmrsl);
--
- blk_queue_max_discard_sectors(queue, ctrl->max_discard_sectors);
- blk_queue_max_discard_segments(queue, ctrl->max_discard_segments);
-
+++ /dev/null
-From stable+bounces-242557-greg=kroah.com@vger.kernel.org Sat May 2 04:58:14 2026
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 1 May 2026 19:27:43 -0400
-Subject: nvme: fix interpretation of DMRSL
-To: stable@vger.kernel.org
-Cc: Tom Yan <tom.ty89@gmail.com>, Christoph Hellwig <hch@lst.de>, Sasha Levin <sashal@kernel.org>
-Message-ID: <20260501232744.4102493-1-sashal@kernel.org>
-
-From: Tom Yan <tom.ty89@gmail.com>
-
-[ Upstream commit 1a86924e4f464757546d7f7bdc469be237918395 ]
-
-DMRSLl is in the unit of logical blocks, while max_discard_sectors is
-in the unit of "linux sector".
-
-Signed-off-by: Tom Yan <tom.ty89@gmail.com>
-Signed-off-by: Christoph Hellwig <hch@lst.de>
-Stable-dep-of: 40f0496b617b ("nvme: respect NVME_QUIRK_DISABLE_WRITE_ZEROES when wzsl is set")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- drivers/nvme/host/core.c | 6 ++++--
- drivers/nvme/host/nvme.h | 1 +
- 2 files changed, 5 insertions(+), 2 deletions(-)
-
---- a/drivers/nvme/host/core.c
-+++ b/drivers/nvme/host/core.c
-@@ -1736,6 +1736,9 @@ static void nvme_config_discard(struct g
- if (blk_queue_flag_test_and_set(QUEUE_FLAG_DISCARD, queue))
- return;
-
-+ if (ctrl->dmrsl && ctrl->dmrsl <= nvme_sect_to_lba(ns, UINT_MAX))
-+ ctrl->max_discard_sectors = nvme_lba_to_sect(ns, ctrl->dmrsl);
-+
- blk_queue_max_discard_sectors(queue, ctrl->max_discard_sectors);
- blk_queue_max_discard_segments(queue, ctrl->max_discard_segments);
-
-@@ -2948,8 +2951,7 @@ static int nvme_init_non_mdts_limits(str
-
- if (id->dmrl)
- ctrl->max_discard_segments = id->dmrl;
-- if (id->dmrsl)
-- ctrl->max_discard_sectors = le32_to_cpu(id->dmrsl);
-+ ctrl->dmrsl = le32_to_cpu(id->dmrsl);
- if (id->wzsl)
- ctrl->max_zeroes_sectors = nvme_mps_to_sectors(ctrl, id->wzsl);
-
---- a/drivers/nvme/host/nvme.h
-+++ b/drivers/nvme/host/nvme.h
-@@ -299,6 +299,7 @@ struct nvme_ctrl {
- #endif
- u16 crdt[3];
- u16 oncs;
-+ u32 dmrsl;
- u16 oacs;
- u16 nssa;
- u16 nr_streams;
+++ /dev/null
-From stable+bounces-242556-greg=kroah.com@vger.kernel.org Sat May 2 04:58:05 2026
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 1 May 2026 19:27:44 -0400
-Subject: nvme: respect NVME_QUIRK_DISABLE_WRITE_ZEROES when wzsl is set
-To: stable@vger.kernel.org
-Cc: Robert Beckett <bob.beckett@collabora.com>, Keith Busch <kbusch@kernel.org>, Sasha Levin <sashal@kernel.org>
-Message-ID: <20260501232744.4102493-2-sashal@kernel.org>
-
-From: Robert Beckett <bob.beckett@collabora.com>
-
-[ Upstream commit 40f0496b617b431f8d2dd94d7f785c1121f8a68a ]
-
-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
-Signed-off-by: Keith Busch <kbusch@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- drivers/nvme/host/core.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/nvme/host/core.c
-+++ b/drivers/nvme/host/core.c
-@@ -2952,7 +2952,7 @@ static int nvme_init_non_mdts_limits(str
- if (id->dmrl)
- ctrl->max_discard_segments = 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:
media-rc-ttusbir-respect-dma-coherency-rules.patch
alsa-aoa-skip-devices-with-no-codecs-in-i2sbus_resume.patch
erofs-fix-the-out-of-bounds-nameoff-handling-for-trailing-dirents.patch
-nvme-fix-interpretation-of-dmrsl.patch
-nvme-respect-nvme_quirk_disable_write_zeroes-when-wzsl-is-set.patch
media-rc-igorplugusb-heed-coherency-rules.patch
sched-use-u64-for-bandwidth-ratio-calculations.patch
alsa-core-fix-potential-data-race-at-fasync-handling.patch
media-rc-ttusbir-fix-inverted-error-logic.patch
batman-adv-tp_meter-fix-tp_vars-reference-leak-in-receiver-shutdown.patch
media-rc-igorplugusb-fix-control-request-setup-packet.patch
-nvme-fix-discard-support-without-oncs.patch