Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Niklas Cassel <Niklas.Cassel@wdc.com>
To: Daniel Wagner <dwagner@suse.de>
Cc: "linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Keith Busch <kbusch@kernel.org>, Christoph Hellwig <hch@lst.de>,
	Kenji Tomonaga <tkenbo@gmail.com>
Subject: Re: [PATCH v3] nvme: update firmware version after commit
Date: Tue, 31 Oct 2023 14:20:29 +0000	[thread overview]
Message-ID: <ZUENLHhI3wTr6c6G@x1-carbon> (raw)
In-Reply-To: <20231030160044.20355-1-dwagner@suse.de>

On Mon, Oct 30, 2023 at 05:00:44PM +0100, Daniel Wagner wrote:
> The firmware version sysfs entry needs to be updated after a successfully
> firmware activation.
> 
> nvme-cli stopped issuing an Identify Controller command to list the
> current firmware information and relies on sysfs showing the current
> firmware version.
> 
> Reported-by: Kenji Tomonaga <tkenbo@gmail.com>
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
> 
> Only compile tested. Asked for testing.
> 
> changes:
> 
> v3:
>   - use afi variable directly, no _to_cpu helper
>   - fix bit mask size
> 
> v2:
>   - use fw slot info instead issuing another identify controller command
>   - https://lore.kernel.org/linux-nvme/20231013163420.3097-1-dwagner@suse.de
> 
> v1:
>   - initial version
>   - https://lore.kernel.org/linux-nvme/20231013062623.6745-1-dwagner@suse.de/
> 
> 
>  drivers/nvme/host/core.c | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 37b6fa746662..e8511bff78d2 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -4053,8 +4053,21 @@ static void nvme_get_fw_slot_info(struct nvme_ctrl *ctrl)
>  		return;
>  
>  	if (nvme_get_log(ctrl, NVME_NSID_ALL, NVME_LOG_FW_SLOT, 0, NVME_CSI_NVM,
> -			log, sizeof(*log), 0))
> +			 log, sizeof(*log), 0)) {
>  		dev_warn(ctrl->device, "Get FW SLOT INFO log error\n");
> +		goto out_free_log;
> +	}
> +
> +	if (log->afi & 0x70) {
> +		dev_info(ctrl->device,
> +			 "Firmware is activated after next Controller Level Reset\n");
> +		goto out_free_log;
> +	}
> +
> +	memcpy(ctrl->subsys->firmware_rev, &log->frs[log->afi & 0x7],
> +		sizeof(ctrl->subsys->firmware_rev));
> +
> +out_free_log:
>  	kfree(log);
>  }
>  
> -- 
> 2.42.0
> 

Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com>

  parent reply	other threads:[~2023-10-31 14:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-30 16:00 [PATCH v3] nvme: update firmware version after commit Daniel Wagner
2023-10-31  8:53 ` Christoph Hellwig
2023-10-31 14:20 ` Niklas Cassel [this message]
2023-10-31 16:08 ` Daniel Wagner
2023-10-31 16:08 ` Keith Busch
2023-11-03 12:11   ` Daniel Wagner
2023-11-03 13:58     ` Christoph Hellwig
2023-11-03 14:22       ` Keith Busch
2023-11-06  7:00         ` Daniel Wagner
2023-11-06 16:44           ` Keith Busch
2023-11-07  8:30             ` Daniel Wagner

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=ZUENLHhI3wTr6c6G@x1-carbon \
    --to=niklas.cassel@wdc.com \
    --cc=dwagner@suse.de \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=tkenbo@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox