From: sashiko-bot@kernel.org
To: "Sebastian Reichel" <sebastian.reichel@collabora.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v3 9/9] PM / devfreq: rockchip-dfi: add RK3576 support
Date: Tue, 17 Nov 2026 15:54:52 +0000 [thread overview]
Message-ID: <sashiko-outbox-219117@kernel.org> (raw)
In-Reply-To: <20261117-rockchip-dfi-rk3588-cleanups-and-rk3576-support-v3-9-32ff1546b0e4@collabora.com>
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] PM / devfreq: rockchip-dfi: broken LPDDR5 bank mode in
rk3588_dfi_init()
- [Medium] devfreq: rockchip-dfi: uninitialized dmc_count read for
RK3576 in perf events
- [Low] PM / devfreq: rockchip-dfi: fix num_clks kernel-doc in
rockchip_dfi_variant
--
commit e9116d479abafdafaf4829a0c8f1e9fcb3fce374
Author: Sebastian Reichel <sebastian.reichel@collabora.com>
PM / devfreq: rockchip-dfi: add RK3576 support
This commit adds RK3576 support to the Rockchip DFI driver by defining its
clock names, variant configuration, and device tree match entry.
> diff --git a/drivers/devfreq/event/rockchip-dfi.c b/drivers/devfreq/event/rockchip-dfi.c
> index ed28dc6446f10..91b6dd01b453c 100644
> --- a/drivers/devfreq/event/rockchip-dfi.c
> +++ b/drivers/devfreq/event/rockchip-dfi.c
[ ... ]
> @@ -888,6 +892,18 @@ static const struct rockchip_dfi_variant rk3568_variant = {
> .reg_access = 0x2c,
> };
>
> +static const struct rockchip_dfi_variant rk3576_variant = {
> + .init = rk3588_dfi_init,
[Severity: Medium]
Does wiring RK3576 (DDRMON v4) to rk3588_dfi_init() and
rockchip_dfi_v4_ddrtype_to_ctrl() corrupt the LPDDR5 bank mode written to
DDRMON_CTRL1?
rk3588_dfi_init() pre-shifts dfi->lp5_bank_mode by 7 bits, and
rockchip_dfi_v4_ddrtype_to_ctrl() then passes DDRMON_CTRL_LP5_BANK_MODE_MASK
(GENMASK(8, 7)) instead of DDRMON_CTRL1_LP5_BANK_MODE_MASK (GENMASK(2, 1))
to FIELD_PREP_WM16():
drivers/devfreq/event/rockchip-dfi.c:rk3588_dfi_init() {
...
if (dfi->ddr_type == ROCKCHIP_DDRTYPE_LPDDR5) {
regmap_read(regmap_pmu, RK3588_PMUGRF_OS_REG6, ®6);
dfi->lp5_bank_mode = FIELD_GET(RK3588_PMUGRF_OS_REG6_LP5_BANK_MODE, reg6) << 7;
...
}
drivers/devfreq/event/rockchip-dfi.c:rockchip_dfi_v4_ddrtype_to_ctrl() {
...
case ROCKCHIP_DDRTYPE_LPDDR5:
*ctrl0 = FIELD_PREP_WM16(DDRMON_CTRL0_LPDDR23, 0) |
FIELD_PREP_WM16(DDRMON_CTRL0_LPDDR4, 0);
*ctrl1 = FIELD_PREP_WM16(DDRMON_CTRL1_LPDDR5, 1) |
FIELD_PREP_WM16(DDRMON_CTRL_LP5_BANK_MODE_MASK,
dfi->lp5_bank_mode);
break;
...
}
Because FIELD_PREP_WM16() shifts its value by the mask shift and masks it,
the pre-shifted dfi->lp5_bank_mode is shifted out of the field (in
rockchip_dfi_ddrtype_to_ctrl() as well), always programming 0 for the bank
mode while setting the wrong write-enable bits in DDRMON_CTRL1 on RK3576,
which causes inaccurate DDRMON counter readings on LPDDR5 boards.
> + .stride = 0x10000,
> + .max_channels = 2,
[Severity: Medium]
Can pairing max_channels = 2 with rk3588_dfi_init() cause
rockchip_ddr_perf_event_get_count() to read uninitialized stack memory when
PERF_EVENT_READ_BYTES2, PERF_EVENT_WRITE_BYTES2, PERF_EVENT_READ_BYTES3 or
PERF_EVENT_WRITE_BYTES3 are sampled on RK3576?
In rockchip_ddr_perf_event_get_count(), total and now are declared on the
stack without zero-initialization, and rockchip_ddr_perf_counters_add()
only populates total.c[0..max_channels - 1]. Unlike rk3399_dfi_init() and
rk3568_dfi_init(), rk3588_dfi_init() unconditionally sets non-zero
dfi->buswidth[2] and dfi->buswidth[3], so reading the channel 2 or 3 byte
perf events multiplies uninitialized total.c[2..3] stack values by
blen * dfi->buswidth[2..3] and returns garbage counts. In addition,
rockchip_ddr_perf_counters_add() reads now->c[i] without checking
dfi->channel_mask even though rockchip_dfi_read_counters() skips disabled
channels.
> + .clk_names = rk3576_clk_names,
> + .num_clks = ARRAY_SIZE(rk3576_clk_names),
[Severity: Low]
The kernel-doc comment for struct rockchip_dfi_variant documents @num_clk
instead of @num_clks, which triggers a scripts/kernel-doc warning under W=1
builds.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261117-rockchip-dfi-rk3588-cleanups-and-rk3576-support-v3-0-32ff1546b0e4@collabora.com?part=9
prev parent reply other threads:[~2026-11-17 15:54 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 15:35 [PATCH v3 0/9] PM / devfreq: rockchip-dfi: cleanups and RK3576 support Sebastian Reichel
2026-11-17 15:35 ` [PATCH v3 1/9] dt-bindings: devfreq: event: rockchip,dfi: add clocks to rk3588 Sebastian Reichel
2026-11-17 15:35 ` [PATCH v3 2/9] dt-bindings: devfreq: event: rockchip,dfi: add rk3576 Sebastian Reichel
2026-11-17 15:42 ` sashiko-bot
2026-11-17 15:35 ` [PATCH v3 3/9] PM / devfreq: rockchip-dfi: move to per-variant const structs Sebastian Reichel
2026-11-17 15:35 ` [PATCH v3 4/9] PM / devfreq: rockchip-dfi: add NO_INTERRUPT perf capability Sebastian Reichel
2026-11-17 15:35 ` [PATCH v3 5/9] PM / devfreq: rockchip-dfi: use bulk clock APIs Sebastian Reichel
2026-11-17 15:35 ` [PATCH v3 6/9] PM / devfreq: rockchip-dfi: make RK3588 use its clocks Sebastian Reichel
2026-11-17 15:48 ` sashiko-bot
2026-11-17 15:35 ` [PATCH v3 7/9] PM / devfreq: rockchip-dfi: move register offsets to variant struct Sebastian Reichel
2026-11-17 15:35 ` [PATCH v3 8/9] PM / devfreq: rockchip-dfi: prepare support for v4 DDRMON Sebastian Reichel
2026-11-17 15:49 ` sashiko-bot
2026-11-17 15:35 ` [PATCH v3 9/9] PM / devfreq: rockchip-dfi: add RK3576 support Sebastian Reichel
2026-11-17 15:54 ` sashiko-bot [this message]
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-219117@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=robh@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox