From: Andrey Nikitin <nikitina@amazon.com>
To: <linux-nvme@lists.infradead.org>
Cc: <benh@kernel.crashing.org>, <davebuch@amazon.com>,
Andrey Nikitin <nikitina@amazon.com>
Subject: [RFC PATCH 2/3] nvme: add NVM set structures
Date: Fri, 24 Sep 2021 21:08:08 +0000 [thread overview]
Message-ID: <20210924210809.14536-3-nikitina@amazon.com> (raw)
In-Reply-To: <20210924210809.14536-1-nikitina@amazon.com>
This patch adds NVM set and SQ association structure as defined by
NVMe 1.4 specification along with a helper function to check for
NVM sets and SQ associations support presented by the controller.
Signed-off-by: Andrey Nikitin <nikitina@amazon.com>
---
drivers/nvme/host/core.c | 1 +
drivers/nvme/host/nvme.h | 8 ++++++++
include/linux/nvme.h | 11 +++++++++--
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 8679a108f571..63d6a2162e72 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2889,6 +2889,7 @@ static int nvme_init_identify(struct nvme_ctrl *ctrl)
ctrl->kas = le16_to_cpu(id->kas);
ctrl->max_namespaces = le32_to_cpu(id->mnan);
ctrl->ctratt = le32_to_cpu(id->ctratt);
+ ctrl->nsetidmax = le16_to_cpu(id->nsetidmax);
if (id->rtd3e) {
/* us -> s */
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index a2e1f298b217..03be6c913216 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -290,6 +290,7 @@ struct nvme_ctrl {
u32 oaes;
u32 aen_result;
u32 ctratt;
+ u16 nsetidmax;
unsigned int shutdown_timeout;
unsigned int kato;
bool subsystem;
@@ -630,6 +631,13 @@ static inline bool nvme_is_aen_req(u16 qid, __u16 command_id)
nvme_tag_from_cid(command_id) >= NVME_AQ_BLK_MQ_DEPTH;
}
+static inline bool nvme_is_qassoc_supported(struct nvme_ctrl *ctrl)
+{
+ return (ctrl->ctratt & NVME_CTRL_ATTR_NVM_SETS) &&
+ (ctrl->ctratt & NVME_CTRL_ATTR_SQ_ASSOC) &&
+ ctrl->nsetidmax > 0;
+}
+
void nvme_complete_rq(struct request *req);
blk_status_t nvme_host_path_error(struct request *req);
bool nvme_cancel_request(struct request *req, void *data, bool reserved);
diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index b7c4c4130b65..04aaeb937c94 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -25,6 +25,7 @@
#define NVME_RDMA_IP_PORT 4420
#define NVME_NSID_ALL 0xffffffff
+#define NVME_MAX_QID 0xffff
enum nvme_subsys_type {
NVME_NQN_DISC = 1, /* Discovery type target subsystem */
@@ -225,7 +226,9 @@ enum {
enum nvme_ctrl_attr {
NVME_CTRL_ATTR_HID_128_BIT = (1 << 0),
+ NVME_CTRL_ATTR_NVM_SETS = (1 << 2),
NVME_CTRL_ATTR_TBKAS = (1 << 6),
+ NVME_CTRL_ATTR_SQ_ASSOC = (1 << 8),
};
struct nvme_id_ctrl {
@@ -276,7 +279,8 @@ struct nvme_id_ctrl {
__le32 sanicap;
__le32 hmminds;
__le16 hmmaxd;
- __u8 rsvd338[4];
+ __le16 nsetidmax;
+ __le16 endgidmax;
__u8 anatt;
__u8 anacap;
__le32 anagrpmax;
@@ -420,6 +424,7 @@ enum {
NVME_ID_CNS_CTRL = 0x01,
NVME_ID_CNS_NS_ACTIVE_LIST = 0x02,
NVME_ID_CNS_NS_DESC_LIST = 0x03,
+ NVME_ID_CNS_NVMSET_LIST = 0x04,
NVME_ID_CNS_CS_NS = 0x05,
NVME_ID_CNS_CS_CTRL = 0x06,
NVME_ID_CNS_NS_PRESENT_LIST = 0x10,
@@ -1166,7 +1171,9 @@ struct nvme_create_sq {
__le16 qsize;
__le16 sq_flags;
__le16 cqid;
- __u32 rsvd12[4];
+ __le16 nvmsetid;
+ __u16 rsvd3;
+ __u32 rsvd13[3];
};
struct nvme_delete_queue {
--
2.32.0
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
next prev parent reply other threads:[~2021-09-24 21:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-24 21:08 [RFC PATCH 0/3] nvme sq associations Andrey Nikitin
2021-09-24 21:08 ` [RFC PATCH 1/3] nvme: split admin queue in pci Andrey Nikitin
2021-09-24 21:08 ` Andrey Nikitin [this message]
2021-09-24 21:08 ` [RFC PATCH 3/3] nvme: implement SQ associations Andrey Nikitin
2021-09-25 3:02 ` [RFC PATCH 0/3] nvme sq associations Keith Busch
2021-09-25 8:31 ` Benjamin Herrenschmidt
2021-09-25 8:36 ` Christoph Hellwig
2021-09-29 6:07 ` Chaitanya Kulkarni
2021-09-29 13:17 ` Sagi Grimberg
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=20210924210809.14536-3-nikitina@amazon.com \
--to=nikitina@amazon.com \
--cc=benh@kernel.crashing.org \
--cc=davebuch@amazon.com \
--cc=linux-nvme@lists.infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).