Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
* [PATCH] remoteproc: qcom_wcnss: Fix handling the lack of PD regulators in v3
@ 2026-01-26 23:44 Val Packett
  2026-01-27 13:06 ` Konrad Dybcio
  0 siblings, 1 reply; 2+ messages in thread
From: Val Packett @ 2026-01-26 23:44 UTC (permalink / raw)
  To: Bjorn Andersson, Mathieu Poirier, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt,
	Matti Lehtimäki, Luca Weiss
  Cc: Val Packett, Vladimir Lypak, Barnabás Czémán,
	Konrad Dybcio, Dmitry Baryshkov, ~postmarketos/upstreaming, linux,
	phone-devel, linux-arm-msm, devicetree, linux-kernel,
	linux-remoteproc, llvm

The changes introduced to handle single power domain platforms have
swapped the info pointer increment from num_pd_vregs to num_pds, which
doesn't change anything for pronto-v1 and v2 where they match, but as
pronto-v3 has 2 power domains with no PD regulators at all, this would
shift the pointer past the end of the array.

This showed up as a difference between GCC- and LLVM-compiled kernels
on MSM8953/SDM632 devices, where only with LLVM one would get the
"regulator request with no identifier" error, because the out-of-bounds
memory ended up being zeroed. Fix by reverting that single line.

Fixes: 65991ea8a6d1 ("remoteproc: qcom_wcnss: Handle platforms with only single power domain")
Signed-off-by: Val Packett <val@packett.cool>
---

I'm like 99% sure that this (old) line is correct and the change in this one line
in 65991ea8a6d1 might've been an unintentional/stray one.

Still, please retest on MSM8974/MSM8226!

Thanks,
~val
---
 drivers/remoteproc/qcom_wcnss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/remoteproc/qcom_wcnss.c b/drivers/remoteproc/qcom_wcnss.c
index ee18bf2e8054..5884c5a52af6 100644
--- a/drivers/remoteproc/qcom_wcnss.c
+++ b/drivers/remoteproc/qcom_wcnss.c
@@ -454,7 +454,7 @@ static int wcnss_init_regulators(struct qcom_wcnss *wcnss,
 	 * reserve extra space to manage them through the regulator interface.
 	 */
 	if (wcnss->num_pds) {
-		info += wcnss->num_pds;
+		info += num_pd_vregs;
 		/* Handle single power domain case */
 		if (wcnss->num_pds < num_pd_vregs)
 			num_vregs += num_pd_vregs - wcnss->num_pds;
-- 
2.51.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] remoteproc: qcom_wcnss: Fix handling the lack of PD regulators in v3
  2026-01-26 23:44 [PATCH] remoteproc: qcom_wcnss: Fix handling the lack of PD regulators in v3 Val Packett
@ 2026-01-27 13:06 ` Konrad Dybcio
  0 siblings, 0 replies; 2+ messages in thread
From: Konrad Dybcio @ 2026-01-27 13:06 UTC (permalink / raw)
  To: Val Packett, Bjorn Andersson, Mathieu Poirier, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt,
	Matti Lehtimäki, Luca Weiss
  Cc: Vladimir Lypak, Barnabás Czémán, Dmitry Baryshkov,
	~postmarketos/upstreaming, linux, phone-devel, linux-arm-msm,
	devicetree, linux-kernel, linux-remoteproc, llvm

On 1/27/26 12:44 AM, Val Packett wrote:
> The changes introduced to handle single power domain platforms have
> swapped the info pointer increment from num_pd_vregs to num_pds, which
> doesn't change anything for pronto-v1 and v2 where they match, but as
> pronto-v3 has 2 power domains with no PD regulators at all, this would
> shift the pointer past the end of the array.
> 
> This showed up as a difference between GCC- and LLVM-compiled kernels
> on MSM8953/SDM632 devices, where only with LLVM one would get the
> "regulator request with no identifier" error, because the out-of-bounds
> memory ended up being zeroed. Fix by reverting that single line.
> 
> Fixes: 65991ea8a6d1 ("remoteproc: qcom_wcnss: Handle platforms with only single power domain")
> Signed-off-by: Val Packett <val@packett.cool>
> ---
> 
> I'm like 99% sure that this (old) line is correct and the change in this one line
> in 65991ea8a6d1 might've been an unintentional/stray one.
> 
> Still, please retest on MSM8974/MSM8226!
> 
> Thanks,
> ~val
> ---
>  drivers/remoteproc/qcom_wcnss.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/remoteproc/qcom_wcnss.c b/drivers/remoteproc/qcom_wcnss.c
> index ee18bf2e8054..5884c5a52af6 100644
> --- a/drivers/remoteproc/qcom_wcnss.c
> +++ b/drivers/remoteproc/qcom_wcnss.c
> @@ -454,7 +454,7 @@ static int wcnss_init_regulators(struct qcom_wcnss *wcnss,
>  	 * reserve extra space to manage them through the regulator interface.
>  	 */
>  	if (wcnss->num_pds) {
> -		info += wcnss->num_pds;
> +		info += num_pd_vregs;

The existing code is correct in that it skips the wcnss->num_pds
(i.e. "the number of PDs Linux managed to successfully attach to"), out
of the vregs table (which on all-but-pronto_v3_data is a superset of the
PD list, since 15 years ago the regulator framework was used to represent
all power-related RPM resources)

I believe the correct diff would be to check if the length of .pd_names
is >= the length of .vregs and say that it's the backwards-compat case
(which again, pronto_v3 isn't concerned by)

Konrad

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-01-27 13:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-26 23:44 [PATCH] remoteproc: qcom_wcnss: Fix handling the lack of PD regulators in v3 Val Packett
2026-01-27 13:06 ` Konrad Dybcio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox