Linux Power Management development
 help / color / mirror / Atom feed
From: Henry Tseng <henrytseng@qnap.com>
To: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Len Brown <lenb@kernel.org>,
	Viresh Kumar <viresh.kumar@linaro.org>
Cc: linux-pm@vger.kernel.org, SW Chen <swchen@qnap.com>,
	Kevin Ko <kevinko@qnap.com>, Henry Tseng <henrytseng@qnap.com>
Subject: Re: [PATCH] cpufreq: intel_pstate: Use CPPC to get scaling factor for Bartlett Lake
Date: Thu,  7 May 2026 17:25:54 +0800	[thread overview]
Message-ID: <20260507092554.2631883-1-henrytseng@qnap.com> (raw)
In-Reply-To: <7d47a806110c750c47c4b473f45eff6d7f3ebc18.camel@linux.intel.com>

On Wed, 06 May 2026 05:15:49 -0700, Srinivas Pandruvada wrote:
> This is a special embedded processor, so to reduce enabling effort by 
> in BIOS, why not just add
> 
> diff --git a/drivers/cpufreq/intel_pstate.c
> b/drivers/cpufreq/intel_pstate.c
> index ec4abe374573..763598ca13cd 100644
> --- a/drivers/cpufreq/intel_pstate.c
> +++ b/drivers/cpufreq/intel_pstate.c
> @@ -3732,6 +3732,7 @@ static const struct x86_cpu_id
> intel_hybrid_scaling_factor[] = {
>         X86_MATCH_VFM(INTEL_RAPTORLAKE, HYBRID_SCALING_FACTOR_ADL),
>         X86_MATCH_VFM(INTEL_RAPTORLAKE_P, HYBRID_SCALING_FACTOR_ADL),
>         X86_MATCH_VFM(INTEL_RAPTORLAKE_S, HYBRID_SCALING_FACTOR_ADL),
> +       X86_MATCH_VFM(INTEL_BARTLETTLAKE, HYBRID_SCALING_FACTOR_ADL),
>         X86_MATCH_VFM(INTEL_METEORLAKE_L, HYBRID_SCALING_FACTOR_MTL),
>         X86_MATCH_VFM(INTEL_LUNARLAKE_M, HYBRID_SCALING_FACTOR_LNL),
>         {}
> 
> CPPC scaling introduces rounding issues for some frequency. This will
> avoid introducing another CPU model list.

Thanks for the review, the static table is definitely simpler. I had
referenced commit 9b18d536b124 and went with CPPC, but I take your point
about the rounding issues.

After adding INTEL_BARTLETTLAKE to intel_hybrid_scaling_factor[], I
noticed hwp_get_cpu_scaling() still falls back to core_get_scaling() on
273PE, because hybrid_get_cpu_type() returns 0 (not INTEL_CPU_TYPE_CORE)
on a non-hybrid CPU, so the table value doesn't get picked up. I added a
check for X86_FEATURE_HYBRID_CPU there to let non-hybrid CPUs in the table
use hybrid_scaling_factor.

I also kept hwp_is_hybrid = 0 on 273PE to match the current mainline
behavior on non-hybrid CPUs.

Draft below, based on v7.1-rc2 (7fd2df204f34), tested on Intel Core 9
273PE:

diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 1292da53e5fc..b66455252745 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -585,7 +585,7 @@ static void intel_pstate_hybrid_hwp_adjust(struct cpudata *cpu)
 	if (scaling == perf_ctl_scaling)
 		return;
 
-	hwp_is_hybrid = true;
+	hwp_is_hybrid = cpu_feature_enabled(X86_FEATURE_HYBRID_CPU);
 
 	cpu->pstate.turbo_freq = rounddown(cpu->pstate.turbo_pstate * scaling,
 					   perf_ctl_scaling);
@@ -2279,7 +2279,8 @@ static int hwp_get_cpu_scaling(int cpu)
 		 * Return the hybrid scaling factor for P-cores and use the
 		 * default core scaling for E-cores.
 		 */
-		if (hybrid_get_cpu_type(cpu) == INTEL_CPU_TYPE_CORE)
+		if (hybrid_get_cpu_type(cpu) == INTEL_CPU_TYPE_CORE ||
+		    !cpu_feature_enabled(X86_FEATURE_HYBRID_CPU))
 			return hybrid_scaling_factor;
 
 		return core_get_scaling();
@@ -3734,6 +3735,7 @@ static const struct x86_cpu_id intel_hybrid_scaling_factor[] = {
 	X86_MATCH_VFM(INTEL_RAPTORLAKE, HYBRID_SCALING_FACTOR_ADL),
 	X86_MATCH_VFM(INTEL_RAPTORLAKE_P, HYBRID_SCALING_FACTOR_ADL),
 	X86_MATCH_VFM(INTEL_RAPTORLAKE_S, HYBRID_SCALING_FACTOR_ADL),
+	X86_MATCH_VFM(INTEL_BARTLETTLAKE, HYBRID_SCALING_FACTOR_ADL),
 	X86_MATCH_VFM(INTEL_METEORLAKE_L, HYBRID_SCALING_FACTOR_MTL),
 	X86_MATCH_VFM(INTEL_LUNARLAKE_M, HYBRID_SCALING_FACTOR_LNL),
 	{}

Result on 273PE:

  intel_pstate: CPU0:  HWP_CAP highest = 70, scaling = 78741, cpuinfo.max = 5500000
  intel_pstate: CPU12: HWP_CAP highest = 73, scaling = 78741, cpuinfo.max = 5700000

If this direction looks OK, I'll send a v2 with a proper commit message.

Thanks,
Henry

  reply	other threads:[~2026-05-07  9:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-06  9:51 [PATCH] cpufreq: intel_pstate: Use CPPC to get scaling factor for Bartlett Lake Henry Tseng
2026-05-06 12:15 ` srinivas pandruvada
2026-05-07  9:25   ` Henry Tseng [this message]
2026-05-07 14:47     ` srinivas pandruvada
2026-05-08  6:37       ` Henry Tseng

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=20260507092554.2631883-1-henrytseng@qnap.com \
    --to=henrytseng@qnap.com \
    --cc=kevinko@qnap.com \
    --cc=lenb@kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=srinivas.pandruvada@linux.intel.com \
    --cc=swchen@qnap.com \
    --cc=viresh.kumar@linaro.org \
    /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