* [PATCH v4 03/11] PM / devfreq: rockchip-dfi: drop incorrect shift of LP5 bank mode
2026-11-19 13:01 [PATCH v4 00/11] PM / devfreq: rockchip-dfi: cleanups and RK3576 support Sebastian Reichel
@ 2026-11-19 13:01 ` Sebastian Reichel
2026-11-19 13:01 ` [PATCH v4 04/11] PM / devfreq: rockchip-dfi: initialize dmc_count structs Sebastian Reichel
2026-11-26 13:28 ` [PATCH v4 00/11] PM / devfreq: rockchip-dfi: cleanups and RK3576 support Chanwoo Choi
2 siblings, 0 replies; 5+ messages in thread
From: Sebastian Reichel @ 2026-11-19 13:01 UTC (permalink / raw)
To: Chanwoo Choi, MyungJoo Ham, Kyungmin Park, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner, Sascha Hauer
Cc: Nicolas Frattaroli, linux-pm, devicetree, linux-arm-kernel,
linux-rockchip, linux-kernel, kernel, Sebastian Reichel, Sashiko,
stable
When the driver got converted to the FIELD_PREP_WM16 macro, it was
missed that the lp5_bank_mode variable is already shifted in
rk3588_dfi_init() resulting in FIELD_PREP_WM16() effectively doing a
double shift and thus writing 0.
As most Rockchip boards use LPDDR4 (incl. all of mine) and DFI is more
or less exclusively used for debugging with upstream kernel so far, this
hasn't been noticed until now.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/all/sashiko-outbox-219117@kernel.org/
Cc: stable@vger.kernel.org
Fixes: 7e85ac9da1ac ("PM / devfreq: rockchip-dfi: switch to FIELD_PREP_WM16 macro")
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
drivers/devfreq/event/rockchip-dfi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/devfreq/event/rockchip-dfi.c b/drivers/devfreq/event/rockchip-dfi.c
index e0b942028e50..22f82cb6e33f 100644
--- a/drivers/devfreq/event/rockchip-dfi.c
+++ b/drivers/devfreq/event/rockchip-dfi.c
@@ -800,7 +800,7 @@ static int rk3588_dfi_init(struct rockchip_dfi *dfi)
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;
+ dfi->lp5_bank_mode = FIELD_GET(RK3588_PMUGRF_OS_REG6_LP5_BANK_MODE, reg6);
dfi->lp5_ckr = FIELD_GET(RK3588_PMUGRF_OS_REG6_LP5_CKR, reg6);
if (dfi->lp5_ckr)
dfi->count_multiplier *= 2;
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH v4 04/11] PM / devfreq: rockchip-dfi: initialize dmc_count structs
2026-11-19 13:01 [PATCH v4 00/11] PM / devfreq: rockchip-dfi: cleanups and RK3576 support Sebastian Reichel
2026-11-19 13:01 ` [PATCH v4 03/11] PM / devfreq: rockchip-dfi: drop incorrect shift of LP5 bank mode Sebastian Reichel
@ 2026-11-19 13:01 ` Sebastian Reichel
2026-11-26 13:28 ` [PATCH v4 00/11] PM / devfreq: rockchip-dfi: cleanups and RK3576 support Chanwoo Choi
2 siblings, 0 replies; 5+ messages in thread
From: Sebastian Reichel @ 2026-11-19 13:01 UTC (permalink / raw)
To: Chanwoo Choi, MyungJoo Ham, Kyungmin Park, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner, Sascha Hauer
Cc: Nicolas Frattaroli, linux-pm, devicetree, linux-arm-kernel,
linux-rockchip, linux-kernel, kernel, Sebastian Reichel, Sashiko,
stable
Initialize 'struct dmc_count' before filling it with data by
rockchip_dfi_read_counters() or rockchip_ddr_perf_counters_add()
to avoid exposing uninitialized memory for unused channels.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/all/sashiko-outbox-219117@kernel.org/
Cc: stable@vger.kernel.org
Fixes: 4d586b5724d3 ("PM / devfreq: rockchip-dfi: Add perf support")
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
drivers/devfreq/event/rockchip-dfi.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/devfreq/event/rockchip-dfi.c b/drivers/devfreq/event/rockchip-dfi.c
index 22f82cb6e33f..d195755448e1 100644
--- a/drivers/devfreq/event/rockchip-dfi.c
+++ b/drivers/devfreq/event/rockchip-dfi.c
@@ -291,7 +291,7 @@ static int rockchip_dfi_get_event(struct devfreq_event_dev *edev,
struct devfreq_event_data *edata)
{
struct rockchip_dfi *dfi = devfreq_event_get_drvdata(edev);
- struct dmc_count count;
+ struct dmc_count count = {};
struct dmc_count *last = &dfi->last_event_count;
u32 access = 0, clock_cycles = 0;
int i;
@@ -462,7 +462,7 @@ static u64 rockchip_ddr_perf_event_get_count(struct perf_event *event)
{
struct rockchip_dfi *dfi = container_of(event->pmu, struct rockchip_dfi, pmu);
int blen = dfi->burst_len;
- struct dmc_count total, now;
+ struct dmc_count total = {}, now = {};
unsigned int seq;
u64 count = 0;
int i;
@@ -577,7 +577,7 @@ static void rockchip_ddr_perf_event_del(struct perf_event *event, int flags)
static enum hrtimer_restart rockchip_dfi_timer(struct hrtimer *timer)
{
struct rockchip_dfi *dfi = container_of(timer, struct rockchip_dfi, timer);
- struct dmc_count now, total;
+ struct dmc_count now = {}, total = {};
rockchip_dfi_read_counters(dfi, &now);
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH v4 00/11] PM / devfreq: rockchip-dfi: cleanups and RK3576 support
2026-11-19 13:01 [PATCH v4 00/11] PM / devfreq: rockchip-dfi: cleanups and RK3576 support Sebastian Reichel
2026-11-19 13:01 ` [PATCH v4 03/11] PM / devfreq: rockchip-dfi: drop incorrect shift of LP5 bank mode Sebastian Reichel
2026-11-19 13:01 ` [PATCH v4 04/11] PM / devfreq: rockchip-dfi: initialize dmc_count structs Sebastian Reichel
@ 2026-11-26 13:28 ` Chanwoo Choi
2026-11-26 14:22 ` Sebastian Reichel
2 siblings, 1 reply; 5+ messages in thread
From: Chanwoo Choi @ 2026-11-26 13:28 UTC (permalink / raw)
To: Sebastian Reichel, Chanwoo Choi, MyungJoo Ham, Kyungmin Park,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner,
Sascha Hauer
Cc: Nicolas Frattaroli, linux-pm, devicetree, linux-arm-kernel,
linux-rockchip, linux-kernel, kernel, Sashiko, stable
On 11/19/2026 10:01 PM, Sebastian Reichel wrote:
> This is a combination of the DFI driver patches from the following two
> series to ease applying to devfreq tree. It is based on devfreq-next
> and there are no other dependencies.
>
> * https://lore.kernel.org/linux-rockchip/20260921-rockchip-dfi-cleanup-v2-0-43ff34ac8599@collabora.com/
> * https://lore.kernel.org/linux-rockchip/20260921-b4-rockchip-dfi-rk3576-support-v2-0-04f847016321@collabora.com/
>
> Changes in PATCHv4:
> * Link to v3: https://patch.msgid.link/20261117-rockchip-dfi-rk3588-cleanups-and-rk3576-support-v3-0-32ff1546b0e4@collabora.com
> * In PATCHv3 I accidentally used the patches from PATCHv1 as base with
> the wrong DT bindings; this is now fixed
> * I've fixed num_clks typo in kernel doc (Sashiko)
> * I've fixed incorrect LPDDR5 BANK_MODE_MASK for RK3576 (Sashiko)
> * I added a fix at the start of the series correcting LPDDR5 bank
> mode value (Sashiko)
> * I've added a fix at the start of the series avoiding usage of
> uninitialized memory (Sashiko)
>
> Changes in PATCHv3:
> * split out DFI driver patches from both series and merge them into a
> new one; clock controller and DT patches will be sent separately.
> * rebase to devfreq-next
> * collecting Reviewed-by / Acked-by
>
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> ---
> Nicolas Frattaroli (6):
> dt-bindings: devfreq: event: rockchip,dfi: add clocks to rk3588
> dt-bindings: devfreq: event: rockchip,dfi: add rk3576
> PM / devfreq: rockchip-dfi: move to per-variant const structs
> PM / devfreq: rockchip-dfi: add NO_INTERRUPT perf capability
> PM / devfreq: rockchip-dfi: use bulk clock APIs
> PM / devfreq: rockchip-dfi: make RK3588 use its clocks
>
> Sebastian Reichel (5):
> PM / devfreq: rockchip-dfi: drop incorrect shift of LP5 bank mode
> PM / devfreq: rockchip-dfi: initialize dmc_count structs
> PM / devfreq: rockchip-dfi: move register offsets to variant struct
> PM / devfreq: rockchip-dfi: prepare support for v4 DDRMON
> PM / devfreq: rockchip-dfi: add RK3576 support
>
> .../bindings/devfreq/event/rockchip,dfi.yaml | 89 +++++-
> drivers/devfreq/event/rockchip-dfi.c | 297 +++++++++++++++------
> 2 files changed, 290 insertions(+), 96 deletions(-)
> ---
> base-commit: f9316c13d6f621af4f6f4a6089d3c989ffe899e6
> change-id: 20261117-rockchip-dfi-rk3588-cleanups-and-rk3576-support-74727d64d729
>
> Best regards,
> --
> Sebastian Reichel <sebastian.reichel@collabora.com>
Applied them. But you also need to send the clock patch[1] and get it applied.
[1] https://lore.kernel.org/linux-rockchip/20260921-rockchip-dfi-cleanup-v2-6-43ff34ac8599@collabora.com/
Thanks,
--
Best Regards,
Chanwoo Choi
Principal Engineer, Samsung Electronics
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v4 00/11] PM / devfreq: rockchip-dfi: cleanups and RK3576 support
2026-11-26 13:28 ` [PATCH v4 00/11] PM / devfreq: rockchip-dfi: cleanups and RK3576 support Chanwoo Choi
@ 2026-11-26 14:22 ` Sebastian Reichel
0 siblings, 0 replies; 5+ messages in thread
From: Sebastian Reichel @ 2026-11-26 14:22 UTC (permalink / raw)
To: chanwoo
Cc: Chanwoo Choi, MyungJoo Ham, Kyungmin Park, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner, Sascha Hauer,
Nicolas Frattaroli, linux-pm, devicetree, linux-arm-kernel,
linux-rockchip, linux-kernel, kernel, Sashiko, stable
[-- Attachment #1: Type: text/plain, Size: 3345 bytes --]
Hi,
On Thu, Nov 26, 2026 at 10:28:28PM +0900, Chanwoo Choi wrote:
> On 11/19/2026 10:01 PM, Sebastian Reichel wrote:
> > This is a combination of the DFI driver patches from the following two
> > series to ease applying to devfreq tree. It is based on devfreq-next
> > and there are no other dependencies.
> >
> > * https://lore.kernel.org/linux-rockchip/20260921-rockchip-dfi-cleanup-v2-0-43ff34ac8599@collabora.com/
> > * https://lore.kernel.org/linux-rockchip/20260921-b4-rockchip-dfi-rk3576-support-v2-0-04f847016321@collabora.com/
> >
> > Changes in PATCHv4:
> > * Link to v3: https://patch.msgid.link/20261117-rockchip-dfi-rk3588-cleanups-and-rk3576-support-v3-0-32ff1546b0e4@collabora.com
> > * In PATCHv3 I accidentally used the patches from PATCHv1 as base with
> > the wrong DT bindings; this is now fixed
> > * I've fixed num_clks typo in kernel doc (Sashiko)
> > * I've fixed incorrect LPDDR5 BANK_MODE_MASK for RK3576 (Sashiko)
> > * I added a fix at the start of the series correcting LPDDR5 bank
> > mode value (Sashiko)
> > * I've added a fix at the start of the series avoiding usage of
> > uninitialized memory (Sashiko)
> >
> > Changes in PATCHv3:
> > * split out DFI driver patches from both series and merge them into a
> > new one; clock controller and DT patches will be sent separately.
> > * rebase to devfreq-next
> > * collecting Reviewed-by / Acked-by
> >
> > Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> > ---
> > Nicolas Frattaroli (6):
> > dt-bindings: devfreq: event: rockchip,dfi: add clocks to rk3588
> > dt-bindings: devfreq: event: rockchip,dfi: add rk3576
> > PM / devfreq: rockchip-dfi: move to per-variant const structs
> > PM / devfreq: rockchip-dfi: add NO_INTERRUPT perf capability
> > PM / devfreq: rockchip-dfi: use bulk clock APIs
> > PM / devfreq: rockchip-dfi: make RK3588 use its clocks
> >
> > Sebastian Reichel (5):
> > PM / devfreq: rockchip-dfi: drop incorrect shift of LP5 bank mode
> > PM / devfreq: rockchip-dfi: initialize dmc_count structs
> > PM / devfreq: rockchip-dfi: move register offsets to variant struct
> > PM / devfreq: rockchip-dfi: prepare support for v4 DDRMON
> > PM / devfreq: rockchip-dfi: add RK3576 support
> >
> > .../bindings/devfreq/event/rockchip,dfi.yaml | 89 +++++-
> > drivers/devfreq/event/rockchip-dfi.c | 297 +++++++++++++++------
> > 2 files changed, 290 insertions(+), 96 deletions(-)
> > ---
> > base-commit: f9316c13d6f621af4f6f4a6089d3c989ffe899e6
> > change-id: 20261117-rockchip-dfi-rk3588-cleanups-and-rk3576-support-74727d64d729
> >
> > Best regards,
> > --
> > Sebastian Reichel <sebastian.reichel@collabora.com>
>
> Applied them. But you also need to send the clock patch[1] and get
> it applied. [1]
> https://lore.kernel.org/linux-rockchip/20260921-rockchip-dfi-cleanup-v2-6-43ff34ac8599@collabora.com/
Thanks. The clock patches (RK3588 & RK3576) as well as the DT
additions are on my TODO list. The DT side had a dependency on the
DT binding being merged first, so I was not too much in a hurry to
send them out (esp. considering nothing changed in them since v1).
I will see to send them out today.
Greetings,
-- Sebastian
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread