Skip to content

Commit 0a8f173

Browse files
Marek VasutMani-Sadhasivam
authored andcommitted
PCI: rcar-host: Drop PMSR spinlock
The pmsr_lock spinlock used to be necessary to synchronize access to the PMSR register, because that access could have been triggered from either config space access in rcar_pcie_config_access() or an exception handler rcar_pcie_aarch32_abort_handler(). The rcar_pcie_aarch32_abort_handler() case is no longer applicable since commit 6e36203 ("PCI: rcar: Use PCI_SET_ERROR_RESPONSE after read which triggered an exception"), which performs more accurate, controlled invocation of the exception, and a fixup. This leaves rcar_pcie_config_access() as the only call site from which rcar_pcie_wakeup() is called. The rcar_pcie_config_access() can only be called from the controller struct pci_ops .read and .write callbacks, and those are serialized in drivers/pci/access.c using raw spinlock 'pci_lock' . It should be noted that CONFIG_PCI_LOCKLESS_CONFIG is never set on this platform. Since the 'pci_lock' is a raw spinlock , and the 'pmsr_lock' is not a raw spinlock, this constellation triggers 'BUG: Invalid wait context' with CONFIG_PROVE_RAW_LOCK_NESTING=y . Remove the pmsr_lock to fix the locking. Fixes: a115b1b ("PCI: rcar: Add L1 link state fix into data abort hook") Reported-by: Duy Nguyen <[email protected]> Reported-by: Thuan Nguyen <[email protected]> Signed-off-by: Marek Vasut <[email protected]> Signed-off-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Cc: [email protected] Link: https://patch.msgid.link/[email protected]
1 parent d3fee10 commit 0a8f173

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

drivers/pci/controller/pcie-rcar-host.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,13 @@ struct rcar_pcie_host {
5252
int (*phy_init_fn)(struct rcar_pcie_host *host);
5353
};
5454

55-
static DEFINE_SPINLOCK(pmsr_lock);
56-
5755
static int rcar_pcie_wakeup(struct device *pcie_dev, void __iomem *pcie_base)
5856
{
59-
unsigned long flags;
6057
u32 pmsr, val;
6158
int ret = 0;
6259

63-
spin_lock_irqsave(&pmsr_lock, flags);
64-
65-
if (!pcie_base || pm_runtime_suspended(pcie_dev)) {
66-
ret = -EINVAL;
67-
goto unlock_exit;
68-
}
60+
if (!pcie_base || pm_runtime_suspended(pcie_dev))
61+
return -EINVAL;
6962

7063
pmsr = readl(pcie_base + PMSR);
7164

@@ -87,8 +80,6 @@ static int rcar_pcie_wakeup(struct device *pcie_dev, void __iomem *pcie_base)
8780
writel(L1FAEG | PMEL1RX, pcie_base + PMSR);
8881
}
8982

90-
unlock_exit:
91-
spin_unlock_irqrestore(&pmsr_lock, flags);
9283
return ret;
9384
}
9485

0 commit comments

Comments
 (0)