@@ -1632,25 +1632,17 @@ static int amd_pstate_epp_set_policy(struct cpufreq_policy *policy)
16321632
16331633static void amd_pstate_epp_reenable (struct amd_cpudata * cpudata )
16341634{
1635- struct cppc_perf_ctrls perf_ctrls ;
1636- u64 value , max_perf ;
1635+ u64 max_perf ;
16371636 int ret ;
16381637
16391638 ret = amd_pstate_cppc_enable (true);
16401639 if (ret )
16411640 pr_err ("failed to enable amd pstate during resume, return %d\n" , ret );
16421641
1643- value = READ_ONCE (cpudata -> cppc_req_cached );
16441642 max_perf = READ_ONCE (cpudata -> highest_perf );
16451643
1646- if (cpu_feature_enabled (X86_FEATURE_CPPC )) {
1647- wrmsrl_on_cpu (cpudata -> cpu , MSR_AMD_CPPC_REQ , value );
1648- } else {
1649- perf_ctrls .max_perf = max_perf ;
1650- cppc_set_perf (cpudata -> cpu , & perf_ctrls );
1651- perf_ctrls .energy_perf = AMD_CPPC_ENERGY_PERF_PREF (cpudata -> epp_cached );
1652- cppc_set_epp_perf (cpudata -> cpu , & perf_ctrls , 1 );
1653- }
1644+ amd_pstate_update_perf (cpudata , 0 , 0 , max_perf , false);
1645+ amd_pstate_set_epp (cpudata , cpudata -> epp_cached );
16541646}
16551647
16561648static int amd_pstate_epp_cpu_online (struct cpufreq_policy * policy )
@@ -1670,31 +1662,15 @@ static int amd_pstate_epp_cpu_online(struct cpufreq_policy *policy)
16701662static void amd_pstate_epp_offline (struct cpufreq_policy * policy )
16711663{
16721664 struct amd_cpudata * cpudata = policy -> driver_data ;
1673- struct cppc_perf_ctrls perf_ctrls ;
16741665 int min_perf ;
1675- u64 value ;
16761666
16771667 min_perf = READ_ONCE (cpudata -> lowest_perf );
1678- value = READ_ONCE (cpudata -> cppc_req_cached );
16791668
16801669 mutex_lock (& amd_pstate_limits_lock );
1681- if (cpu_feature_enabled (X86_FEATURE_CPPC )) {
1682- cpudata -> epp_policy = CPUFREQ_POLICY_UNKNOWN ;
1683-
1684- /* Set max perf same as min perf */
1685- value &= ~AMD_CPPC_MAX_PERF (~0L );
1686- value |= AMD_CPPC_MAX_PERF (min_perf );
1687- value &= ~AMD_CPPC_MIN_PERF (~0L );
1688- value |= AMD_CPPC_MIN_PERF (min_perf );
1689- wrmsrl_on_cpu (cpudata -> cpu , MSR_AMD_CPPC_REQ , value );
1690- } else {
1691- perf_ctrls .desired_perf = 0 ;
1692- perf_ctrls .min_perf = min_perf ;
1693- perf_ctrls .max_perf = min_perf ;
1694- cppc_set_perf (cpudata -> cpu , & perf_ctrls );
1695- perf_ctrls .energy_perf = AMD_CPPC_ENERGY_PERF_PREF (HWP_EPP_BALANCE_POWERSAVE );
1696- cppc_set_epp_perf (cpudata -> cpu , & perf_ctrls , 1 );
1697- }
1670+
1671+ amd_pstate_update_perf (cpudata , min_perf , 0 , min_perf , false);
1672+ amd_pstate_set_epp (cpudata , AMD_CPPC_EPP_BALANCE_POWERSAVE );
1673+
16981674 mutex_unlock (& amd_pstate_limits_lock );
16991675}
17001676
0 commit comments