Commit 0f424eda470530a070fb0a4e9e868770022f3c86

Authored by Jakub Kicinski
Committed by Greg Kroah-Hartman
1 parent c3883876d3

mlx4: disable device on shutdown

[ Upstream commit 3cab8c65525920f00d8f4997b3e9bb73aecb3a8e ]

It appears that not disabling a PCI device on .shutdown may lead to
a Hardware Error with particular (perhaps buggy) BIOS versions:

    mlx4_en: eth0: Close port called
    mlx4_en 0000:04:00.0: removed PHC
    reboot: Restarting system
    {1}[Hardware Error]: Hardware error from APEI Generic Hardware Error Source: 1
    {1}[Hardware Error]: event severity: fatal
    {1}[Hardware Error]:  Error 0, type: fatal
    {1}[Hardware Error]:   section_type: PCIe error
    {1}[Hardware Error]:   port_type: 4, root port
    {1}[Hardware Error]:   version: 1.16
    {1}[Hardware Error]:   command: 0x4010, status: 0x0143
    {1}[Hardware Error]:   device_id: 0000:00:02.2
    {1}[Hardware Error]:   slot: 0
    {1}[Hardware Error]:   secondary_bus: 0x04
    {1}[Hardware Error]:   vendor_id: 0x8086, device_id: 0x2f06
    {1}[Hardware Error]:   class_code: 000604
    {1}[Hardware Error]:   bridge: secondary_status: 0x2000, control: 0x0003
    {1}[Hardware Error]:   aer_uncor_status: 0x00100000, aer_uncor_mask: 0x00000000
    {1}[Hardware Error]:   aer_uncor_severity: 0x00062030
    {1}[Hardware Error]:   TLP Header: 40000018 040000ff 791f4080 00000000
[hw error repeats]
    Kernel panic - not syncing: Fatal hardware error!
    CPU: 0 PID: 2189 Comm: reboot Kdump: loaded Not tainted 5.6.x-blabla #1
    Hardware name: HP ProLiant DL380 Gen9/ProLiant DL380 Gen9, BIOS P89 05/05/2017

Fix the mlx4 driver.

This is a very similar problem to what had been fixed in:
commit 0d98ba8d70b0 ("scsi: hpsa: disable device during shutdown")
to address https://bugzilla.kernel.org/show_bug.cgi?id=199779.

Fixes: 2ba5fbd62b25 ("net/mlx4_core: Handle AER flow properly")
Reported-by: Jake Lawrence <lawja@fb.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>

Showing 1 changed file with 2 additions and 0 deletions Side-by-side Diff

drivers/net/ethernet/mellanox/mlx4/main.c
... ... @@ -4354,12 +4354,14 @@
4354 4354 static void mlx4_shutdown(struct pci_dev *pdev)
4355 4355 {
4356 4356 struct mlx4_dev_persistent *persist = pci_get_drvdata(pdev);
  4357 + struct mlx4_dev *dev = persist->dev;
4357 4358  
4358 4359 mlx4_info(persist->dev, "mlx4_shutdown was called\n");
4359 4360 mutex_lock(&persist->interface_state_mutex);
4360 4361 if (persist->interface_state & MLX4_INTERFACE_STATE_UP)
4361 4362 mlx4_unload_one(pdev);
4362 4363 mutex_unlock(&persist->interface_state_mutex);
  4364 + mlx4_pci_disable_device(dev);
4363 4365 }
4364 4366  
4365 4367 static const struct pci_error_handlers mlx4_err_handler = {