Commit 4f48c303 authored by Brett Creeley's avatar Brett Creeley Committed by Jakub Kicinski

pds_core: Fix FW recovery detection

Commit 523847df ("pds_core: add devcmd device interfaces") included
initial support for FW recovery detection. Unfortunately, the ordering
in pdsc_is_fw_good() was incorrect, which was causing FW recovery to be
undetected by the driver. Fix this by making sure to update the cached
fw_status by calling pdsc_is_fw_running() before setting the local FW
gen.

Fixes: 523847df ("pds_core: add devcmd device interfaces")
Signed-off-by: default avatarShannon Nelson <shannon.nelson@amd.com>
Signed-off-by: default avatarBrett Creeley <brett.creeley@amd.com>
Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
Link: https://lore.kernel.org/r/20230605195116.49653-1-brett.creeley@amd.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 82a01ab3
...@@ -68,9 +68,15 @@ bool pdsc_is_fw_running(struct pdsc *pdsc) ...@@ -68,9 +68,15 @@ bool pdsc_is_fw_running(struct pdsc *pdsc)
bool pdsc_is_fw_good(struct pdsc *pdsc) bool pdsc_is_fw_good(struct pdsc *pdsc)
{ {
u8 gen = pdsc->fw_status & PDS_CORE_FW_STS_F_GENERATION; bool fw_running = pdsc_is_fw_running(pdsc);
u8 gen;
return pdsc_is_fw_running(pdsc) && gen == pdsc->fw_generation; /* Make sure to update the cached fw_status by calling
* pdsc_is_fw_running() before getting the generation
*/
gen = pdsc->fw_status & PDS_CORE_FW_STS_F_GENERATION;
return fw_running && gen == pdsc->fw_generation;
} }
static u8 pdsc_devcmd_status(struct pdsc *pdsc) static u8 pdsc_devcmd_status(struct pdsc *pdsc)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment