@@ -1632,25 +1632,17 @@ static int amd_pstate_epp_set_policy(struct cpufreq_policy *policy)
1632
1632
1633
1633
static void amd_pstate_epp_reenable (struct amd_cpudata * cpudata )
1634
1634
{
1635
- struct cppc_perf_ctrls perf_ctrls ;
1636
- u64 value , max_perf ;
1635
+ u64 max_perf ;
1637
1636
int ret ;
1638
1637
1639
1638
ret = amd_pstate_cppc_enable (true);
1640
1639
if (ret )
1641
1640
pr_err ("failed to enable amd pstate during resume, return %d\n" , ret );
1642
1641
1643
- value = READ_ONCE (cpudata -> cppc_req_cached );
1644
1642
max_perf = READ_ONCE (cpudata -> highest_perf );
1645
1643
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 );
1654
1646
}
1655
1647
1656
1648
static 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)
1670
1662
static void amd_pstate_epp_offline (struct cpufreq_policy * policy )
1671
1663
{
1672
1664
struct amd_cpudata * cpudata = policy -> driver_data ;
1673
- struct cppc_perf_ctrls perf_ctrls ;
1674
1665
int min_perf ;
1675
- u64 value ;
1676
1666
1677
1667
min_perf = READ_ONCE (cpudata -> lowest_perf );
1678
- value = READ_ONCE (cpudata -> cppc_req_cached );
1679
1668
1680
1669
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
+
1698
1674
mutex_unlock (& amd_pstate_limits_lock );
1699
1675
}
1700
1676
0 commit comments