linux/drivers/nvme/host
Maurizio Lombardi dc1fc14047 nvme-host: fix the updating of the firmware version
[ Upstream commit f0377ff975 ]

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: 983a338b96 ("nvme: update firmware version after commit")
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2024-02-16 19:14:27 +01:00
..
apple.c nvme-apple: return directly instead of else 2023-04-13 08:55:06 +02:00
auth.c nvme-auth: set explanation code for failure2 msgs 2023-11-20 09:25:23 -08:00
constants.c nvme fixes for Linux 6.5 2023-06-30 14:04:08 -06:00
core.c nvme-host: fix the updating of the firmware version 2024-02-16 19:14:27 +01:00
fabrics.c nvme: blank out authentication fabrics options if not configured 2023-11-20 09:25:32 -08:00
fabrics.h nvme-fabrics: parse options 'keyring' and 'tls_key' 2023-10-11 10:29:58 -07:00
fault_inject.c nvme: fix parameter check in nvme_fault_inject_init() 2023-07-12 08:48:33 -07:00
fc.c Revert "nvme-fc: fix race between error recovery and creating association" 2023-12-19 08:58:46 -08:00
fc.h nvme-fc: Update header and host for common definitions for LS handling 2020-05-09 16:18:33 -06:00
hwmon.c nvme: host: hwmon: constify pointers to hwmon_channel_info 2023-08-21 12:54:02 -07:00
ioctl.c nvme-ioctl: move capable() admin check to the end 2023-12-04 08:39:03 -08:00
Kconfig nvme: improve NVME_HOST_AUTH and NVME_TARGET_AUTH config descriptions 2023-12-04 08:39:03 -08:00
Makefile nvme: rework NVME_AUTH Kconfig selection 2023-10-12 08:04:49 -07:00
multipath.c nvme fixes for Linux 6.5 2023-06-30 14:04:08 -06:00
nvme.h nvme-pci: Add sleep quirk for Kingston drives 2023-12-07 08:53:20 -08:00
pci.c nvme-pci: Add sleep quirk for Kingston drives 2023-12-07 08:53:20 -08:00
pr.c nvme: Add pr_ops read_reservation support 2023-04-11 21:55:36 -04:00
rdma.c nvme: ensure reset state check ordering 2023-12-04 08:39:03 -08:00
sysfs.c nvme: rework NVME_AUTH Kconfig selection 2023-10-12 08:04:49 -07:00
tcp.c nvme: ensure reset state check ordering 2023-12-04 08:39:03 -08:00
trace.c nvme: implement In-Band authentication 2022-08-02 17:14:49 -06:00
trace.h nvme: fix async event trace event 2023-04-13 08:59:04 +02:00
zns.c scsi: nvme: zns: Set zone limits before revalidating zones 2023-07-05 21:58:10 -04:00