Skip to content

Commit 528dde6

Browse files
committed
cpufreq: intel_pstate: Add and use hybrid_get_cpu_type()
Introduce a function for identifying the type of a given CPU in a hybrid system, called hybrid_get_cpu_type(), and use if for hybrid scaling factor determination in hwp_get_cpu_scaling(). Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://patch.msgid.link/1954386.tdWV9SEqCh@rafael.j.wysocki
1 parent 6db0f53 commit 528dde6

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

drivers/cpufreq/intel_pstate.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -912,6 +912,11 @@ static struct freq_attr *hwp_cpufreq_attrs[] = {
912912
[HWP_CPUFREQ_ATTR_COUNT] = NULL,
913913
};
914914

915+
static u8 hybrid_get_cpu_type(unsigned int cpu)
916+
{
917+
return cpu_data(cpu).topo.intel_type;
918+
}
919+
915920
static bool no_cas __ro_after_init;
916921

917922
static struct cpudata *hybrid_max_perf_cpu __read_mostly;
@@ -2298,18 +2303,14 @@ static int knl_get_turbo_pstate(int cpu)
22982303
static int hwp_get_cpu_scaling(int cpu)
22992304
{
23002305
if (hybrid_scaling_factor) {
2301-
struct cpuinfo_x86 *c = &cpu_data(cpu);
2302-
u8 cpu_type = c->topo.intel_type;
2303-
23042306
/*
23052307
* Return the hybrid scaling factor for P-cores and use the
23062308
* default core scaling for E-cores.
23072309
*/
2308-
if (cpu_type == INTEL_CPU_TYPE_CORE)
2310+
if (hybrid_get_cpu_type(cpu) == INTEL_CPU_TYPE_CORE)
23092311
return hybrid_scaling_factor;
23102312

2311-
if (cpu_type == INTEL_CPU_TYPE_ATOM)
2312-
return core_get_scaling();
2313+
return core_get_scaling();
23132314
}
23142315

23152316
/* Use core scaling on non-hybrid systems. */

0 commit comments

Comments
 (0)