From: sashiko-bot@kernel.org
To: "Cunhao Lu" <1579567540@qq.com>
Cc: linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
mfd@lists.linux.dev, linux-gpio@vger.kernel.org,
linux-serial@vger.kernel.org, linux-phy@lists.infradead.org,
linux-usb@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org,
vkoul@kernel.org, neil.armstrong@linaro.org, olteanv@gmail.com,
lee@kernel.org
Subject: Re: [PATCH 10/27] pmdomain: rockchip: Add RK3572 boot peripheral domains
Date: Thu, 22 Oct 2026 16:13:07 +0000 [thread overview]
Message-ID: <sashiko-outbox-181774@kernel.org> (raw)
In-Reply-To: <20261022-add-board-ok3572-c-v1-10-0b0fd85a31ee@qq.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] pmdomain: rockchip: incomplete power-on retry tracking in rockchip_pd_power()
--
commit c324244eacf06dcfc61ec2e5830623efbacb5d15
Author: Cunhao Lu <1579567540@qq.com>
pmdomain: rockchip: Add RK3572 boot peripheral domains
This commit adds the rk3572 boot peripheral power domains (nvm0, nvm1, php,
and vop), waits for the grf firewall before restoring consumers, and tracks
pending power-on transitions to retry failures without power-cycling the
domain.
> diff --git a/drivers/pmdomain/rockchip/pm-domains.c b/drivers/pmdomain/rockchip/pm-domains.c
> index e193f978d5f35..86a6ffd43254b 100644
> --- a/drivers/pmdomain/rockchip/pm-domains.c
> +++ b/drivers/pmdomain/rockchip/pm-domains.c
[ ... ]
> @@ -644,14 +657,29 @@ static int rockchip_do_pmu_set_power_domain(struct rockchip_pm_domain *pd,
> return 0;
> }
>
> +static int rockchip_pmu_wait_firewall(struct rockchip_pm_domain *pd)
> +{
> + struct rockchip_pmu *pmu = pd->pmu;
> + u32 mask = pd->info->firewall_mask;
> + u32 val;
> +
> + if (!mask)
> + return 0;
> +
> + return regmap_read_poll_timeout(pmu->grf, pmu->info->firewall_status_offset,
> + val, (val & mask) == mask, 0, 10000);
> +}
> +
> static int rockchip_pd_power(struct rockchip_pm_domain *pd, bool power_on)
> {
> struct rockchip_pmu *pmu = pd->pmu;
> + bool is_on;
> int ret;
>
> guard(mutex)(&pmu->mutex);
>
> - if (rockchip_pmu_domain_is_on(pd) == power_on)
> + is_on = rockchip_pmu_domain_is_on(pd);
> + if (is_on == power_on && !pd->power_on_pending)
> return 0;
>
> ret = clk_bulk_enable(pd->num_clks, pd->clks);
> @@ -663,7 +691,8 @@ static int rockchip_pd_power(struct rockchip_pm_domain *pd, bool power_on)
> rockchip_pmu_ungate_clk(pd, true);
>
> if (!power_on) {
> - rockchip_pmu_save_qos(pd);
> + if (!pd->power_on_pending)
> + rockchip_pmu_save_qos(pd);
>
> /* if powering down, idle request to NIU first */
> ret = rockchip_pmu_set_idle_request(pd, true);
> @@ -671,18 +700,29 @@ static int rockchip_pd_power(struct rockchip_pm_domain *pd, bool power_on)
> goto out;
> }
>
> - ret = rockchip_do_pmu_set_power_domain(pd, power_on);
> - if (ret < 0)
> - goto out;
> + /* A failed firewall wait must not restart powered memory on retry. */
> + if (is_on != power_on) {
> + ret = rockchip_do_pmu_set_power_domain(pd, power_on);
> + if (ret < 0)
> + goto out;
> + }
>
> if (power_on) {
> + if (pd->info->firewall_mask)
> + pd->power_on_pending = true;
> +
> /* if powering up, leave idle mode */
> ret = rockchip_pmu_set_idle_request(pd, false);
> if (ret < 0)
> goto out;
[Severity: High]
In drivers/pmdomain/rockchip/pm-domains.c, does setting pd->power_on_pending
only when pd->info->firewall_mask is non-zero and only after
rockchip_do_pmu_set_power_domain() succeeds leave partial power-on states
untracked in rockchip_pd_power()?
When genpd_power_on() -> rockchip_pd_power_on() -> rockchip_pd_power(pd, true)
is called for a domain that is initially off (is_on == false),
rockchip_do_pmu_set_power_domain(pd, true) enables the hardware power switch
in pmu->info->pwr_offset + pd_pwr_offset, making rockchip_pmu_domain_is_on(pd)
return true.
If rockchip_pmu_set_idle_request(pd, false) subsequently fails on a domain
where pd->info->firewall_mask is 0 (such as the "nvm0" and "nvm1" domains on
rk3572, or domains on other SoCs), or if rockchip_do_pmu_set_power_domain()
fails in rockchip_pmu_domain_mem_reset() after enabling the power switch,
pd->power_on_pending remains false when jumping to out.
If a later power-on retry calls rockchip_pd_power(pd, true),
rockchip_pmu_domain_is_on(pd) will return true while pd->power_on_pending is
false:
is_on = rockchip_pmu_domain_is_on(pd);
if (is_on == power_on && !pd->power_on_pending)
return 0;
Wouldn't rockchip_pd_power(pd, true) then return 0 immediately without
deasserting the bus idle request, resetting memory, waiting for the firewall,
or restoring QoS registers via rockchip_pmu_restore_qos()? Furthermore, if
rockchip_pd_power(pd, false) is called in that state, wouldn't the
!pd->power_on_pending check allow rockchip_pmu_save_qos(pd) to overwrite
pd->qos_save_regs with unrestored values while the domain is still idle?
Should pd->power_on_pending be set unconditionally before
rockchip_do_pmu_set_power_domain(pd, true) when powering on a domain?
>
> + ret = rockchip_pmu_wait_firewall(pd);
> + if (ret)
> + goto out;
> +
> rockchip_pmu_restore_qos(pd);
> }
> + pd->power_on_pending = false;
>
> out:
> rockchip_pmu_ungate_clk(pd, false);
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261022-add-board-ok3572-c-v1-0-0b0fd85a31ee@qq.com?part=10
next prev parent reply other threads:[~2026-10-22 16:13 UTC|newest]
Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-21 16:10 [PATCH 00/27] rockchip: Add RK3572 and Forlinx OK3572-C support Cunhao Lu via B4 Relay
2026-10-21 16:10 ` [PATCH 01/27] dt-bindings: clock: rockchip: Add RK3572 CRU Cunhao Lu via B4 Relay
2026-10-22 16:12 ` sashiko-bot
2026-10-21 16:10 ` [PATCH 02/27] dt-bindings: power: rockchip: Add RK3572 power domains Cunhao Lu via B4 Relay
2026-10-22 16:12 ` sashiko-bot
2026-10-21 16:11 ` [PATCH 03/27] dt-bindings: soc: rockchip: Add RK3572 PMU and GRF Cunhao Lu via B4 Relay
2026-10-22 16:12 ` sashiko-bot
2026-10-21 16:11 ` [PATCH 04/27] dt-bindings: mfd: syscon: Add RK3572 QoS register compatible Cunhao Lu via B4 Relay
2026-10-22 16:13 ` sashiko-bot
2026-10-21 16:11 ` [PATCH 05/27] dt-bindings: pinctrl: rockchip: Add RK3572 Cunhao Lu via B4 Relay
2026-10-22 16:13 ` sashiko-bot
2026-10-21 16:11 ` [PATCH 06/27] dt-bindings: gpio: rockchip: Add RK3572 GPIO banks Cunhao Lu via B4 Relay
2026-10-22 16:13 ` sashiko-bot
2026-10-21 16:11 ` [PATCH 07/27] clk: rockchip: Add RK3572 clock and reset support Cunhao Lu via B4 Relay
2026-10-21 22:26 ` Heiko Stübner
2026-10-22 6:09 ` Cunhao Lu
2026-10-22 7:38 ` Heiko Stübner
2026-10-22 8:31 ` Cunhao Lu
2026-10-22 16:13 ` sashiko-bot
2026-10-21 16:11 ` [PATCH 08/27] pinctrl: rockchip: Add RK3572 support Cunhao Lu via B4 Relay
2026-10-22 16:13 ` sashiko-bot
2026-10-21 16:11 ` [PATCH 09/27] gpio: rockchip: Add RK3572 GPIO support Cunhao Lu via B4 Relay
2026-10-22 16:13 ` sashiko-bot
2026-10-21 16:11 ` [PATCH 10/27] pmdomain: rockchip: Add RK3572 boot peripheral domains Cunhao Lu via B4 Relay
2026-10-22 16:13 ` sashiko-bot [this message]
2026-10-21 16:11 ` [PATCH 11/27] dt-bindings: i2c: rk3x: Add RK3572 Cunhao Lu via B4 Relay
2026-10-22 16:13 ` sashiko-bot
2026-10-26 22:34 ` Andi Shyti
2026-10-21 16:11 ` [PATCH 12/27] dt-bindings: serial: snps-dw-apb-uart: " Cunhao Lu via B4 Relay
2026-10-22 16:13 ` sashiko-bot
2026-10-21 16:11 ` [PATCH 13/27] dt-bindings: mmc: rockchip: Add RK3572 controllers Cunhao Lu via B4 Relay
2026-10-22 16:13 ` sashiko-bot
2026-10-21 16:11 ` [PATCH 14/27] dt-bindings: net: rockchip-dwmac: Add RK3572 Cunhao Lu via B4 Relay
2026-10-21 17:14 ` Andrew Lunn
2026-10-22 6:03 ` Cunhao Lu
2026-10-22 16:13 ` sashiko-bot
2026-10-21 16:11 ` [PATCH 15/27] dt-bindings: thermal: rockchip: " Cunhao Lu via B4 Relay
2026-10-22 16:13 ` sashiko-bot
2026-10-21 16:11 ` [PATCH 16/27] net: stmmac: dwmac-rk: Add RK3572 support Cunhao Lu via B4 Relay
2026-10-21 17:09 ` Andrew Lunn
2026-10-22 5:33 ` Cunhao Lu
2026-10-22 16:13 ` sashiko-bot
2026-10-21 16:11 ` [PATCH 17/27] thermal: rockchip: " Cunhao Lu via B4 Relay
2026-10-22 16:13 ` sashiko-bot
2026-10-21 16:11 ` [PATCH 18/27] dt-bindings: phy: rockchip-inno-usb2: Add RK3572 Cunhao Lu via B4 Relay
2026-10-22 16:13 ` sashiko-bot
2026-10-21 16:11 ` [PATCH 19/27] dt-bindings: phy: rockchip-naneng-combphy: " Cunhao Lu via B4 Relay
2026-10-22 16:13 ` sashiko-bot
2026-10-21 16:11 ` [PATCH 20/27] dt-bindings: usb: rockchip: Add RK3572 DWC3 controller Cunhao Lu via B4 Relay
2026-10-22 16:13 ` sashiko-bot
2026-10-21 16:11 ` [PATCH 21/27] phy: rockchip-inno-usb2: Add RK3572 support Cunhao Lu via B4 Relay
2026-10-22 16:13 ` sashiko-bot
2026-10-21 16:11 ` [PATCH 22/27] phy: rockchip-naneng-combphy: " Cunhao Lu via B4 Relay
2026-10-22 16:13 ` sashiko-bot
2026-10-21 16:11 ` [PATCH 23/27] usb: dwc3: Configure RK3572 PIPE port before discovery Cunhao Lu via B4 Relay
2026-10-22 16:13 ` sashiko-bot
2026-10-21 16:11 ` [PATCH 24/27] mmc: dw_mmc-rockchip: Keep RK3572 NVM domain powered Cunhao Lu via B4 Relay
2026-10-22 16:13 ` sashiko-bot
2026-10-27 0:53 ` Shawn Lin
2026-10-21 16:11 ` [PATCH 25/27] dt-bindings: arm: rockchip: Add Forlinx OK3572-C Cunhao Lu via B4 Relay
2026-10-22 16:13 ` sashiko-bot
2026-10-21 16:11 ` [PATCH 26/27] arm64: dts: rockchip: Add RK3572 SoC Cunhao Lu via B4 Relay
2026-10-22 16:13 ` sashiko-bot
2026-10-21 16:11 ` [PATCH 27/27] arm64: dts: rockchip: Add initial support for Forlinx OK3572-C Cunhao Lu via B4 Relay
2026-10-22 16:13 ` sashiko-bot
2026-10-21 23:00 ` [PATCH 00/27] rockchip: Add RK3572 and Forlinx OK3572-C support Shawn Lin
2026-10-22 6:37 ` Cunhao Lu
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=sashiko-outbox-181774@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=1579567540@qq.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=lee@kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-serial@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mfd@lists.linux.dev \
--cc=neil.armstrong@linaro.org \
--cc=olteanv@gmail.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vkoul@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox