]> www.infradead.org Git - nvme.git/commit
nvme-host: fix the updating of the firmware version
authorMaurizio Lombardi <mlombard@redhat.com>
Thu, 18 Jan 2024 11:48:54 +0000 (12:48 +0100)
committerKeith Busch <kbusch@kernel.org>
Thu, 1 Feb 2024 17:21:32 +0000 (09:21 -0800)
commitf0377ff97509f5a4921993d5d61da000361bd884
tree2cafdd6b557e83f77cd9f2eedc9d1d7f731c2ab4
parent373581643d3d6f34f16389b481b1462c8cbd37c7
nvme-host: fix the updating of the firmware version

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@redhat.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/host/core.c