Linux-Rockchip Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Paunovic <royalnet026@gmail.com>
To: Jonas Karlman <jonas@kwiboo.se>
Cc: Igor Paunovic <royalnet026@gmail.com>,
	Nicolas Dufresne <nicolas@ndufresne.ca>,
	Tomeu Vizoso <tomeu@tomeuvizoso.net>,
	Heiko Stuebner <heiko@sntech.de>,
	Jiaxing Hu <gahing@gahingwoo.com>,
	Oded Gabbay <ogabbay@kernel.org>,
	dri-devel@lists.freedesktop.org,
	linux-rockchip@lists.infradead.org
Subject: Re: [RFC] accel/rocket: DVFS on RK3588 - a hardware constraint, and some numbers
Date: Wed, 19 Aug 2026 07:52:23 +0200	[thread overview]
Message-ID: <20260819055324.33669-1-royalnet026@gmail.com> (raw)
In-Reply-To: <286e8418-fae6-4979-96d1-e13abb04b3a1@kwiboo.se>

Hi Jonas,

On 8/18/2026 2:30 PM, Jonas Karlman wrote:
> Looking closer at my old commits, it was the PCLK_GPU_ROOT that was
> needed for e.g. RK3576 and RK3528. This clock is not described in RK3588
> clock tree so it never gets disabled by Linux clock framework.
>
> I suspect similarly one of the NPU root clocks is what drives the NPU
> PVTPLL and thus always must be kept enabled when PVTPLL mode is used.

Thank you - the PCLK_GPU_ROOT observation was the missing piece. I went
through the firmware my board actually runs and can now name the clock
for the NPU case.

First a correction to what I told Nicolas earlier: my BL31 is not the
vendor blob. The boot banner reports v2.12.0-9-gd5c68fd92, which is the
edk2-rk3588 project's TF-A branch: upstream v2.12.0 plus nine feature
commits (SCMI voltage domain, eMMC clock, TRNG, ...). The only one of
those touching rk3588_clk.c adds an eMMC clock; the NPU set_rate/PVTPLL
path is unmodified mainline v2.12. So Nicolas and I are effectively
running the same clock code, and the firmware-difference caveat from my
earlier mail mostly evaporates.

What clk_npu_set_rate() in plat/rockchip/rk3588/drivers/scmi/rk3588_clk.c
does:

- The rate table gives every OPP from 300 MHz up a ring length > 0, so
  they all take the PVTPLL path; 200 MHz has length 0 and takes the
  normal GPLL divider path. The 200 MHz suspend rate we both converged
  on is therefore safe by construction on this SoC.

- For a PVTPLL rate the firmware programs ring_sel/length/calibration
  (cal cnt = 24, T = 1 us, i.e. a 24 MHz reference) into NPU GRF at
  0xfd5a2000 (NPU_PVTPLL_CON0..2), and only then flips the mux in CRU
  CLKSEL_CON(74) to the PVTPLL path.

The Linux side is where the NPU differs from your GPU case: the NPU
root clocks are fully described in clk-rk3588.c. pclk_npu_root is a
gateable composite (CLKGATE_CON(29) bit 4) and NPU GRF hangs off it
(pclk_npu_grf, CLK_IGNORE_UNUSED). In the mainline DT only core 0
(fdab0000) requests PCLK_NPU_ROOT as its "pclk"; cores 1/2 only hold
their aclk/hclk. So whenever core 0 is runtime-suspended, pclk_npu_root
has no user left and gets gated.

An SCMI set_rate to a PVTPLL rate issued in that state programs a GRF
whose bus clock is off, while the mux write still lands because the CRU
is always clocked - leaving clk_npu_dsu0 parked on a ring that was
never configured. That matches the empirical failure in my RFC exactly:
the sysfs min_freq write while suspended, followed by the power-domain
power-on ack timeout. (I have not put a scope on the APB bus, so "the
GRF write cannot land" is inferred from the failure signature plus the
gate state, not observed directly.)

For the series this reinforces the hold-all guard: resuming all cores -
core 0 in particular - around every rate change keeps pclk_npu_root
enabled for the duration of the SCMI call, closing the window for the
sysfs, governor and cooling paths alike. Your .config_clks() +
pm_runtime_suspended() check covers the OPP-initiated paths; I will
reference it and your branch in the cover letter.

One open point where your GPU experience may help: besides the GRF
programming interface, do you know whether the ring/monitor logic also
depends on hclk_npu_root, or is the 24 MHz calibration reference
(xin24m, always on) the only other input? If you never had to find out,
I will determine it empirically by holding only pclk and cycling rates.

Regards,
Igor

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

  reply	other threads:[~2026-08-19  5:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-01 13:16 [RFC] accel/rocket: DVFS on RK3588 - a hardware constraint, and some numbers Igor Paunovic
2026-08-01 19:32 ` Jiaxing Hu
2026-08-02 12:04   ` Igor Paunovic
2026-08-15 18:24     ` Tomeu Vizoso
2026-08-17 18:22 ` Nicolas Dufresne
2026-08-18  7:27   ` Igor Paunovic
2026-08-18 12:12     ` Jonas Karlman
2026-08-18 12:30       ` Jonas Karlman
2026-08-19  5:52         ` Igor Paunovic [this message]
2026-08-19  9:40           ` Jonas Karlman
2026-08-19 12:59             ` Igor Paunovic
     [not found] <DKDOBW9CJ2Y3.10EEIZDTXPYJZ@cknow-tech.com>
2026-08-01 14:40 ` Igor Paunovic
2026-08-01 16:29   ` Diederik de Haas

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=20260819055324.33669-1-royalnet026@gmail.com \
    --to=royalnet026@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gahing@gahingwoo.com \
    --cc=heiko@sntech.de \
    --cc=jonas@kwiboo.se \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=nicolas@ndufresne.ca \
    --cc=ogabbay@kernel.org \
    --cc=tomeu@tomeuvizoso.net \
    /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