diff options
author | Brett Creeley <brett.creeley@amd.com> | 2024-01-30 02:40:34 +0300 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2024-02-01 05:26:59 +0300 |
commit | e96094c1d11cce4deb5da3c0500d49041ab845b8 (patch) | |
tree | a2e5fff15ad3626daafa992a7d3b6f5d4c4e2a17 /drivers/net/ethernet/amd/pds_core/core.c | |
parent | 7e82a8745b951b1e794cc780d46f3fbee5e93447 (diff) | |
download | linux-e96094c1d11cce4deb5da3c0500d49041ab845b8.tar.xz |
pds_core: Clear BARs on reset
During reset the BARs might be accessed when they are
unmapped. This can cause unexpected issues, so fix it by
clearing the cached BAR values so they are not accessed
until they are re-mapped.
Also, make sure any places that can access the BARs
when they are NULL are prevented.
Fixes: 49ce92fbee0b ("pds_core: add FW update feature to devlink")
Signed-off-by: Brett Creeley <brett.creeley@amd.com>
Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Link: https://lore.kernel.org/r/20240129234035.69802-6-brett.creeley@amd.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/ethernet/amd/pds_core/core.c')
-rw-r--r-- | drivers/net/ethernet/amd/pds_core/core.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/net/ethernet/amd/pds_core/core.c b/drivers/net/ethernet/amd/pds_core/core.c index f44333bd1256..65c8a7072e35 100644 --- a/drivers/net/ethernet/amd/pds_core/core.c +++ b/drivers/net/ethernet/amd/pds_core/core.c @@ -600,7 +600,13 @@ err_out: static void pdsc_check_pci_health(struct pdsc *pdsc) { - u8 fw_status = ioread8(&pdsc->info_regs->fw_status); + u8 fw_status; + + /* some sort of teardown already in progress */ + if (!pdsc->info_regs) + return; + + fw_status = ioread8(&pdsc->info_regs->fw_status); /* is PCI broken? */ if (fw_status != PDS_RC_BAD_PCI) |