+++ /dev/null
-From f20f595626d655d422955f1f326614b56da5ac98 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sun, 4 Sep 2022 15:18:30 +0300
-Subject: nvme: add common helpers to allocate and free tagsets
-
-From: Christoph Hellwig <hch@lst.de>
-
-[ Upstream commit fe60e8c534118a288cd251a59d747cbf5c03e160 ]
-
-Add common helpers to allocate and tear down the admin and I/O tag sets,
-including the special queues allocated with them.
-
-Signed-off-by: Christoph Hellwig <hch@lst.de>
-Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
-Stable-dep-of: de105068fead ("nvme: fix reconnection fail due to reserved tag allocation")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/nvme/host/core.c | 102 +++++++++++++++++++++++++++++++++++++++
- drivers/nvme/host/nvme.h | 8 +++
- 2 files changed, 110 insertions(+)
-
-diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
-index 8f06e5c1706ba..d9c7d1cf6bd2a 100644
---- a/drivers/nvme/host/core.c
-+++ b/drivers/nvme/host/core.c
-@@ -4463,6 +4463,108 @@ void nvme_complete_async_event(struct nvme_ctrl *ctrl, __le16 status,
- }
- EXPORT_SYMBOL_GPL(nvme_complete_async_event);
-
-+int nvme_alloc_admin_tag_set(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set,
-+ const struct blk_mq_ops *ops, unsigned int flags,
-+ unsigned int cmd_size)
-+{
-+ int ret;
-+
-+ memset(set, 0, sizeof(*set));
-+ set->ops = ops;
-+ set->queue_depth = NVME_AQ_MQ_TAG_DEPTH;
-+ if (ctrl->ops->flags & NVME_F_FABRICS)
-+ set->reserved_tags = NVMF_RESERVED_TAGS;
-+ set->numa_node = ctrl->numa_node;
-+ set->flags = flags;
-+ set->cmd_size = cmd_size;
-+ set->driver_data = ctrl;
-+ set->nr_hw_queues = 1;
-+ set->timeout = NVME_ADMIN_TIMEOUT;
-+ ret = blk_mq_alloc_tag_set(set);
-+ if (ret)
-+ return ret;
-+
-+ ctrl->admin_q = blk_mq_init_queue(set);
-+ if (IS_ERR(ctrl->admin_q)) {
-+ ret = PTR_ERR(ctrl->admin_q);
-+ goto out_free_tagset;
-+ }
-+
-+ if (ctrl->ops->flags & NVME_F_FABRICS) {
-+ ctrl->fabrics_q = blk_mq_init_queue(set);
-+ if (IS_ERR(ctrl->fabrics_q)) {
-+ ret = PTR_ERR(ctrl->fabrics_q);
-+ goto out_cleanup_admin_q;
-+ }
-+ }
-+
-+ ctrl->admin_tagset = set;
-+ return 0;
-+
-+out_cleanup_admin_q:
-+ blk_mq_destroy_queue(ctrl->fabrics_q);
-+out_free_tagset:
-+ blk_mq_free_tag_set(ctrl->admin_tagset);
-+ return ret;
-+}
-+EXPORT_SYMBOL_GPL(nvme_alloc_admin_tag_set);
-+
-+void nvme_remove_admin_tag_set(struct nvme_ctrl *ctrl)
-+{
-+ blk_mq_destroy_queue(ctrl->admin_q);
-+ if (ctrl->ops->flags & NVME_F_FABRICS)
-+ blk_mq_destroy_queue(ctrl->fabrics_q);
-+ blk_mq_free_tag_set(ctrl->admin_tagset);
-+}
-+EXPORT_SYMBOL_GPL(nvme_remove_admin_tag_set);
-+
-+int nvme_alloc_io_tag_set(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set,
-+ const struct blk_mq_ops *ops, unsigned int flags,
-+ unsigned int cmd_size)
-+{
-+ int ret;
-+
-+ memset(set, 0, sizeof(*set));
-+ set->ops = ops;
-+ set->queue_depth = ctrl->sqsize + 1;
-+ set->reserved_tags = NVMF_RESERVED_TAGS;
-+ set->numa_node = ctrl->numa_node;
-+ set->flags = flags;
-+ set->cmd_size = cmd_size,
-+ set->driver_data = ctrl;
-+ set->nr_hw_queues = ctrl->queue_count - 1;
-+ set->timeout = NVME_IO_TIMEOUT;
-+ if (ops->map_queues)
-+ set->nr_maps = ctrl->opts->nr_poll_queues ? HCTX_MAX_TYPES : 2;
-+ ret = blk_mq_alloc_tag_set(set);
-+ if (ret)
-+ return ret;
-+
-+ if (ctrl->ops->flags & NVME_F_FABRICS) {
-+ ctrl->connect_q = blk_mq_init_queue(set);
-+ if (IS_ERR(ctrl->connect_q)) {
-+ ret = PTR_ERR(ctrl->connect_q);
-+ goto out_free_tag_set;
-+ }
-+ }
-+
-+ ctrl->tagset = set;
-+ return 0;
-+
-+out_free_tag_set:
-+ blk_mq_free_tag_set(set);
-+ return ret;
-+}
-+EXPORT_SYMBOL_GPL(nvme_alloc_io_tag_set);
-+
-+void nvme_remove_io_tag_set(struct nvme_ctrl *ctrl)
-+{
-+ if (ctrl->ops->flags & NVME_F_FABRICS)
-+ blk_mq_destroy_queue(ctrl->connect_q);
-+ blk_mq_free_tag_set(ctrl->tagset);
-+}
-+EXPORT_SYMBOL_GPL(nvme_remove_io_tag_set);
-+
- void nvme_stop_ctrl(struct nvme_ctrl *ctrl)
- {
- nvme_mpath_stop(ctrl);
-diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
-index f9bfd6a549f37..a9e4deb1c7d01 100644
---- a/drivers/nvme/host/nvme.h
-+++ b/drivers/nvme/host/nvme.h
-@@ -686,6 +686,14 @@ void nvme_uninit_ctrl(struct nvme_ctrl *ctrl);
- void nvme_start_ctrl(struct nvme_ctrl *ctrl);
- void nvme_stop_ctrl(struct nvme_ctrl *ctrl);
- int nvme_init_ctrl_finish(struct nvme_ctrl *ctrl);
-+int nvme_alloc_admin_tag_set(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set,
-+ const struct blk_mq_ops *ops, unsigned int flags,
-+ unsigned int cmd_size);
-+void nvme_remove_admin_tag_set(struct nvme_ctrl *ctrl);
-+int nvme_alloc_io_tag_set(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set,
-+ const struct blk_mq_ops *ops, unsigned int flags,
-+ unsigned int cmd_size);
-+void nvme_remove_io_tag_set(struct nvme_ctrl *ctrl);
-
- void nvme_remove_namespaces(struct nvme_ctrl *ctrl);
-
---
-2.43.0
-
+++ /dev/null
-From 21780eca45d4ee620b41e8a2b60160bb6ae30866 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 30 Nov 2022 17:28:48 +0100
-Subject: nvme: add the Apple shared tag workaround to nvme_alloc_io_tag_set
-
-From: Christoph Hellwig <hch@lst.de>
-
-[ Upstream commit 93b24f579c392bac2e491fee79ad5ce5a131992e ]
-
-Add the apple shared tag workaround to nvme_alloc_io_tag_set to prepare
-for using that helper in the PCIe driver.
-
-Signed-off-by: Christoph Hellwig <hch@lst.de>
-Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
-Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
-Stable-dep-of: de105068fead ("nvme: fix reconnection fail due to reserved tag allocation")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/nvme/host/core.c | 8 +++++++-
- 1 file changed, 7 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
-index a65b35d20c7fb..a13c2f3a043d4 100644
---- a/drivers/nvme/host/core.c
-+++ b/drivers/nvme/host/core.c
-@@ -4527,7 +4527,13 @@ int nvme_alloc_io_tag_set(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set,
- memset(set, 0, sizeof(*set));
- set->ops = ops;
- set->queue_depth = ctrl->sqsize + 1;
-- if (ctrl->ops->flags & NVME_F_FABRICS)
-+ /*
-+ * Some Apple controllers requires tags to be unique across admin and
-+ * the (only) I/O queue, so reserve the first 32 tags of the I/O queue.
-+ */
-+ if (ctrl->quirks & NVME_QUIRK_SHARED_TAGS)
-+ set->reserved_tags = NVME_AQ_DEPTH;
-+ else if (ctrl->ops->flags & NVME_F_FABRICS)
- set->reserved_tags = NVMF_RESERVED_TAGS;
- set->numa_node = ctrl->numa_node;
- set->flags = flags;
---
-2.43.0
-
+++ /dev/null
-From 2d0d3be103fe6ba53e4ebcb7302e4b524a9099fa Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 11 Mar 2024 10:09:27 +0800
-Subject: nvme: fix reconnection fail due to reserved tag allocation
-
-From: Chunguang Xu <chunguang.xu@shopee.com>
-
-[ Upstream commit de105068fead55ed5c07ade75e9c8e7f86a00d1d ]
-
-We found a issue on production environment while using NVMe over RDMA,
-admin_q reconnect failed forever while remote target and network is ok.
-After dig into it, we found it may caused by a ABBA deadlock due to tag
-allocation. In my case, the tag was hold by a keep alive request
-waiting inside admin_q, as we quiesced admin_q while reset ctrl, so the
-request maked as idle and will not process before reset success. As
-fabric_q shares tagset with admin_q, while reconnect remote target, we
-need a tag for connect command, but the only one reserved tag was held
-by keep alive command which waiting inside admin_q. As a result, we
-failed to reconnect admin_q forever. In order to fix this issue, I
-think we should keep two reserved tags for admin queue.
-
-Fixes: ed01fee283a0 ("nvme-fabrics: only reserve a single tag")
-Signed-off-by: Chunguang Xu <chunguang.xu@shopee.com>
-Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
-Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
-Reviewed-by: Christoph Hellwig <hch@lst.de>
-Signed-off-by: Keith Busch <kbusch@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/nvme/host/core.c | 6 ++++--
- drivers/nvme/host/fabrics.h | 7 -------
- 2 files changed, 4 insertions(+), 9 deletions(-)
-
-diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
-index a13c2f3a043d4..bc4e9d625a61b 100644
---- a/drivers/nvme/host/core.c
-+++ b/drivers/nvme/host/core.c
-@@ -4473,7 +4473,8 @@ int nvme_alloc_admin_tag_set(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set,
- set->ops = ops;
- set->queue_depth = NVME_AQ_MQ_TAG_DEPTH;
- if (ctrl->ops->flags & NVME_F_FABRICS)
-- set->reserved_tags = NVMF_RESERVED_TAGS;
-+ /* Reserved for fabric connect and keep alive */
-+ set->reserved_tags = 2;
- set->numa_node = ctrl->numa_node;
- set->flags = flags;
- set->cmd_size = cmd_size;
-@@ -4534,7 +4535,8 @@ int nvme_alloc_io_tag_set(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set,
- if (ctrl->quirks & NVME_QUIRK_SHARED_TAGS)
- set->reserved_tags = NVME_AQ_DEPTH;
- else if (ctrl->ops->flags & NVME_F_FABRICS)
-- set->reserved_tags = NVMF_RESERVED_TAGS;
-+ /* Reserved for fabric connect */
-+ set->reserved_tags = 1;
- set->numa_node = ctrl->numa_node;
- set->flags = flags;
- set->cmd_size = cmd_size,
-diff --git a/drivers/nvme/host/fabrics.h b/drivers/nvme/host/fabrics.h
-index 561c2abd3892b..256bb91d33f2d 100644
---- a/drivers/nvme/host/fabrics.h
-+++ b/drivers/nvme/host/fabrics.h
-@@ -18,13 +18,6 @@
- /* default is -1: the fail fast mechanism is disabled */
- #define NVMF_DEF_FAIL_FAST_TMO -1
-
--/*
-- * Reserved one command for internal usage. This command is used for sending
-- * the connect command, as well as for the keep alive command on the admin
-- * queue once live.
-- */
--#define NVMF_RESERVED_TAGS 1
--
- /*
- * Define a host as seen by the target. We allocate one at boot, but also
- * allow the override it when creating controllers. This is both to provide
---
-2.43.0
-
+++ /dev/null
-From ba17729ae9aaa82d2cb0f6230d60c8dfe957cdad Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 30 Nov 2022 17:27:07 +0100
-Subject: nvme: only set reserved_tags in nvme_alloc_io_tag_set for fabrics
- controllers
-
-From: Christoph Hellwig <hch@lst.de>
-
-[ Upstream commit b794d1c2ad6d7921f2867ce393815ad31b5b5a83 ]
-
-The reserved_tags are only needed for fabrics controllers. Right now only
-fabrics drivers call this helper, so this is harmless, but we'll use it
-in the PCIe driver soon.
-
-Signed-off-by: Christoph Hellwig <hch@lst.de>
-Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
-Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
-Stable-dep-of: de105068fead ("nvme: fix reconnection fail due to reserved tag allocation")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/nvme/host/core.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
-index d9c7d1cf6bd2a..a65b35d20c7fb 100644
---- a/drivers/nvme/host/core.c
-+++ b/drivers/nvme/host/core.c
-@@ -4527,7 +4527,8 @@ int nvme_alloc_io_tag_set(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set,
- memset(set, 0, sizeof(*set));
- set->ops = ops;
- set->queue_depth = ctrl->sqsize + 1;
-- set->reserved_tags = NVMF_RESERVED_TAGS;
-+ if (ctrl->ops->flags & NVME_F_FABRICS)
-+ set->reserved_tags = NVMF_RESERVED_TAGS;
- set->numa_node = ctrl->numa_node;
- set->flags = flags;
- set->cmd_size = cmd_size,
---
-2.43.0
-
s390-vtime-fix-average-steal-time-calculation.patch
soc-fsl-dpio-fix-kcalloc-argument-order.patch
hsr-fix-uninit-value-access-in-hsr_get_node.patch
-nvme-add-common-helpers-to-allocate-and-free-tagsets.patch
-nvme-only-set-reserved_tags-in-nvme_alloc_io_tag_set.patch
-nvme-add-the-apple-shared-tag-workaround-to-nvme_all.patch
-nvme-fix-reconnection-fail-due-to-reserved-tag-alloc.patch
net-mtk_eth_soc-move-mac_mcr-setting-to-mac_finish.patch
net-mediatek-mtk_eth_soc-clear-mac_mcr_force_link-on.patch
net-ethernet-mtk_eth_soc-fix-ppe-hanging-issue.patch