public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme: update firmware version after commit
@ 2023-10-13  6:26 Daniel Wagner
  2023-10-13 13:02 ` Niklas Cassel
  2023-10-13 14:07 ` Keith Busch
  0 siblings, 2 replies; 4+ messages in thread
From: Daniel Wagner @ 2023-10-13  6:26 UTC (permalink / raw)
  To: linux-nvme; +Cc: linux-kernel, Keith Busch, Christoph Hellwig, Daniel Wagner

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@suse.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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-10-13 14:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-13  6:26 [PATCH] nvme: update firmware version after commit Daniel Wagner
2023-10-13 13:02 ` Niklas Cassel
2023-10-13 14:13   ` Keith Busch
2023-10-13 14:07 ` Keith Busch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox