aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuval Mintz <yuvalmin@broadcom.com>2014-01-15 05:05:30 -0500
committerDavid S. Miller <davem@davemloft.net>2014-01-15 19:48:34 -0500
commitd9aee591b0f06bd44cd577b757d3f267bc35fe4d (patch)
treeb4c8eeec7bbd4b0bc3d91125d81941d9f004d4a7
parenta926592f5e4e900f3fa903298c4619a131e60963 (diff)
bnx2x: Don't release PCI bars on shutdown
The bnx2x driver in its pci shutdown() callback releases its pci bars (in the same manner it does during its pci remove() callback). During a system reboot while VFs are enabled, its possible for the VF's remove to be called (as a result of pci_disable_sriov()) after its shutdown callback has already finished running; This will cause a paging request fault as the VF tries to access the pci bar which it has previously released, crashing the system. This patch further differentiates the shutdown and remove callbacks, preventing the pci release procedures from being called during shutdown. Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com> Signed-off-by: Ariel Elior <ariele@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 8b3107b2fcc1..0067b975873f 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -12942,25 +12942,26 @@ static void __bnx2x_remove(struct pci_dev *pdev,
12942 pci_set_power_state(pdev, PCI_D3hot); 12942 pci_set_power_state(pdev, PCI_D3hot);
12943 } 12943 }
12944 12944
12945 if (bp->regview) 12945 if (remove_netdev) {
12946 iounmap(bp->regview); 12946 if (bp->regview)
12947 iounmap(bp->regview);
12947 12948
12948 /* for vf doorbells are part of the regview and were unmapped along with 12949 /* For vfs, doorbells are part of the regview and were unmapped
12949 * it. FW is only loaded by PF. 12950 * along with it. FW is only loaded by PF.
12950 */ 12951 */
12951 if (IS_PF(bp)) { 12952 if (IS_PF(bp)) {
12952 if (bp->doorbells) 12953 if (bp->doorbells)
12953 iounmap(bp->doorbells); 12954 iounmap(bp->doorbells);
12954 12955
12955 bnx2x_release_firmware(bp); 12956 bnx2x_release_firmware(bp);
12956 } 12957 }
12957 bnx2x_free_mem_bp(bp); 12958 bnx2x_free_mem_bp(bp);
12958 12959
12959 if (remove_netdev)
12960 free_netdev(dev); 12960 free_netdev(dev);
12961 12961
12962 if (atomic_read(&pdev->enable_cnt) == 1) 12962 if (atomic_read(&pdev->enable_cnt) == 1)
12963 pci_release_regions(pdev); 12963 pci_release_regions(pdev);
12964 }
12964 12965
12965 pci_disable_device(pdev); 12966 pci_disable_device(pdev);
12966} 12967}