From: Heiko Stuebner <heiko@sntech.de>
To: Philipp Zabel <p.zabel@pengutronix.de>
Cc: linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org,
Steven Price <steven.price@arm.com>,
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Subject: Re: [PATCH] ARM: rockchip: keep reset control around
Date: Fri, 22 May 2026 10:43:09 +0200 [thread overview]
Message-ID: <4223462.bcXerOTE6V@phil> (raw)
In-Reply-To: <74844de05ed99d29424ba71e3c625020afdddf61.camel@pengutronix.de>
Am Freitag, 22. Mai 2026, 10:20:06 Mitteleuropäische Sommerzeit schrieb Philipp Zabel:
> On Fr, 2026-05-22 at 09:20 +0200, Heiko Stuebner wrote:
> > Am Donnerstag, 21. Mai 2026, 23:09:15 Mitteleuropäische Sommerzeit schrieb Heiko Stuebner:
> > > Do not put the reset control, retain exclusive control over it.
> > > After turning on a CPU, the corresponding reset line must stay
> > > deasserted.
> > >
> > > This also avoids calling reset_control_put() before workqueues
> > > are operational.
> > >
> > > Fixes: 78ebbff6d1a0 ("reset: handle removing supplier before consumers")
> > > Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> > > Tested-by: Steven Price <steven.price@arm.com>
> > > Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> > > ---
> > > arch/arm/mach-rockchip/platsmp.c | 16 ++++++++++------
> > > 1 file changed, 10 insertions(+), 6 deletions(-)
> > >
> > > diff --git a/arch/arm/mach-rockchip/platsmp.c b/arch/arm/mach-rockchip/platsmp.c
> > > index f432d22bfed8..f659d894bfae 100644
> > > --- a/arch/arm/mach-rockchip/platsmp.c
> > > +++ b/arch/arm/mach-rockchip/platsmp.c
> > > @@ -34,6 +34,7 @@ static int ncores;
> > >
> > > static struct regmap *pmu;
> > > static int has_pmu = true;
> > > +static struct reset_control *cpu_rstc[4];
> >
> > After sleeping on that, this should be cpu_rstc[5];
> >
> > Coretx-A9 SoCs need to enable the SCU power-domain which thankfully
> > sits at index 4 of the power-domain register.
> >
> > So while we (already) expect no reset control for that, we need at least
> > make sure, it's not reading into undefined memory
>
> The access in pmu_set_power_domain() is gated by
> (pd < ARRAY_SIZE(cpu_rstc)). And ncores in rockchip_smp_prepare_cpus()
> can not be larger than 4.
argh ... you're right of course. So the patch can stay as it is.
Should not think about code before going to sleep ;-)
Heiko
> > and thus need that empty field in the array.
>
> We could drop the ARRAY_SIZE check and add a placeholder to the array,
> but it would need to be set to ERR_PTR(-EINVAL). Otherwise we'd have to
> replace all the IS_ERR(rstc) checks as well. I think that would be a
> good follow-up change.
>
> regards
> Philipp
>
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
WARNING: multiple messages have this Message-ID (diff)
From: Heiko Stuebner <heiko@sntech.de>
To: Philipp Zabel <p.zabel@pengutronix.de>
Cc: linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org,
Steven Price <steven.price@arm.com>,
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Subject: Re: [PATCH] ARM: rockchip: keep reset control around
Date: Fri, 22 May 2026 10:43:09 +0200 [thread overview]
Message-ID: <4223462.bcXerOTE6V@phil> (raw)
In-Reply-To: <74844de05ed99d29424ba71e3c625020afdddf61.camel@pengutronix.de>
Am Freitag, 22. Mai 2026, 10:20:06 Mitteleuropäische Sommerzeit schrieb Philipp Zabel:
> On Fr, 2026-05-22 at 09:20 +0200, Heiko Stuebner wrote:
> > Am Donnerstag, 21. Mai 2026, 23:09:15 Mitteleuropäische Sommerzeit schrieb Heiko Stuebner:
> > > Do not put the reset control, retain exclusive control over it.
> > > After turning on a CPU, the corresponding reset line must stay
> > > deasserted.
> > >
> > > This also avoids calling reset_control_put() before workqueues
> > > are operational.
> > >
> > > Fixes: 78ebbff6d1a0 ("reset: handle removing supplier before consumers")
> > > Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> > > Tested-by: Steven Price <steven.price@arm.com>
> > > Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> > > ---
> > > arch/arm/mach-rockchip/platsmp.c | 16 ++++++++++------
> > > 1 file changed, 10 insertions(+), 6 deletions(-)
> > >
> > > diff --git a/arch/arm/mach-rockchip/platsmp.c b/arch/arm/mach-rockchip/platsmp.c
> > > index f432d22bfed8..f659d894bfae 100644
> > > --- a/arch/arm/mach-rockchip/platsmp.c
> > > +++ b/arch/arm/mach-rockchip/platsmp.c
> > > @@ -34,6 +34,7 @@ static int ncores;
> > >
> > > static struct regmap *pmu;
> > > static int has_pmu = true;
> > > +static struct reset_control *cpu_rstc[4];
> >
> > After sleeping on that, this should be cpu_rstc[5];
> >
> > Coretx-A9 SoCs need to enable the SCU power-domain which thankfully
> > sits at index 4 of the power-domain register.
> >
> > So while we (already) expect no reset control for that, we need at least
> > make sure, it's not reading into undefined memory
>
> The access in pmu_set_power_domain() is gated by
> (pd < ARRAY_SIZE(cpu_rstc)). And ncores in rockchip_smp_prepare_cpus()
> can not be larger than 4.
argh ... you're right of course. So the patch can stay as it is.
Should not think about code before going to sleep ;-)
Heiko
> > and thus need that empty field in the array.
>
> We could drop the ARRAY_SIZE check and add a placeholder to the array,
> but it would need to be set to ERR_PTR(-EINVAL). Otherwise we'd have to
> replace all the IS_ERR(rstc) checks as well. I think that would be a
> good follow-up change.
>
> regards
> Philipp
>
next prev parent reply other threads:[~2026-05-22 8:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-21 21:09 [PATCH] ARM: rockchip: keep reset control around Heiko Stuebner
2026-05-21 21:09 ` Heiko Stuebner
2026-05-21 21:13 ` Heiko Stuebner
2026-05-21 21:13 ` Heiko Stuebner
2026-05-22 7:20 ` Heiko Stuebner
2026-05-22 7:20 ` Heiko Stuebner
2026-05-22 8:20 ` Philipp Zabel
2026-05-22 8:20 ` Philipp Zabel
2026-05-22 8:43 ` Heiko Stuebner [this message]
2026-05-22 8:43 ` Heiko Stuebner
2026-05-26 21:21 ` Heiko Stuebner
2026-05-26 21:21 ` Heiko Stuebner
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=4223462.bcXerOTE6V@phil \
--to=heiko@sntech.de \
--cc=bartosz.golaszewski@oss.qualcomm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=p.zabel@pengutronix.de \
--cc=steven.price@arm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.