]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
bnxt_en: Disable/enable Bus master during suspend/resume.
authorMichael Chan <michael.chan@broadcom.com>
Sun, 24 Nov 2019 03:30:39 +0000 (22:30 -0500)
committerJakub Kicinski <jakub.kicinski@netronome.com>
Sun, 24 Nov 2019 22:48:02 +0000 (14:48 -0800)
Disable Bus master during suspend to prevent DMAs after the device
goes into D3hot state.  The new 57500 devices may continue to DMA
from context memory after the system goes into D3hot state.  This
may cause some PCIe errors on some system.  Re-enable it during resume.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
drivers/net/ethernet/broadcom/bnxt/bnxt.c

index 35bc579d594acdb687f1159347279095aa1a4001..14b6104513310943586a177af9358fb62f9f2e24 100644 (file)
@@ -11921,6 +11921,7 @@ static int bnxt_suspend(struct device *device)
                rc = bnxt_close(dev);
        }
        bnxt_hwrm_func_drv_unrgtr(bp);
+       pci_disable_device(bp->pdev);
        rtnl_unlock();
        return rc;
 }
@@ -11932,6 +11933,13 @@ static int bnxt_resume(struct device *device)
        int rc = 0;
 
        rtnl_lock();
+       rc = pci_enable_device(bp->pdev);
+       if (rc) {
+               netdev_err(dev, "Cannot re-enable PCI device during resume, err = %d\n",
+                          rc);
+               goto resume_exit;
+       }
+       pci_set_master(bp->pdev);
        if (bnxt_hwrm_ver_get(bp) || bnxt_hwrm_func_drv_rgtr(bp)) {
                rc = -ENODEV;
                goto resume_exit;