Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: aiyengar1990@gmail.com
Cc: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
	heiko@sntech.de, andrew+netdev@lunn.ch, davem@davemloft.net,
	edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
	david.wu@rock-chips.com, dlemoal@kernel.org, cassel@kernel.org,
	fancer.lancer@gmail.com, netdev@vger.kernel.org,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-ide@vger.kernel.org, praan@google.com, will@kernel.org,
	robin.murphy@arm.com, iommu@lists.linux.dev,
	shawn.lin@rock-chips.com, sebastian.reichel@collabora.com
Subject: Re: [PATCH 5/9] arm64: dts: rockchip: Add the PHP GRF clock on RK3588
Date: Tue, 17 Nov 2026 17:35:15 +0000	[thread overview]
Message-ID: <179493691507.3136.7881513635093439298@kernel.org> (raw)
In-Reply-To: <20261113-mmu600-php-v1-5-231196049a3b@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] Adding `clocks = <&cru PCLK_PHP_ROOT>` to php_grf creates a DT
  dependency cycle: the cru node has `rockchip,grf = <&php_grf>`…
- [Low] Once the clock is attached, regmap-mmio wraps every PHP GRF
  access in clk_enable()/clk_disable() (regmap_mmio_write lines 157/165,…

--

arm64: dts: rockchip: Add the PHP GRF clock on RK3588

This adds a PCLK_PHP_ROOT clock reference to the php_grf syscon node on
RK3588, so that the syscon regmap enables pclk_php_root around PHP GRF
accesses. The motivation is a deep suspend hang in the syscore resume op
added by the next patch, which ran after the PHP peripherals had gated
pclk_php_root.

> diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
> index d0f364547ae55..8807ce6193bfc 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
> +++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
> @@ -619,6 +619,7 @@ usb_grf: syscon@fd5ac000 {
>  	php_grf: syscon@fd5b0000 {
>  		compatible = "rockchip,rk3588-php-grf", "syscon";
>  		reg = <0x0 0xfd5b0000 0x0 0x1000>;
> +		clocks = <&cru PCLK_PHP_ROOT>;

[Severity: Medium]
Does this create a dependency cycle with the cru node? The cru node in
this same file already has:

	rockchip,grf = <&php_grf>;

and php_grf now references a clock that cru provides.

On RK3588 the CRU looks up its GRF from the CLK_OF_DECLARE_DRIVER hook,
before its own clock provider is registered:

of_clk_init()
  rk3588_clk_early_init()
    rockchip_clk_init_early()
      rockchip_clk_init_base()
        syscon_regmap_lookup_by_phandle(ctx->cru_node, "rockchip,grf")
          of_syscon_register(php_grf, check_res=true)
            of_clk_get(np, 0)   <- now returns -EPROBE_DEFER
    ...
    rockchip_clk_of_add_provider(np, ctx)   <- provider only added here

of_syscon_register() only treats -ENOENT as a missing clock:

drivers/mfd/syscon.c:of_syscon_register() {
    ...
		clk = of_clk_get(np, 0);
		if (IS_ERR(clk)) {
			ret = PTR_ERR(clk);
			/* clock is optional */
			if (ret != -ENOENT)
				goto err_clk;
    ...
}

So the regmap is torn down and nothing is cached. clk_rk3588_probe()
reuses early_ctx and never retries the lookup. Would ctx->grf then stay
ERR_PTR(-EPROBE_DEFER) for good? Before this patch it was a valid php_grf
regmap.

Nothing on RK3588 seems to dereference ctx->grf today. The pll_rk3588 ops
don't use it, and the GATE_GRF branches use grf_type_sys from
aux_grf_table. However, rockchip_clk_register_branches() falls back to it
for grf mux/gate/mmc branches that have no matching aux GRF:

	struct regmap *grf = ctx->grf;

A future branch like that would silently get an error pointer.

There is also a second interaction. Before this patch, the CRU's early
lookup was the first to create and cache the php_grf regmap, and it did so
without a clock. Every later syscon_node_to_regmap() user got that
clockless regmap: rockchip_grf_init(), dwmac-rk via rockchip,php-grf, and
naneng-combphy via rockchip,pipe-grf.

With this patch, the clock only gets attached because the CRU lookup
fails. That failure moves the first successful creation to
rockchip_grf_init() at postcore_initcall, when PCLK_PHP_ROOT is already
available.

If the CRU lookup were moved after provider registration, or some earlier
caller created the regmap without the clock, a clockless regmap would be
cached again. The restore op in the following patch "soc: rockchip: grf:
Restore the RK3588 PHP StreamIDs after system suspend" only checks
of_property_present(np, "clocks"). It doesn't check whether the cached
regmap actually carries the clock. Wouldn't deep suspend hang again in
that case?

Should the commit message describe this ordering dependency and the
effect on ctx->grf?

[Severity: Low]
With the clock attached, regmap-mmio wraps each PHP GRF access in
clk_enable()/clk_disable(). Does this change when pclk_php_root is gated
in hardware?

rockchip_grf_init() runs at postcore_initcall. After the earlier patch
"soc: rockchip: grf: Assign the StreamIDs of the RK3588 PHP SMMU masters",
it writes 12 StreamID registers through this regmap. At that point no PHP
consumer holds pclk_php_root, and the clock is a plain gate with flags 0:

	COMPOSITE_NODIV(PCLK_PHP_ROOT, "pclk_php_root", mux_150m_50m_24m_p, 0,

So each write takes enable_count from 0 to 1 and back to 0:

rockchip_grf_init()
  regmap_write()
    regmap_mmio_write()
      clk_enable()
      ...
      clk_disable()
        clk_core_disable()
          core->ops->disable()
          clk_core_disable(core->parent)

Before this patch, the clock kept its bootloader state until
clk_disable_unused at late_initcall_sync. With clk_ignore_unused it was
never touched. Now it is gated at postcore_initcall, along with any parent
whose count also drops to zero, and this happens even with
clk_ignore_unused.

Could a PHP-domain register access in that window now hang? The same
question applies to an access under clk_ignore_unused that relied on the
bootloader leaving the clock on.

The commit message says the regmap enables the clock. It doesn't mention
that the regmap also gates it this early.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261113-mmu600-php-v1-0-231196049a3b%40gmail.com


  reply	other threads:[~2026-11-17 17:35 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 16:38 [PATCH 0/9] RK3588: Enable the PHP SMMU Arun Iyengar via B4 Relay
2026-11-13 16:38 ` [PATCH 1/9] dt-bindings: net: rockchip-dwmac: Allow iommus Arun Iyengar via B4 Relay
2026-11-17 17:35   ` netdev-bot+sashiko
2026-11-13 16:38 ` [PATCH 2/9] dt-bindings: ata: rockchip,dwc-ahci: " Arun Iyengar via B4 Relay
2026-11-17 17:35   ` netdev-bot+sashiko
2026-11-13 16:38 ` [PATCH 3/9] dt-bindings: soc: rockchip: grf: Allow a clock for the RK3588 PHP GRF Arun Iyengar via B4 Relay
2026-11-17 17:35   ` netdev-bot+sashiko
2026-11-13 16:38 ` [PATCH 4/9] soc: rockchip: grf: Assign the StreamIDs of the RK3588 PHP SMMU masters Arun Iyengar via B4 Relay
2026-11-13 16:38 ` [PATCH 5/9] arm64: dts: rockchip: Add the PHP GRF clock on RK3588 Arun Iyengar via B4 Relay
2026-11-17 17:35   ` netdev-bot+sashiko [this message]
2026-11-13 16:38 ` [PATCH 6/9] soc: rockchip: grf: Restore the RK3588 PHP StreamIDs after system suspend Arun Iyengar via B4 Relay
2026-11-17 17:35   ` netdev-bot+sashiko
2026-11-13 16:38 ` [PATCH 7/9] arm64: dts: rockchip: Add the clock and reset of the RK3588 PHP SMMU Arun Iyengar via B4 Relay
2026-11-17 17:35   ` netdev-bot+sashiko
2026-11-13 16:38 ` [PATCH 8/9] arm64: dts: rockchip: Attach the masters " Arun Iyengar via B4 Relay
2026-11-17 17:35   ` netdev-bot+sashiko
2026-11-13 16:38 ` [PATCH 9/9] arm64: dts: rockchip: Enable " Arun Iyengar via B4 Relay
2026-11-17 17:35   ` netdev-bot+sashiko

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=179493691507.3136.7881513635093439298@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=aiyengar1990@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=cassel@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=david.wu@rock-chips.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=edumazet@kernel.org \
    --cc=fancer.lancer@gmail.com \
    --cc=heiko@sntech.de \
    --cc=iommu@lists.linux.dev \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=praan@google.com \
    --cc=robh@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=sebastian.reichel@collabora.com \
    --cc=shawn.lin@rock-chips.com \
    --cc=will@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