[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231013062623.6745-1-dwagner@suse.de>
Date: Fri, 13 Oct 2023 08:26:23 +0200
From: Daniel Wagner <dwagner@...e.de>
To: linux-nvme@...ts.infradead.org
Cc: linux-kernel@...r.kernel.org, Keith Busch <kbusch@...nel.org>,
Christoph Hellwig <hch@....de>, Daniel Wagner <dwagner@...e.de>
Subject: [PATCH] nvme: update firmware version after commit
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.
Signed-off-by: Daniel Wagner <dwagner@...e.de>
---
drivers/nvme/host/core.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 62612f87aafa..bb15d878e8a2 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -4079,6 +4079,20 @@ static void nvme_get_fw_slot_info(struct nvme_ctrl *ctrl)
kfree(log);
}
+static void nvme_update_firmware_rev(struct nvme_ctrl *ctrl)
+{
+ struct nvme_id_ctrl *id;
+ int ret;
+
+ ret = nvme_identify_ctrl(ctrl, &id);
+ if (ret) {
+ dev_warn(ctrl->device, "Identify Controller failed (%d)\n", ret);
+ return;
+ }
+ memcpy(ctrl->subsys->firmware_rev, id->fr,
+ sizeof(ctrl->subsys->firmware_rev));
+}
+
static void nvme_fw_act_work(struct work_struct *work)
{
struct nvme_ctrl *ctrl = container_of(work,
@@ -4109,6 +4123,7 @@ static void nvme_fw_act_work(struct work_struct *work)
nvme_unquiesce_io_queues(ctrl);
/* read FW slot information to clear the AER */
nvme_get_fw_slot_info(ctrl);
+ nvme_update_firmware_rev(ctrl);
queue_work(nvme_wq, &ctrl->async_event_work);
}
--
2.42.0
Powered by blists - more mailing lists