Skip to content

Commit 8f79f82

Browse files
Marek Vasutgregkh
authored andcommitted
PCI: rcar-host: Drop PMSR spinlock
commit 0a8f173 upstream. 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 <duy.nguyen.rh@renesas.com> Reported-by: Thuan Nguyen <thuan.nguyen-hong@banvien.com.vn> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Signed-off-by: Manivannan Sadhasivam <mani@kernel.org> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20250909162707.13927-1-marek.vasut+renesas@mailbox.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 551108b commit 8f79f82

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
@@ -51,20 +51,13 @@ struct rcar_pcie_host {
5151
int (*phy_init_fn)(struct rcar_pcie_host *host);
5252
};
5353

54-
static DEFINE_SPINLOCK(pmsr_lock);
55-
5654
static int rcar_pcie_wakeup(struct device *pcie_dev, void __iomem *pcie_base)
5755
{
58-
unsigned long flags;
5956
u32 pmsr, val;
6057
int ret = 0;
6158

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

6962
pmsr = readl(pcie_base + PMSR);
7063

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

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

0 commit comments

Comments
 (0)