Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] firmware: arm_scmi: Don't mark OPPs as turbo without a sustained frequency
@ 2026-11-21  0:56 Dale Whinham
  2026-11-23 10:26 ` Sudeep Holla
  0 siblings, 1 reply; 2+ messages in thread
From: Dale Whinham @ 2026-11-21  0:56 UTC (permalink / raw)
  To: Sudeep Holla, Cristian Marussi, Viresh Kumar, Sibi Sankar,
	Dhruva Gole
  Cc: Haipeng Lin, arm-scmi, linux-arm-kernel, linux-kernel, stable,
	Dale Whinham

If the firmware reports a sustained frequency of 0, every OPP is marked
as turbo. With boost disabled, cpufreq then has no usable frequencies and
fails to create a policy for the domain.

The Surface Pro 11 (X1P64100) CPUCP firmware does this for the two
clusters that have a core fused off.

Treat 0 as "not provided" and don't mark any OPPs as turbo.

Fixes: a897575e79d7 ("firmware: arm_scmi: Add support for marking certain frequencies as turbo")
Cc: stable@vger.kernel.org
Tested-by: Haipeng Lin <jimmie.lin@gmail.com>
Signed-off-by: Dale Whinham <daleyo@gmail.com>
---
From decompiling the CPUCP firmware: it reports as sustained the first
LUT entry rated for exactly the cluster's fused core count, or 0 if
there is none. On X1P64100, clusters 1 and 2 have 3 cores but only
4-core LUT entries, so they get 0. X1E80100 reports non-zero values and
is unaffected.
---
 drivers/firmware/arm_scmi/perf.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c
index 0116ffb2b279..d4394984a0f5 100644
--- a/drivers/firmware/arm_scmi/perf.c
+++ b/drivers/firmware/arm_scmi/perf.c
@@ -879,8 +879,13 @@ static int scmi_dvfs_device_opps_add(const struct scmi_protocol_handle *ph,
 		else
 			freq = dom->opp[idx].indicative_freq * dom->mult_factor;
 
-		/* All OPPs above the sustained frequency are treated as turbo */
-		data.turbo = freq > dom->sustained_freq_khz * 1000UL;
+		/*
+		 * All OPPs above the sustained frequency are treated as turbo.
+		 * A sustained frequency of 0 means the firmware didn't provide
+		 * one, so don't mark anything as turbo in that case.
+		 */
+		data.turbo = dom->sustained_freq_khz &&
+			     freq > dom->sustained_freq_khz * 1000UL;
 
 		data.level = dom->opp[idx].perf;
 		data.freq = freq;

---
base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3
change-id: 20261121-sp11-noturbo-becde22ce314

Best regards,
--  
Dale Whinham <daleyo@gmail.com>



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

* Re: [PATCH] firmware: arm_scmi: Don't mark OPPs as turbo without a sustained frequency
  2026-11-21  0:56 [PATCH] firmware: arm_scmi: Don't mark OPPs as turbo without a sustained frequency Dale Whinham
@ 2026-11-23 10:26 ` Sudeep Holla
  0 siblings, 0 replies; 2+ messages in thread
From: Sudeep Holla @ 2026-11-23 10:26 UTC (permalink / raw)
  To: Dale Whinham
  Cc: Cristian Marussi, Viresh Kumar, Sibi Sankar, Dhruva Gole,
	Haipeng Lin, Sudeep Holla, Charlie Garner, arm-scmi,
	linux-arm-kernel, linux-kernel, stable

On Sat, Nov 21, 2026 at 12:56:02AM +0000, Dale Whinham wrote:
> If the firmware reports a sustained frequency of 0, every OPP is marked
> as turbo. With boost disabled, cpufreq then has no usable frequencies and
> fails to create a policy for the domain.
> 
> The Surface Pro 11 (X1P64100) CPUCP firmware does this for the two
> clusters that have a core fused off.
> 
> Treat 0 as "not provided" and don't mark any OPPs as turbo.
> 

Charlie had posted a fix for this a while ago but never got back to my
comments.[1]

> Fixes: a897575e79d7 ("firmware: arm_scmi: Add support for marking certain frequencies as turbo")
> Cc: stable@vger.kernel.org
> Tested-by: Haipeng Lin <jimmie.lin@gmail.com>
> Signed-off-by: Dale Whinham <daleyo@gmail.com>
> ---
> From decompiling the CPUCP firmware: it reports as sustained the first
> LUT entry rated for exactly the cluster's fused core count, or 0 if
> there is none. On X1P64100, clusters 1 and 2 have 3 cores but only
> 4-core LUT entries, so they get 0. X1E80100 reports non-zero values and
> is unaffected.
> ---
>  drivers/firmware/arm_scmi/perf.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c
> index 0116ffb2b279..d4394984a0f5 100644
> --- a/drivers/firmware/arm_scmi/perf.c
> +++ b/drivers/firmware/arm_scmi/perf.c
> @@ -879,8 +879,13 @@ static int scmi_dvfs_device_opps_add(const struct scmi_protocol_handle *ph,
>  		else
>  			freq = dom->opp[idx].indicative_freq * dom->mult_factor;
>  
> -		/* All OPPs above the sustained frequency are treated as turbo */
> -		data.turbo = freq > dom->sustained_freq_khz * 1000UL;
> +		/*
> +		 * All OPPs above the sustained frequency are treated as turbo.
> +		 * A sustained frequency of 0 means the firmware didn't provide
> +		 * one, so don't mark anything as turbo in that case.
> +		 */
> +		data.turbo = dom->sustained_freq_khz &&
> +			     freq > dom->sustained_freq_khz * 1000UL;

I worked out something very similar as a solution. Anyways does it work
if we also add the check for non-zero dom->sustained_perf_level ?

No need to repost if you agree, I will fix it up while applying ?

-- 
Regards,
Sudeep

[1] https://lore.kernel.org/arm-scmi/20260923152245.44624-1-charlie@akao.au


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

end of thread, other threads:[~2026-11-23 10:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-21  0:56 [PATCH] firmware: arm_scmi: Don't mark OPPs as turbo without a sustained frequency Dale Whinham
2026-11-23 10:26 ` Sudeep Holla

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