Skip to content

Commit 3d13058

Browse files
spandruvadarafaeljw
authored andcommitted
cpufreq: intel_pstate: Use firmware default EPP
For some specific platforms (E.g. AlderLake) the balance performance EPP is updated from the hard coded value in the driver. This acts as the default and balance_performance EPP. The purpose of this EPP update is to reach maximum 1 core turbo frequency (when possible) out of the box. Although we can achieve the objective by using hard coded value in the driver, there can be other EPP which can be better in terms of power. But that will be very subjective based on platform and use cases. This is not practical to have a per platform specific default hard coded in the driver. If a platform wants to specify default EPP, it can be set in the firmware. If this EPP is not the chipset default of 0x80 (balance_perf_epp unless driver changed it) and more performance oriented but not 0, the driver can use this as the default and balanced_perf EPP. In this case no driver update is required every time there is some new platform and default EPP. If the firmware didn't update the EPP from the chipset default then the hard coded value is used as per existing implementation. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 85750bc commit 3d13058

1 file changed

Lines changed: 32 additions & 6 deletions

File tree

drivers/cpufreq/intel_pstate.c

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,6 +1692,37 @@ static void intel_pstate_enable_hwp_interrupt(struct cpudata *cpudata)
16921692
}
16931693
}
16941694

1695+
static void intel_pstate_update_epp_defaults(struct cpudata *cpudata)
1696+
{
1697+
cpudata->epp_default = intel_pstate_get_epp(cpudata, 0);
1698+
1699+
/*
1700+
* If this CPU gen doesn't call for change in balance_perf
1701+
* EPP return.
1702+
*/
1703+
if (epp_values[EPP_INDEX_BALANCE_PERFORMANCE] == HWP_EPP_BALANCE_PERFORMANCE)
1704+
return;
1705+
1706+
/*
1707+
* If powerup EPP is something other than chipset default 0x80 and
1708+
* - is more performance oriented than 0x80 (default balance_perf EPP)
1709+
* - But less performance oriented than performance EPP
1710+
* then use this as new balance_perf EPP.
1711+
*/
1712+
if (cpudata->epp_default < HWP_EPP_BALANCE_PERFORMANCE &&
1713+
cpudata->epp_default > HWP_EPP_PERFORMANCE) {
1714+
epp_values[EPP_INDEX_BALANCE_PERFORMANCE] = cpudata->epp_default;
1715+
return;
1716+
}
1717+
1718+
/*
1719+
* Use hard coded value per gen to update the balance_perf
1720+
* and default EPP.
1721+
*/
1722+
cpudata->epp_default = epp_values[EPP_INDEX_BALANCE_PERFORMANCE];
1723+
intel_pstate_set_epp(cpudata, cpudata->epp_default);
1724+
}
1725+
16951726
static void intel_pstate_hwp_enable(struct cpudata *cpudata)
16961727
{
16971728
/* First disable HWP notification interrupt till we activate again */
@@ -1705,12 +1736,7 @@ static void intel_pstate_hwp_enable(struct cpudata *cpudata)
17051736
if (cpudata->epp_default >= 0)
17061737
return;
17071738

1708-
if (epp_values[EPP_INDEX_BALANCE_PERFORMANCE] == HWP_EPP_BALANCE_PERFORMANCE) {
1709-
cpudata->epp_default = intel_pstate_get_epp(cpudata, 0);
1710-
} else {
1711-
cpudata->epp_default = epp_values[EPP_INDEX_BALANCE_PERFORMANCE];
1712-
intel_pstate_set_epp(cpudata, cpudata->epp_default);
1713-
}
1739+
intel_pstate_update_epp_defaults(cpudata);
17141740
}
17151741

17161742
static int atom_get_min_pstate(void)

0 commit comments

Comments
 (0)