From: sashiko-bot@kernel.org
To: "Sebastian Reichel" <sebastian.reichel@collabora.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v6 09/10] PCI: dw-rockchip: Add system PM support
Date: Tue, 08 Sep 2026 15:12:11 +0000 [thread overview]
Message-ID: <20260908151212.08E201F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260908-rockchip-pcie-system-suspend-v6-9-fbabcca9921b@collabora.com>
Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider:
- [High] System resume unconditionally re-initializes the host, leaking the existing IRQ domain and breaking legacy INTx interrupts while executing invalid GFP_KERNEL allocations in an atomic context.
- [High] The PM operations `rockchip_pcie_suspend` and `rockchip_pcie_resume` are registered as `noirq` callbacks but call functions that can sleep.
- [High] Missing check for the return value of reset_control_deassert() in rockchip_pcie_resume().
- [Medium] Missing `reset_control_assert` in the error handling path of `rockchip_pcie_resume`.
- [Medium] The order of initializing and tearing down the regulator, PHY, and clocks in system PM callbacks contradicts the proven sequence used during driver probe.
--
commit 8a8b70dde70e09797d6c8a3b9234fe5f8265aec7
Author: Sebastian Reichel <sebastian.reichel@collabora.com>
PCI: dw-rockchip: Add system PM support
Add system PM support for Rockchip PCIe Designware Controllers.
> diff --git a/drivers/pci/controller/dwc/pcie-dw-rockchip.c b/drivers/pci/controller/dwc/pcie-dw-rockchip.c
> index 47d9cab909bce..e675918ba1848 100644
> --- a/drivers/pci/controller/dwc/pcie-dw-rockchip.c
> +++ b/drivers/pci/controller/dwc/pcie-dw-rockchip.c
[ ... ]
> +static int rockchip_pcie_suspend(struct device *dev)
> +{
[ ... ]
> + ret = dw_pcie_suspend_noirq(pci);
> + if (ret)
> + return ret;
> +
> + gpiod_set_value_cansleep(rockchip->rst_gpio, 0);
[Severity: High]
Since rockchip_pcie_suspend() is registered via NOIRQ_SYSTEM_SLEEP_PM_OPS(),
it executes as a noirq callback where local interrupts are disabled.
Is it safe to call sleepable functions in this atomic context? Functions like
gpiod_set_value_cansleep() and clk_bulk_disable_unprepare() (which takes a
mutex) might trigger might_sleep splats or deadlocks.
> + rockchip_pcie_phy_deinit(rockchip);
> + clk_bulk_disable_unprepare(rockchip->clk_cnt, rockchip->clks);
> + reset_control_assert(rockchip->rst);
> + if (rockchip->vpcie3v3)
> + regulator_disable(rockchip->vpcie3v3);
> +
> + return 0;
> +}
> +
> +static int rockchip_pcie_resume(struct device *dev)
> +{
[ ... ]
> + ret = clk_bulk_prepare_enable(rockchip->clk_cnt, rockchip->clks);
[Severity: Medium]
Does this sequence invert the hardware initialization dependencies used during
driver probe?
During probe, the driver enables the regulator, initializes the PHY, deasserts
reset, and then enables the clocks. Here in rockchip_pcie_resume(), the clocks
are enabled first, followed by the regulator and PHY. Could this inverted
order cause link-training bugs or PHY lockups?
> + if (ret) {
> + dev_err(dev, "clock init failed: %d\n", ret);
> + return ret;
> + }
> +
> + if (rockchip->vpcie3v3) {
> + ret = regulator_enable(rockchip->vpcie3v3);
> + if (ret)
> + goto err_disable_clk;
> + }
> +
> + ret = rockchip_pcie_phy_init(rockchip);
> + if (ret) {
> + dev_err(dev, "phy init failed: %d\n", ret);
> + goto err_disable_regulator;
> + }
> +
> + reset_control_deassert(rockchip->rst);
[Severity: High]
Does this code handle reset_control_deassert() failures?
If reset_control_deassert() fails, the driver immediately proceeds to write to
the IP block's APB registers. If the hardware reset was not actually released,
accessing these registers could trigger a synchronous external abort and kernel
panic.
> +
> + rockchip_pcie_writel_apb(rockchip, FIELD_PREP_WM16(0xffff, rockchip->intx),
> + PCIE_CLIENT_INTR_MASK_LEGACY);
> +
> + rockchip_pcie_enable_enhanced_ltssm_control_mode(rockchip, 0);
> + rockchip_pcie_set_controller_mode(rockchip, PCIE_CLIENT_MODE_RC);
> + rockchip_pcie_unmask_dll_indicator(rockchip);
> +
> + gpiod_set_value_cansleep(rockchip->rst_gpio, 1);
> +
> + ret = dw_pcie_resume_noirq(pci);
[Severity: High]
Does system resume unconditionally re-initialize the host, leaking the existing
IRQ domain and breaking legacy INTx interrupts?
When dw_pcie_resume_noirq() is called, it invokes the host initialization
callback rockchip_pcie_host_init(), which then calls
rockchip_pcie_init_irq_domain():
rockchip_pcie_host_init()
rockchip_pcie_init_irq_domain()
rockchip->irq_domain = irq_domain_create_linear(of_fwnode_handle(intc),
PCI_NUM_INTX,
&intx_domain_ops,
rockchip);
This executes an invalid GFP_KERNEL allocation inside the atomic noirq phase,
overwrites the existing irq_domain pointer (leaking the old domain), and drops
existing INTx mappings.
> + if (ret) {
> + dev_err(dev, "failed to resume: %d\n", ret);
[ ... ]
> +err_deinit_phy:
> + gpiod_set_value_cansleep(rockchip->rst_gpio, 0);
> + rockchip_pcie_phy_deinit(rockchip);
> +err_disable_regulator:
[Severity: Medium]
Does this error path leave the hardware controller in an inconsistent,
permanently deasserted state?
If dw_pcie_resume_noirq() fails, the error handling block tears down the PHY,
clocks, and regulator, but it seems to miss calling
reset_control_assert(rockchip->rst).
> + if (rockchip->vpcie3v3)
> + regulator_disable(rockchip->vpcie3v3);
> +err_disable_clk:
> + clk_bulk_disable_unprepare(rockchip->clk_cnt, rockchip->clks);
> + return ret;
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260908-rockchip-pcie-system-suspend-v6-0-fbabcca9921b@collabora.com?part=9
next prev parent reply other threads:[~2026-09-08 15:12 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 14:51 [PATCH v6 00/10] PCI: dw-rockchip: add system suspend support Sebastian Reichel
2026-09-08 14:51 ` Sebastian Reichel
2026-09-08 14:51 ` [PATCH v6 01/10] PCI: dw-rockchip: Fix LTSSM set functions Sebastian Reichel
2026-09-08 14:51 ` Sebastian Reichel
2026-09-08 14:58 ` sashiko-bot
2026-09-09 0:37 ` Shawn Lin
2026-09-09 0:37 ` Shawn Lin
2026-09-08 14:51 ` [PATCH v6 02/10] PCI: dw-rockchip: Restore vpcie3v3 regulator handle Sebastian Reichel
2026-09-08 14:51 ` Sebastian Reichel
2026-09-08 15:05 ` sashiko-bot
2026-09-09 0:44 ` Shawn Lin
2026-09-09 0:44 ` Shawn Lin
2026-09-08 14:51 ` [PATCH v6 03/10] PCI: dw-rockchip: Move devm_phy_get out of phy_init Sebastian Reichel
2026-09-08 14:51 ` Sebastian Reichel
2026-09-08 15:04 ` sashiko-bot
2026-09-09 0:54 ` Shawn Lin
2026-09-09 0:54 ` Shawn Lin
2026-09-08 14:51 ` [PATCH v6 04/10] PCI: dw-rockchip: Add helper function for enhanced LTSSM control mode Sebastian Reichel
2026-09-08 14:51 ` Sebastian Reichel
2026-09-08 15:23 ` sashiko-bot
2026-09-09 0:56 ` Shawn Lin
2026-09-09 0:56 ` Shawn Lin
2026-09-08 14:51 ` [PATCH v6 05/10] PCI: dw-rockchip: Add helper function for controller mode Sebastian Reichel
2026-09-08 14:51 ` Sebastian Reichel
2026-09-08 15:03 ` sashiko-bot
2026-09-09 0:58 ` Shawn Lin
2026-09-09 0:58 ` Shawn Lin
2026-09-08 14:51 ` [PATCH v6 06/10] PCI: dw-rockchip: Add helper function for DDL indicator Sebastian Reichel
2026-09-08 14:51 ` Sebastian Reichel
2026-09-08 15:00 ` sashiko-bot
2026-09-09 0:58 ` Shawn Lin
2026-09-09 0:58 ` Shawn Lin
2026-09-08 14:51 ` [PATCH v6 07/10] PCI: dw-rockchip: Add pme_turn_off support Sebastian Reichel
2026-09-08 14:51 ` Sebastian Reichel
2026-09-08 15:09 ` sashiko-bot
2026-09-09 1:07 ` Shawn Lin
2026-09-09 1:07 ` Shawn Lin
2026-09-08 14:51 ` [PATCH v6 08/10] PCI: dw-rockchip: Set broken L1SS resume flag Sebastian Reichel
2026-09-08 14:51 ` Sebastian Reichel
2026-09-08 14:58 ` sashiko-bot
2026-09-09 1:11 ` Shawn Lin
2026-09-09 1:11 ` Shawn Lin
2026-09-08 14:51 ` [PATCH v6 09/10] PCI: dw-rockchip: Add system PM support Sebastian Reichel
2026-09-08 14:51 ` Sebastian Reichel
2026-09-08 15:12 ` sashiko-bot [this message]
2026-09-08 14:51 ` [PATCH v6 10/10] PCI: dw-rockchip: Clear debug buffer before entering L2 Sebastian Reichel
2026-09-08 14:51 ` Sebastian Reichel
2026-09-08 15:04 ` sashiko-bot
2026-09-09 1:14 ` Shawn Lin
2026-09-09 1:14 ` Shawn Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260908151212.08E201F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sebastian.reichel@collabora.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.