]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
bnxt_en: Disable bus master during PCI shutdown and driver unload.
authorMichael Chan <michael.chan@broadcom.com>
Sat, 29 Jun 2019 15:16:44 +0000 (11:16 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Jul 2019 07:12:47 +0000 (09:12 +0200)
[ Upstream commit c20dc142dd7b2884b8570eeab323bcd4a84294fa ]

Some chips with older firmware can continue to perform DMA read from
context memory even after the memory has been freed.  In the PCI shutdown
method, we need to call pci_disable_device() to shutdown DMA to prevent
this DMA before we put the device into D3hot.  DMA memory request in
D3hot state will generate PCI fatal error.  Similarly, in the driver
remove method, the context memory should only be freed after DMA has
been shutdown for correctness.

Fixes: 98f04cf0f1fc ("bnxt_en: Check context memory requirements from firmware.")
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/broadcom/bnxt/bnxt.c

index 30cafe4cdb6e9d34ecedb99b9a59add2a2ef7a8c..bf1fd513fa020507225b5fe5d4ee901b6c64ae2b 100644 (file)
@@ -10165,10 +10165,10 @@ static void bnxt_remove_one(struct pci_dev *pdev)
        bnxt_dcb_free(bp);
        kfree(bp->edev);
        bp->edev = NULL;
+       bnxt_cleanup_pci(bp);
        bnxt_free_ctx_mem(bp);
        kfree(bp->ctx);
        bp->ctx = NULL;
-       bnxt_cleanup_pci(bp);
        bnxt_free_port_stats(bp);
        free_netdev(dev);
 }
@@ -10730,6 +10730,7 @@ static void bnxt_shutdown(struct pci_dev *pdev)
 
        if (system_state == SYSTEM_POWER_OFF) {
                bnxt_clear_int_mode(bp);
+               pci_disable_device(pdev);
                pci_wake_from_d3(pdev, bp->wol);
                pci_set_power_state(pdev, PCI_D3hot);
        }