Skip to content

Commit 3ac757e

Browse files
committed
cpufreq/amd-pstate: Push adjust_perf vfunc init into cpu_init
As the driver can be changed in and out of different modes it's possible that adjust_perf is assigned when it shouldn't be. This could happen if an MSR design is started up in passive mode and then switches to active mode. To solve this explicitly clear `adjust_perf` in amd_pstate_epp_cpu_init(). Tested-by: Klara Modin <[email protected]> Tested-by: Dhananjay Ugwekar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mario Limonciello <[email protected]>
1 parent a6960e6 commit 3ac757e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/cpufreq/amd-pstate.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,6 +1504,8 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy)
15041504
WRITE_ONCE(cpudata->cppc_cap1_cached, value);
15051505
}
15061506

1507+
current_pstate_driver->adjust_perf = NULL;
1508+
15071509
return 0;
15081510

15091511
free_cpudata1:
@@ -1866,8 +1868,6 @@ static int __init amd_pstate_init(void)
18661868
/* capability check */
18671869
if (cpu_feature_enabled(X86_FEATURE_CPPC)) {
18681870
pr_debug("AMD CPPC MSR based functionality is supported\n");
1869-
if (cppc_state != AMD_PSTATE_ACTIVE)
1870-
current_pstate_driver->adjust_perf = amd_pstate_adjust_perf;
18711871
} else {
18721872
pr_debug("AMD CPPC shared memory based functionality is supported\n");
18731873
static_call_update(amd_pstate_cppc_enable, shmem_cppc_enable);

0 commit comments

Comments
 (0)