• Ido Schimmel's avatar
    mlxsw: pci: Implement PCI reset handlers · 5e12d089
    Ido Schimmel authored
    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: default avatarPetr Machata <petrm@nvidia.com>
    Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
    Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
    Reviewed-by: default avatarSimon Horman <horms@kernel.org>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    5e12d089
pci.c 58.9 KB