* Re: [PATCH] PCI: dw-rockchip: Clear stale link down interrupt before unmasking it
2026-11-23 12:12 [PATCH] PCI: dw-rockchip: Clear stale link down interrupt before unmasking it Niklas Cassel
@ 2026-11-23 15:42 ` Shawn Lin
2026-11-23 20:55 ` Wilfred Mallawa
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Shawn Lin @ 2026-11-23 15:42 UTC (permalink / raw)
To: Niklas Cassel, Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, Heiko Stuebner,
Wilfred Mallawa
Cc: shawn.lin, Sebastian Reichel, James Le Cuirot, stable,
Manivannan Sadhasivam, linux-pci, linux-arm-kernel,
linux-rockchip
在 2026/11/23 星期一 20:12, Niklas Cassel 写道:
> PCIE_LINK_REQ_RST_NOT_INT is set by smlh_req_rst_not, which according to
> the RK3568 TRM "is asserted after power-on reset until first link up".
> The bit is thus already pending when the driver unmasks the interrupt
> after resetting the controller, both in probe and in .reset_root_port(),
> so the interrupt fires as soon as it is unmasked, even though the link
> is up. Since each recovery resets the controller again, this results in
> an endless loop, as seen on a Quartz64 Model B (RK3566):
>
> pcieport 0000:00:00.0: Recovering Root Port due to Link Down
> pcieport 0000:00:00.0: Root Port has been reset
> pcieport 0000:00:00.0: AER: device recovery successful
> pcieport 0000:00:00.0: Recovering Root Port due to Link Down
>
> Clear the bit before unmasking the interrupt, and in .reset_root_port()
> only unmask it once the link is back up, like in probe. Also keep the
> interrupt masked while .reset_root_port() resets the controller, so the
> link down caused by the reset itself is not reported.
>
This looks right to me ,
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
> Fixes: b376b3ff9cb0 ("PCI: dw-rockchip: Implement .reset_root_port() and use for link down")
> Reported-by: James Le Cuirot <chewi@gentoo.org>
> Closes: https://lore.kernel.org/linux-pci/08cc96c5171fc969b074371692e6d95d46eba60b.camel@gentoo.org/
> Cc: stable@vger.kernel.org
> Signed-off-by: Niklas Cassel <cassel@kernel.org>
> ---
> drivers/pci/controller/dwc/pcie-dw-rockchip.c | 24 +++++++++++++------
> 1 file changed, 17 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-dw-rockchip.c b/drivers/pci/controller/dwc/pcie-dw-rockchip.c
> index ab2e26699409..2ef7ae97eb10 100644
> --- a/drivers/pci/controller/dwc/pcie-dw-rockchip.c
> +++ b/drivers/pci/controller/dwc/pcie-dw-rockchip.c
> @@ -686,6 +686,18 @@ static irqreturn_t rockchip_pcie_ep_sys_irq_thread(int irq, void *arg)
> return IRQ_HANDLED;
> }
>
> +static void rockchip_pcie_rc_unmask_link_down(struct rockchip_pcie *rockchip)
> +{
> + u32 val;
> +
> + rockchip_pcie_writel_apb(rockchip, PCIE_LINK_REQ_RST_NOT_INT,
> + PCIE_CLIENT_INTR_STATUS_MISC);
> +
> + /* unmask hot reset/link-down reset */
> + val = FIELD_PREP_WM16(PCIE_LINK_REQ_RST_NOT_INT, 0);
> + rockchip_pcie_writel_apb(rockchip, val, PCIE_CLIENT_INTR_MASK_MISC);
> +}
> +
> static int rockchip_pcie_configure_rc(struct platform_device *pdev,
> struct rockchip_pcie *rockchip)
> {
> @@ -739,9 +751,7 @@ static int rockchip_pcie_configure_rc(struct platform_device *pdev,
> return ret;
> }
>
> - /* unmask hot reset/link-down reset */
> - val = FIELD_PREP_WM16(PCIE_LINK_REQ_RST_NOT_INT, 0);
> - rockchip_pcie_writel_apb(rockchip, val, PCIE_CLIENT_INTR_MASK_MISC);
> + rockchip_pcie_rc_unmask_link_down(rockchip);
>
> return ret;
> }
> @@ -898,6 +908,9 @@ static int rockchip_pcie_rc_reset_root_port(struct pci_host_bridge *bridge,
> u32 val;
> int ret;
>
> + val = FIELD_PREP_WM16(PCIE_LINK_REQ_RST_NOT_INT, 1);
> + rockchip_pcie_writel_apb(rockchip, val, PCIE_CLIENT_INTR_MASK_MISC);
> +
> dw_pcie_stop_link(pci);
> clk_bulk_disable_unprepare(rockchip->clk_cnt, rockchip->clks);
> rockchip_pcie_phy_deinit(rockchip);
> @@ -938,16 +951,13 @@ static int rockchip_pcie_rc_reset_root_port(struct pci_host_bridge *bridge,
> goto deinit_clk;
> }
>
> - /* unmask hot reset/link-down reset */
> - val = FIELD_PREP_WM16(PCIE_LINK_REQ_RST_NOT_INT, 0);
> - rockchip_pcie_writel_apb(rockchip, val, PCIE_CLIENT_INTR_MASK_MISC);
> -
> ret = dw_pcie_start_link(pci);
> if (ret)
> goto deinit_clk;
>
> /* Ignore errors, the link may come up later */
> dw_pcie_wait_for_link(pci);
> + rockchip_pcie_rc_unmask_link_down(rockchip);
> dev_dbg(dev, "Root Port reset completed\n");
> return ret;
>
>
> base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] PCI: dw-rockchip: Clear stale link down interrupt before unmasking it
2026-11-23 12:12 [PATCH] PCI: dw-rockchip: Clear stale link down interrupt before unmasking it Niklas Cassel
2026-11-23 15:42 ` Shawn Lin
@ 2026-11-23 20:55 ` Wilfred Mallawa
2026-11-24 23:25 ` James Le Cuirot
2026-12-03 13:06 ` Niklas Cassel
3 siblings, 0 replies; 5+ messages in thread
From: Wilfred Mallawa @ 2026-11-23 20:55 UTC (permalink / raw)
To: robh@kernel.org, kwilczynski@kernel.org, mani@kernel.org,
cassel@kernel.org, bhelgaas@google.com, lpieralisi@kernel.org,
heiko@sntech.de
Cc: sebastian.reichel@collabora.com, chewi@gentoo.org,
linux-arm-kernel@lists.infradead.org, shawn.lin@rock-chips.com,
stable@vger.kernel.org, manivannan.sadhasivam@oss.qualcomm.com,
linux-pci@vger.kernel.org, linux-rockchip@lists.infradead.org
On Mon, 2026-11-23 at 13:12 +0100, Niklas Cassel wrote:
> PCIE_LINK_REQ_RST_NOT_INT is set by smlh_req_rst_not, which according
> to
> the RK3568 TRM "is asserted after power-on reset until first link
> up".
> The bit is thus already pending when the driver unmasks the interrupt
> after resetting the controller, both in probe and in
> .reset_root_port(),
> so the interrupt fires as soon as it is unmasked, even though the
> link
> is up. Since each recovery resets the controller again, this results
> in
> an endless loop, as seen on a Quartz64 Model B (RK3566):
>
> pcieport 0000:00:00.0: Recovering Root Port due to Link Down
> pcieport 0000:00:00.0: Root Port has been reset
> pcieport 0000:00:00.0: AER: device recovery successful
> pcieport 0000:00:00.0: Recovering Root Port due to Link Down
>
> Clear the bit before unmasking the interrupt, and in
> .reset_root_port()
> only unmask it once the link is back up, like in probe. Also keep the
> interrupt masked while .reset_root_port() resets the controller, so
> the
> link down caused by the reset itself is not reported.
>
> Fixes: b376b3ff9cb0 ("PCI: dw-rockchip: Implement .reset_root_port()
> and use for link down")
> Reported-by: James Le Cuirot <chewi@gentoo.org>
> Closes:
> https://lore.kernel.org/linux-pci/08cc96c5171fc969b074371692e6d95d46eba60b.camel@gentoo.org/
> Cc: stable@vger.kernel.org
> Signed-off-by: Niklas Cassel <cassel@kernel.org>
> ---
>
Looks good, thanks!
Reviewed-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] PCI: dw-rockchip: Clear stale link down interrupt before unmasking it
2026-11-23 12:12 [PATCH] PCI: dw-rockchip: Clear stale link down interrupt before unmasking it Niklas Cassel
2026-11-23 15:42 ` Shawn Lin
2026-11-23 20:55 ` Wilfred Mallawa
@ 2026-11-24 23:25 ` James Le Cuirot
2026-12-03 13:06 ` Niklas Cassel
3 siblings, 0 replies; 5+ messages in thread
From: James Le Cuirot @ 2026-11-24 23:25 UTC (permalink / raw)
To: Niklas Cassel, Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, Heiko Stuebner,
Wilfred Mallawa
Cc: Sebastian Reichel, Shawn Lin, stable, Manivannan Sadhasivam,
linux-pci, linux-arm-kernel, linux-rockchip
[-- Attachment #1.1: Type: text/plain, Size: 1557 bytes --]
On Mon, 2026-11-23 at 13:12 +0100, Niklas Cassel wrote:
> PCIE_LINK_REQ_RST_NOT_INT is set by smlh_req_rst_not, which according to
> the RK3568 TRM "is asserted after power-on reset until first link up".
> The bit is thus already pending when the driver unmasks the interrupt
> after resetting the controller, both in probe and in .reset_root_port(),
> so the interrupt fires as soon as it is unmasked, even though the link
> is up. Since each recovery resets the controller again, this results in
> an endless loop, as seen on a Quartz64 Model B (RK3566):
>
> pcieport 0000:00:00.0: Recovering Root Port due to Link Down
> pcieport 0000:00:00.0: Root Port has been reset
> pcieport 0000:00:00.0: AER: device recovery successful
> pcieport 0000:00:00.0: Recovering Root Port due to Link Down
>
> Clear the bit before unmasking the interrupt, and in .reset_root_port()
> only unmask it once the link is back up, like in probe. Also keep the
> interrupt masked while .reset_root_port() resets the controller, so the
> link down caused by the reset itself is not reported.
>
> Fixes: b376b3ff9cb0 ("PCI: dw-rockchip: Implement .reset_root_port() and use for link down")
> Reported-by: James Le Cuirot <chewi@gentoo.org>
> Closes: https://lore.kernel.org/linux-pci/08cc96c5171fc969b074371692e6d95d46eba60b.camel@gentoo.org/
> Cc: stable@vger.kernel.org
> Signed-off-by: Niklas Cassel <cassel@kernel.org>
I can confirm that this fixes the issue I reported. Thank you. :)
Tested-by: James Le Cuirot <chewi@gentoo.org>
[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 423 bytes --]
[-- Attachment #2: Type: text/plain, Size: 170 bytes --]
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] PCI: dw-rockchip: Clear stale link down interrupt before unmasking it
2026-11-23 12:12 [PATCH] PCI: dw-rockchip: Clear stale link down interrupt before unmasking it Niklas Cassel
` (2 preceding siblings ...)
2026-11-24 23:25 ` James Le Cuirot
@ 2026-12-03 13:06 ` Niklas Cassel
3 siblings, 0 replies; 5+ messages in thread
From: Niklas Cassel @ 2026-12-03 13:06 UTC (permalink / raw)
To: Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, Heiko Stuebner,
Wilfred Mallawa
Cc: Sebastian Reichel, Shawn Lin, James Le Cuirot, stable,
Manivannan Sadhasivam, linux-pci, linux-arm-kernel,
linux-rockchip
On Mon, Nov 23, 2026 at 01:12:17PM +0100, Niklas Cassel wrote:
> PCIE_LINK_REQ_RST_NOT_INT is set by smlh_req_rst_not, which according to
> the RK3568 TRM "is asserted after power-on reset until first link up".
> The bit is thus already pending when the driver unmasks the interrupt
> after resetting the controller, both in probe and in .reset_root_port(),
> so the interrupt fires as soon as it is unmasked, even though the link
> is up. Since each recovery resets the controller again, this results in
> an endless loop, as seen on a Quartz64 Model B (RK3566):
>
> pcieport 0000:00:00.0: Recovering Root Port due to Link Down
> pcieport 0000:00:00.0: Root Port has been reset
> pcieport 0000:00:00.0: AER: device recovery successful
> pcieport 0000:00:00.0: Recovering Root Port due to Link Down
>
> Clear the bit before unmasking the interrupt, and in .reset_root_port()
> only unmask it once the link is back up, like in probe. Also keep the
> interrupt masked while .reset_root_port() resets the controller, so the
> link down caused by the reset itself is not reported.
>
> Fixes: b376b3ff9cb0 ("PCI: dw-rockchip: Implement .reset_root_port() and use for link down")
> Reported-by: James Le Cuirot <chewi@gentoo.org>
> Closes: https://lore.kernel.org/linux-pci/08cc96c5171fc969b074371692e6d95d46eba60b.camel@gentoo.org/
> Cc: stable@vger.kernel.org
> Signed-off-by: Niklas Cassel <cassel@kernel.org>
(snip)
> base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
Ping on this patch, since it is a recent regression, it is targeting the
current release 7.4 and is based on v7.4-rc4.
Looking at the changes in pci/for-next, I think there might be conflicts
if you try to queue it for the next release instead of the current release.
Kind regards,
Niklas
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 5+ messages in thread