Patch "nvme-host: fix the updating of the firmware version" has been added to the 6.7-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    nvme-host: fix the updating of the firmware version

to the 6.7-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     nvme-host-fix-the-updating-of-the-firmware-version.patch
and it can be found in the queue-6.7 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit e30cad94fa40c07bb3d7c92e6e2cab612291fa44
Author: Maurizio Lombardi <mlombard@xxxxxxxxxx>
Date:   Thu Jan 18 12:48:54 2024 +0100

    nvme-host: fix the updating of the firmware version
    
    [ Upstream commit f0377ff97509f5a4921993d5d61da000361bd884 ]
    
    The original code didn't update the firmware version if the
    "next slot" of the AFI register isn't zero or if the
    "current slot" field is zero; in those cases it assumed
    that a reset was needed.
    
    However, the NVMe specification doesn't exclude the possibility that
    the "next slot" value is equal to the "current slot" value,
    meaning that the same firmware slot will be activated after performing
    a controller level reset; in this case a reset is clearly not
    necessary and we can safely update the firmware version.
    
    Modify the code so the kernel will report that a Controller Level Reset
    is needed only in the following cases:
    
    1) If the "current slot" field is zero. This is invalid and means that
       something is wrong, a reset is needed.
    
    or
    
    2) if the "next slot" field isn't zero AND it's not equal to the
       "current slot" value. This means that at the next reset a different
       firmware slot will be activated.
    
    Fixes: 983a338b96c8 ("nvme: update firmware version after commit")
    Signed-off-by: Maurizio Lombardi <mlombard@xxxxxxxxxx>
    Reviewed-by: Daniel Wagner <dwagner@xxxxxxx>
    Signed-off-by: Keith Busch <kbusch@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 60f14019f981..86149275ccb8 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -4107,6 +4107,7 @@ static bool nvme_ctrl_pp_status(struct nvme_ctrl *ctrl)
 static void nvme_get_fw_slot_info(struct nvme_ctrl *ctrl)
 {
 	struct nvme_fw_slot_info_log *log;
+	u8 next_fw_slot, cur_fw_slot;
 
 	log = kmalloc(sizeof(*log), GFP_KERNEL);
 	if (!log)
@@ -4118,13 +4119,15 @@ static void nvme_get_fw_slot_info(struct nvme_ctrl *ctrl)
 		goto out_free_log;
 	}
 
-	if (log->afi & 0x70 || !(log->afi & 0x7)) {
+	cur_fw_slot = log->afi & 0x7;
+	next_fw_slot = (log->afi & 0x70) >> 4;
+	if (!cur_fw_slot || (next_fw_slot && (cur_fw_slot != next_fw_slot))) {
 		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) - 1],
+	memcpy(ctrl->subsys->firmware_rev, &log->frs[cur_fw_slot - 1],
 		sizeof(ctrl->subsys->firmware_rev));
 
 out_free_log:




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux