]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
cpufreq/amd-pstate: Push adjust_perf vfunc init into cpu_init
authorMario Limonciello <mario.limonciello@amd.com>
Mon, 28 Oct 2024 14:55:41 +0000 (09:55 -0500)
committerMario Limonciello <mario.limonciello@amd.com>
Tue, 29 Oct 2024 13:31:57 +0000 (08:31 -0500)
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 <klarasmodin@gmail.com>
Tested-by: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>
Link: https://lore.kernel.org/r/20241028145542.1739160-1-superm1@kernel.org
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
drivers/cpufreq/amd-pstate.c

index 206725219d8c9a546bff9988f8ad1347b3af43dc..e480da818d6f536af479d4e2528ee1763bbdd9c1 100644 (file)
@@ -1504,6 +1504,8 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy)
                WRITE_ONCE(cpudata->cppc_cap1_cached, value);
        }
 
+       current_pstate_driver->adjust_perf = NULL;
+
        return 0;
 
 free_cpudata1:
@@ -1866,8 +1868,6 @@ static int __init amd_pstate_init(void)
        /* capability check */
        if (cpu_feature_enabled(X86_FEATURE_CPPC)) {
                pr_debug("AMD CPPC MSR based functionality is supported\n");
-               if (cppc_state != AMD_PSTATE_ACTIVE)
-                       current_pstate_driver->adjust_perf = amd_pstate_adjust_perf;
        } else {
                pr_debug("AMD CPPC shared memory based functionality is supported\n");
                static_call_update(amd_pstate_cppc_enable, shmem_cppc_enable);