From: "Matias Bjørling" <m@bjorling.me>
To: Keith Busch <kbusch@meta.com>, linux-nvme@lists.infradead.org
Cc: hch@lst.de, matias.bjorling@wdc.com, kch@nvidia.com,
kanie@linux.alibaba.com, Keith Busch <kbusch@kernel.org>
Subject: Re: [PATCHv4 03/13] nvmet: implement supported log pages
Date: Fri, 8 Nov 2024 13:16:39 +0100 [thread overview]
Message-ID: <c8fa77c7-fa5e-407d-bb15-93f56c6b4967@bjorling.me> (raw)
In-Reply-To: <20241107193849.995554-4-kbusch@meta.com>
On 07-11-2024 20:38, Keith Busch wrote:
> From: Keith Busch <kbusch@kernel.org>
>
> This log is required for nvme 2.1.
>
> Signed-off-by: Keith Busch <kbusch@kernel.org>
> ---
> drivers/nvme/target/admin-cmd.c | 27 +++++++++++++++++++++++++++
> include/linux/nvme.h | 9 +++++++++
> 2 files changed, 36 insertions(+)
>
> diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
> index a13242e791c0f..712b962fe77ac 100644
> --- a/drivers/nvme/target/admin-cmd.c
> +++ b/drivers/nvme/target/admin-cmd.c
> @@ -71,6 +71,31 @@ static void nvmet_execute_get_log_page_error(struct nvmet_req *req)
> nvmet_req_complete(req, 0);
> }
>
> +static void nvmet_execute_get_supported_log_pages(struct nvmet_req *req)
> +{
> + struct nvme_supported_log *logs;
> + u16 status;
> +
> + logs = kzalloc(sizeof(*logs), GFP_KERNEL);
> + if (!logs) {
> + status = NVME_SC_INTERNAL;
> + goto out;
> + }
> +
> + logs->lids[NVME_LOG_SUPPORTED] = cpu_to_le32(NVME_LIDS_LSUPP);
> + logs->lids[NVME_LOG_ERROR] = cpu_to_le32(NVME_LIDS_LSUPP);
> + logs->lids[NVME_LOG_SMART] = cpu_to_le32(NVME_LIDS_LSUPP);
> + logs->lids[NVME_LOG_FW_SLOT] = cpu_to_le32(NVME_LIDS_LSUPP);
> + logs->lids[NVME_LOG_CHANGED_NS] = cpu_to_le32(NVME_LIDS_LSUPP);
> + logs->lids[NVME_LOG_CMD_EFFECTS] = cpu_to_le32(NVME_LIDS_LSUPP);
> + logs->lids[NVME_LOG_ANA] = cpu_to_le32(NVME_LIDS_LSUPP);
> +
> + status = nvmet_copy_to_sgl(req, 0, logs, sizeof(*logs));
> + kfree(logs);
> +out:
> + nvmet_req_complete(req, status);
> +}
> +
> static u16 nvmet_get_smart_log_nsid(struct nvmet_req *req,
> struct nvme_smart_log *slog)
> {
> @@ -323,6 +348,8 @@ static void nvmet_execute_get_log_page(struct nvmet_req *req)
> return;
>
> switch (req->cmd->get_log_page.lid) {
> + case NVME_LOG_SUPPORTED:
> + return nvmet_execute_get_supported_log_pages(req);
> case NVME_LOG_ERROR:
> return nvmet_execute_get_log_page_error(req);
> case NVME_LOG_SMART:
> diff --git a/include/linux/nvme.h b/include/linux/nvme.h
> index 0f263c7e63192..692d606edeed3 100644
> --- a/include/linux/nvme.h
> +++ b/include/linux/nvme.h
> @@ -1245,6 +1245,7 @@ enum {
> NVME_FEAT_WRITE_PROTECT = 0x84,
> NVME_FEAT_VENDOR_START = 0xC0,
> NVME_FEAT_VENDOR_END = 0xFF,
> + NVME_LOG_SUPPORTED = 0x00,
> NVME_LOG_ERROR = 0x01,
> NVME_LOG_SMART = 0x02,
> NVME_LOG_FW_SLOT = 0x03,
> @@ -1262,6 +1263,14 @@ enum {
> NVME_FWACT_ACTV = (2 << 3),
> };
>
> +struct nvme_supported_log {
> + __le32 lids[256];
> +};
> +
> +enum {
> + NVME_LIDS_LSUPP = 1 << 0,
> +};
> +
> /* NVMe Namespace Write Protect State */
> enum {
> NVME_NS_NO_WRITE_PROTECT = 0,
Looks good. The patch description could be updated to say it's required
for NVMe 2.0 and later devices.
Reviewed-by: Matias Bjørling <matias.bjorling@wdc.com>
next prev parent reply other threads:[~2024-11-08 12:23 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-07 19:38 [PATCHv4 00/13] nvme target 2.1 and independent identify ns Keith Busch
2024-11-07 19:38 ` [PATCHv4 01/13] nvmet: implement id ns for nvm command set Keith Busch
2024-11-08 12:01 ` Matias Bjørling
2024-11-08 14:21 ` Christoph Hellwig
2024-11-07 19:38 ` [PATCHv4 02/13] nvmet: implement active command set ns list Keith Busch
2024-11-08 12:10 ` Matias Bjørling
2024-11-07 19:38 ` [PATCHv4 03/13] nvmet: implement supported log pages Keith Busch
2024-11-08 12:16 ` Matias Bjørling [this message]
2024-11-08 14:22 ` Christoph Hellwig
2024-11-11 1:57 ` Chaitanya Kulkarni
2024-11-07 19:38 ` [PATCHv4 04/13] nvmet: implement supported features log Keith Busch
2024-11-08 12:24 ` Matias Bjørling
2024-11-08 14:24 ` Christoph Hellwig
2024-11-07 19:38 ` [PATCHv4 05/13] nvmet: implement crto property Keith Busch
2024-11-08 12:34 ` Matias Bjørling
2024-11-07 19:38 ` [PATCHv4 06/13] nvmet: declare 2.1 version compliance Keith Busch
2024-11-08 12:37 ` Matias Bjørling
2024-11-07 19:38 ` [PATCHv4 07/13] nvmet: implement endurance groups Keith Busch
2024-11-08 14:26 ` Christoph Hellwig
2024-11-07 19:38 ` [PATCHv4 08/13] nvmet: implement rotational media information log Keith Busch
2024-11-07 19:38 ` [PATCHv4 09/13] nvmet: implement csi identify ns Keith Busch
2024-11-08 1:42 ` Guixin Liu
2024-11-08 14:26 ` Christoph Hellwig
2024-11-07 19:38 ` [PATCHv4 10/13] nvme: use command set independent id ns if available Keith Busch
2024-11-08 14:26 ` Christoph Hellwig
2024-11-07 19:38 ` [PATCHv4 11/13] nvme: add rotational support Keith Busch
2024-11-09 15:01 ` Guixin Liu
2024-11-07 19:38 ` [PATCHv4 12/13] nvme: check ns's volatile write cache not present Keith Busch
2024-11-07 19:38 ` [PATCHv4 13/13] nvmet: report ns's vwc " Keith Busch
2024-11-08 14:27 ` Christoph Hellwig
2024-11-08 16:15 ` Keith Busch
2024-11-09 14:59 ` Guixin Liu
2024-11-09 15:00 ` Guixin Liu
2024-11-12 22:49 ` Keith Busch
2024-11-13 1:51 ` Guixin Liu
2024-11-11 5:42 ` Christoph Hellwig
2024-11-11 5:41 ` Christoph Hellwig
2024-11-08 16:50 ` [PATCHv4 00/13] nvme target 2.1 and independent identify ns Keith Busch
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=c8fa77c7-fa5e-407d-bb15-93f56c6b4967@bjorling.me \
--to=m@bjorling.me \
--cc=hch@lst.de \
--cc=kanie@linux.alibaba.com \
--cc=kbusch@kernel.org \
--cc=kbusch@meta.com \
--cc=kch@nvidia.com \
--cc=linux-nvme@lists.infradead.org \
--cc=matias.bjorling@wdc.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox