* [PATCH] PCI: starfive: Fix Runtime PM handling and teardown ordering
@ 2026-07-13 14:50 Ali Tariq
2026-07-18 13:38 ` [PATCH v2] " Ali Tariq
0 siblings, 1 reply; 4+ messages in thread
From: Ali Tariq @ 2026-07-13 14:50 UTC (permalink / raw)
To: Kevin Xie
Cc: Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, linux-pci,
linux-kernel, Ali Tariq
The starfive_pcie_remove() path incorrectly disabled runtime PM
before executing plda_pcie_host_deinit(),
which can cause unmanaged hardware register access
while power domains or clocks are disabled.
Fix this by restructuring starfive_pcie_remove() to deinitialize
the host hardware first while runtime PM is active,
followed by a synchronous pm_runtime_put_sync() and pm_runtime_disable().
Signed-off-by: Ali Tariq <alitariq45892@gmail.com>
---
drivers/pci/controller/plda/pcie-starfive.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/controller/plda/pcie-starfive.c b/drivers/pci/controller/plda/pcie-starfive.c
index e9a472985b8a..ba8ef7842e35 100644
--- a/drivers/pci/controller/plda/pcie-starfive.c
+++ b/drivers/pci/controller/plda/pcie-starfive.c
@@ -440,9 +440,9 @@ static void starfive_pcie_remove(struct platform_device *pdev)
{
struct starfive_jh7110_pcie *pcie = platform_get_drvdata(pdev);
- pm_runtime_put(&pdev->dev);
- pm_runtime_disable(&pdev->dev);
plda_pcie_host_deinit(&pcie->plda);
+ pm_runtime_put_sync(&pdev->dev);
+ pm_runtime_disable(&pdev->dev);
platform_set_drvdata(pdev, NULL);
}
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] PCI: starfive: Fix Runtime PM handling and teardown ordering
2026-07-13 14:50 [PATCH] PCI: starfive: Fix Runtime PM handling and teardown ordering Ali Tariq
@ 2026-07-18 13:38 ` Ali Tariq
2026-07-29 15:47 ` Ali Tariq
2026-07-29 16:42 ` Manivannan Sadhasivam
0 siblings, 2 replies; 4+ messages in thread
From: Ali Tariq @ 2026-07-18 13:38 UTC (permalink / raw)
To: Kevin Xie
Cc: Ali Tariq, Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, Minda Chen,
Mason Huo, open list:PCIE DRIVER FOR STARFIVE JH71x0, open list
The starfive_pcie_remove() path incorrectly disabled runtime PM
before executing plda_pcie_host_deinit(),
which can cause unmanaged hardware register access
while power domains or clocks are disabled.
Fix this by restructuring starfive_pcie_remove() to deinitialize
the host hardware first while runtime PM is active,
followed by a synchronous pm_runtime_put_sync() and pm_runtime_disable().
This bug was found in automated AI review by sashiko-bot.
Fixes: 39b91eb40c6a ("PCI: starfive: Add JH7110 PCIe controller")
Link: https://lore.kernel.org/linux-pci/20260712180440.423421F000E9@smtp.kernel.org/
Signed-off-by: Ali Tariq <alitariq45892@gmail.com>
---
Changes in v2:
- Added Fixes tag to commit message
- Added reference link to the bug found by sashiko-bot
---
drivers/pci/controller/plda/pcie-starfive.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/controller/plda/pcie-starfive.c b/drivers/pci/controller/plda/pcie-starfive.c
index e9a472985b8a..ba8ef7842e35 100644
--- a/drivers/pci/controller/plda/pcie-starfive.c
+++ b/drivers/pci/controller/plda/pcie-starfive.c
@@ -440,9 +440,9 @@ static void starfive_pcie_remove(struct platform_device *pdev)
{
struct starfive_jh7110_pcie *pcie = platform_get_drvdata(pdev);
- pm_runtime_put(&pdev->dev);
- pm_runtime_disable(&pdev->dev);
plda_pcie_host_deinit(&pcie->plda);
+ pm_runtime_put_sync(&pdev->dev);
+ pm_runtime_disable(&pdev->dev);
platform_set_drvdata(pdev, NULL);
}
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] PCI: starfive: Fix Runtime PM handling and teardown ordering
2026-07-18 13:38 ` [PATCH v2] " Ali Tariq
@ 2026-07-29 15:47 ` Ali Tariq
2026-07-29 16:42 ` Manivannan Sadhasivam
1 sibling, 0 replies; 4+ messages in thread
From: Ali Tariq @ 2026-07-29 15:47 UTC (permalink / raw)
To: Kevin Xie
Cc: Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, Minda Chen,
Mason Huo, open list:PCIE DRIVER FOR STARFIVE JH71x0, open list
Politely pinging.
Did anyone get a chance to review this patch?
I am happy to send changes if required.
Regards,
Ali
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] PCI: starfive: Fix Runtime PM handling and teardown ordering
2026-07-18 13:38 ` [PATCH v2] " Ali Tariq
2026-07-29 15:47 ` Ali Tariq
@ 2026-07-29 16:42 ` Manivannan Sadhasivam
1 sibling, 0 replies; 4+ messages in thread
From: Manivannan Sadhasivam @ 2026-07-29 16:42 UTC (permalink / raw)
To: Kevin Xie, Ali Tariq
Cc: Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, Minda Chen,
Mason Huo, linux-pci, linux-kernel
On Sat, 18 Jul 2026 18:38:25 +0500, Ali Tariq wrote:
> The starfive_pcie_remove() path incorrectly disabled runtime PM
> before executing plda_pcie_host_deinit(),
> which can cause unmanaged hardware register access
> while power domains or clocks are disabled.
>
> Fix this by restructuring starfive_pcie_remove() to deinitialize
> the host hardware first while runtime PM is active,
> followed by a synchronous pm_runtime_put_sync() and pm_runtime_disable().
>
> [...]
Applied, thanks!
[1/1] PCI: starfive: Fix Runtime PM handling and teardown ordering
commit: fb9f7973473fc30d62e0f5f90d59df8ef5223777
Best regards,
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-07-29 16:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-13 14:50 [PATCH] PCI: starfive: Fix Runtime PM handling and teardown ordering Ali Tariq
2026-07-18 13:38 ` [PATCH v2] " Ali Tariq
2026-07-29 15:47 ` Ali Tariq
2026-07-29 16:42 ` Manivannan Sadhasivam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®