Skip to content

Commit 0970836

Browse files
idoschkuba-moo
authored andcommitted
mlxsw: pci: Lock configuration space of upstream bridge during reset
The driver triggers a "Secondary Bus Reset" (SBR) by calling __pci_reset_function_locked() which asserts the SBR bit in the "Bridge Control Register" in the configuration space of the upstream bridge for 2ms. This is done without locking the configuration space of the upstream bridge port, allowing user space to access it concurrently. Linux 6.11 will start warning about such unlocked resets [1][2]: pcieport 0000:00:01.0: unlocked secondary bus reset via: pci_reset_bus_function+0x51c/0x6a0 Avoid the warning and the concurrent access by locking the configuration space of the upstream bridge prior to the reset and unlocking it afterwards. [1] https://lore.kernel.org/all/171711746953.1628941.4692125082286867825.stgit@dwillia2-xfh.jf.intel.com/ [2] https://lore.kernel.org/all/20240531213150.GA610983@bhelgaas/ Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: Petr Machata <[email protected]> Reviewed-by: Przemek Kitszel <[email protected]> Link: https://patch.msgid.link/9937b0afdb50f2f2825945393c94c093c04a5897.1720447210.git.petrm@nvidia.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent a22f3bc commit 0970836

File tree

1 file changed

+6
-0
lines changed
  • drivers/net/ethernet/mellanox/mlxsw

1 file changed

+6
-0
lines changed

drivers/net/ethernet/mellanox/mlxsw/pci.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1784,6 +1784,7 @@ static int mlxsw_pci_reset_at_pci_disable(struct mlxsw_pci *mlxsw_pci,
17841784
{
17851785
struct pci_dev *pdev = mlxsw_pci->pdev;
17861786
char mrsr_pl[MLXSW_REG_MRSR_LEN];
1787+
struct pci_dev *bridge;
17871788
int err;
17881789

17891790
if (!pci_reset_sbr_supported) {
@@ -1800,6 +1801,9 @@ static int mlxsw_pci_reset_at_pci_disable(struct mlxsw_pci *mlxsw_pci,
18001801
sbr:
18011802
device_lock_assert(&pdev->dev);
18021803

1804+
bridge = pci_upstream_bridge(pdev);
1805+
if (bridge)
1806+
pci_cfg_access_lock(bridge);
18031807
pci_cfg_access_lock(pdev);
18041808
pci_save_state(pdev);
18051809

@@ -1809,6 +1813,8 @@ static int mlxsw_pci_reset_at_pci_disable(struct mlxsw_pci *mlxsw_pci,
18091813

18101814
pci_restore_state(pdev);
18111815
pci_cfg_access_unlock(pdev);
1816+
if (bridge)
1817+
pci_cfg_access_unlock(bridge);
18121818

18131819
return err;
18141820
}

0 commit comments

Comments
 (0)