Skip to content

Commit 983a338

Browse files
igawkeithbusch
authored andcommitted
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. Reported-by: Kenji Tomonaga <[email protected]> Signed-off-by: Daniel Wagner <[email protected]> Tested-by: Kenji Tomonaga <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Niklas Cassel <[email protected]> [fixed off-by one afi index] Signed-off-by: Keith Busch <[email protected]>
1 parent 0e32fdd commit 983a338

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

drivers/nvme/host/core.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4074,8 +4074,21 @@ static void nvme_get_fw_slot_info(struct nvme_ctrl *ctrl)
40744074
return;
40754075

40764076
if (nvme_get_log(ctrl, NVME_NSID_ALL, NVME_LOG_FW_SLOT, 0, NVME_CSI_NVM,
4077-
log, sizeof(*log), 0))
4077+
log, sizeof(*log), 0)) {
40784078
dev_warn(ctrl->device, "Get FW SLOT INFO log error\n");
4079+
goto out_free_log;
4080+
}
4081+
4082+
if (log->afi & 0x70 || !(log->afi & 0x7)) {
4083+
dev_info(ctrl->device,
4084+
"Firmware is activated after next Controller Level Reset\n");
4085+
goto out_free_log;
4086+
}
4087+
4088+
memcpy(ctrl->subsys->firmware_rev, &log->frs[(log->afi & 0x7) - 1],
4089+
sizeof(ctrl->subsys->firmware_rev));
4090+
4091+
out_free_log:
40794092
kfree(log);
40804093
}
40814094

0 commit comments

Comments
 (0)