]> git.itanic.dy.fi Git - linux-stable/commit
mlxsw: pci: Implement PCI reset handlers
authorIdo Schimmel <idosch@nvidia.com>
Wed, 15 Nov 2023 12:17:22 +0000 (13:17 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 18 Nov 2023 17:38:51 +0000 (17:38 +0000)
commit5e12d0898583026581e4f0506ff7c0b15a73a1c5
tree4f079e23d101ef232b2a76743837cce7818e5aa1
parentf257c73e53561f6c223c4bce883138e9f18b5f50
mlxsw: pci: Implement PCI reset handlers

Implement reset_prepare() and reset_done() handlers that are invoked by
the PCI core before and after issuing a PCI reset, respectively.

Specifically, implement reset_prepare() by calling
mlxsw_core_bus_device_unregister() and reset_done() by calling
mlxsw_core_bus_device_register(). This is the same implementation as the
reload_{down,up}() devlink operations with the following differences:

1. The devlink instance is unregistered and then registered again after
   the reset.

2. A reset via the device's command interface (using MRSR register) is
   not issued during reset_done() as PCI core already issued a PCI
   reset.

Tested:

 # for i in $(seq 1 10); do echo 1 > /sys/bus/pci/devices/0000\:01\:00.0/reset; done

Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/pci.c