From: minwoo.im.dev@gmail.com (Minwoo Im)
Subject: [PATCH v2 2/3] nvme-pci: Add support for variable IO SQ element size
Date: Wed, 17 Jul 2019 20:51:45 +0900 [thread overview]
Message-ID: <20190717115145.GB10495@minwoo-desktop> (raw)
In-Reply-To: <20190717004527.30363-2-benh@kernel.crashing.org>
On 19-07-17 10:45:26, Benjamin Herrenschmidt wrote:
> The size of a submission queue element should always be 6 (64 bytes)
> by spec.
>
> However some controllers such as Apple's are not properly implementing
> the standard and require a different size.
>
> This provides the ground work for the subsequent quirks for these
> controllers.
>
> Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
> ---
> drivers/nvme/host/pci.c | 11 ++++++++---
> include/linux/nvme.h | 1 +
> 2 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index 8f006638452b..1637677afb78 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -28,7 +28,7 @@
> #include "trace.h"
> #include "nvme.h"
>
> -#define SQ_SIZE(q) ((q)->q_depth * sizeof(struct nvme_command))
> +#define SQ_SIZE(q) ((q)->q_depth << (q)->sqes)
> #define CQ_SIZE(q) ((q)->q_depth * sizeof(struct nvme_completion))
>
> #define SGES_PER_PAGE (PAGE_SIZE / sizeof(struct nvme_sgl_desc))
> @@ -100,6 +100,7 @@ struct nvme_dev {
> unsigned io_queues[HCTX_MAX_TYPES];
> unsigned int num_vecs;
> int q_depth;
> + int io_sqes;
> u32 db_stride;
> void __iomem *bar;
> unsigned long bar_mapped_size;
> @@ -162,7 +163,7 @@ static inline struct nvme_dev *to_nvme_dev(struct nvme_ctrl *ctrl)
> struct nvme_queue {
> struct nvme_dev *dev;
> spinlock_t sq_lock;
> - struct nvme_command *sq_cmds;
> + void *sq_cmds;
It would be great if it can remain the existing data type for the
SQEs... But I'm fine with this also.
It looks good to me.
Reviewed-by: Minwoo Im <minwoo.im.dev at gmail.com>
Thanks,
WARNING: multiple messages have this Message-ID (diff)
From: Minwoo Im <minwoo.im.dev@gmail.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org,
Paul Pawlowski <paul@mrarm.io>, Jens Axboe <axboe@fb.com>,
Keith Busch <kbusch@kernel.org>, Christoph Hellwig <hch@lst.de>,
Minwoo Im <minwoo.im.dev@gmail.com>
Subject: Re: [PATCH v2 2/3] nvme-pci: Add support for variable IO SQ element size
Date: Wed, 17 Jul 2019 20:51:45 +0900 [thread overview]
Message-ID: <20190717115145.GB10495@minwoo-desktop> (raw)
In-Reply-To: <20190717004527.30363-2-benh@kernel.crashing.org>
On 19-07-17 10:45:26, Benjamin Herrenschmidt wrote:
> The size of a submission queue element should always be 6 (64 bytes)
> by spec.
>
> However some controllers such as Apple's are not properly implementing
> the standard and require a different size.
>
> This provides the ground work for the subsequent quirks for these
> controllers.
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
> drivers/nvme/host/pci.c | 11 ++++++++---
> include/linux/nvme.h | 1 +
> 2 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index 8f006638452b..1637677afb78 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -28,7 +28,7 @@
> #include "trace.h"
> #include "nvme.h"
>
> -#define SQ_SIZE(q) ((q)->q_depth * sizeof(struct nvme_command))
> +#define SQ_SIZE(q) ((q)->q_depth << (q)->sqes)
> #define CQ_SIZE(q) ((q)->q_depth * sizeof(struct nvme_completion))
>
> #define SGES_PER_PAGE (PAGE_SIZE / sizeof(struct nvme_sgl_desc))
> @@ -100,6 +100,7 @@ struct nvme_dev {
> unsigned io_queues[HCTX_MAX_TYPES];
> unsigned int num_vecs;
> int q_depth;
> + int io_sqes;
> u32 db_stride;
> void __iomem *bar;
> unsigned long bar_mapped_size;
> @@ -162,7 +163,7 @@ static inline struct nvme_dev *to_nvme_dev(struct nvme_ctrl *ctrl)
> struct nvme_queue {
> struct nvme_dev *dev;
> spinlock_t sq_lock;
> - struct nvme_command *sq_cmds;
> + void *sq_cmds;
It would be great if it can remain the existing data type for the
SQEs... But I'm fine with this also.
It looks good to me.
Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>
Thanks,
next prev parent reply other threads:[~2019-07-17 11:51 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-17 0:45 [PATCH v2 1/3] nvme-pci: Pass the queue to SQ_SIZE/CQ_SIZE macros Benjamin Herrenschmidt
2019-07-17 0:45 ` Benjamin Herrenschmidt
2019-07-17 0:45 ` [PATCH v2 2/3] nvme-pci: Add support for variable IO SQ element size Benjamin Herrenschmidt
2019-07-17 0:45 ` Benjamin Herrenschmidt
2019-07-17 11:51 ` Minwoo Im [this message]
2019-07-17 11:51 ` Minwoo Im
2019-07-17 12:02 ` Benjamin Herrenschmidt
2019-07-17 12:02 ` Benjamin Herrenschmidt
2019-07-18 7:11 ` [PATCH] nvme-pci: Support shared tags across queues for Apple 2018 controllers Benjamin Herrenschmidt
2019-07-18 7:11 ` Benjamin Herrenschmidt
2019-07-18 7:16 ` Benjamin Herrenschmidt
2019-07-18 7:16 ` Benjamin Herrenschmidt
2019-07-17 0:45 ` [PATCH v2 3/3] nvme-pci: Add support for Apple 2018+ models Benjamin Herrenschmidt
2019-07-17 0:45 ` Benjamin Herrenschmidt
2019-07-17 4:50 ` Christoph Hellwig
2019-07-17 4:50 ` Christoph Hellwig
2019-07-17 4:53 ` Benjamin Herrenschmidt
2019-07-17 4:53 ` Benjamin Herrenschmidt
2019-07-17 11:54 ` Minwoo Im
2019-07-17 11:54 ` Minwoo Im
2019-07-17 11:42 ` [PATCH v2 1/3] nvme-pci: Pass the queue to SQ_SIZE/CQ_SIZE macros Minwoo Im
2019-07-17 11:42 ` Minwoo Im
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=20190717115145.GB10495@minwoo-desktop \
--to=minwoo.im.dev@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.