Commit c20dc142 authored by Michael Chan's avatar Michael Chan Committed by David S. Miller

bnxt_en: Disable bus master during PCI shutdown and driver unload.

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: 98f04cf0 ("bnxt_en: Check context memory requirements from firmware.")
Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7b75e49d
...@@ -10262,10 +10262,10 @@ static void bnxt_remove_one(struct pci_dev *pdev) ...@@ -10262,10 +10262,10 @@ static void bnxt_remove_one(struct pci_dev *pdev)
bnxt_dcb_free(bp); bnxt_dcb_free(bp);
kfree(bp->edev); kfree(bp->edev);
bp->edev = NULL; bp->edev = NULL;
bnxt_cleanup_pci(bp);
bnxt_free_ctx_mem(bp); bnxt_free_ctx_mem(bp);
kfree(bp->ctx); kfree(bp->ctx);
bp->ctx = NULL; bp->ctx = NULL;
bnxt_cleanup_pci(bp);
bnxt_free_port_stats(bp); bnxt_free_port_stats(bp);
free_netdev(dev); free_netdev(dev);
} }
...@@ -10859,6 +10859,7 @@ static void bnxt_shutdown(struct pci_dev *pdev) ...@@ -10859,6 +10859,7 @@ static void bnxt_shutdown(struct pci_dev *pdev)
if (system_state == SYSTEM_POWER_OFF) { if (system_state == SYSTEM_POWER_OFF) {
bnxt_clear_int_mode(bp); bnxt_clear_int_mode(bp);
pci_disable_device(pdev);
pci_wake_from_d3(pdev, bp->wol); pci_wake_from_d3(pdev, bp->wol);
pci_set_power_state(pdev, PCI_D3hot); pci_set_power_state(pdev, PCI_D3hot);
} }
......
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