@@ -537,10 +537,6 @@ static void amd_pstate_update(struct amd_cpudata *cpudata, u32 min_perf,
537537 u32 nominal_perf = READ_ONCE (cpudata -> nominal_perf );
538538 u64 value = prev ;
539539
540- min_perf = clamp_t (unsigned long , min_perf , cpudata -> min_limit_perf ,
541- cpudata -> max_limit_perf );
542- max_perf = clamp_t (unsigned long , max_perf , cpudata -> min_limit_perf ,
543- cpudata -> max_limit_perf );
544540 des_perf = clamp_t (unsigned long , des_perf , min_perf , max_perf );
545541
546542 max_freq = READ_ONCE (cpudata -> max_limit_freq );
@@ -607,20 +603,16 @@ static int amd_pstate_verify(struct cpufreq_policy_data *policy_data)
607603
608604static int amd_pstate_update_min_max_limit (struct cpufreq_policy * policy )
609605{
610- u32 max_limit_perf , min_limit_perf , lowest_perf , max_perf , max_freq ;
606+ u32 max_limit_perf , min_limit_perf , max_perf , max_freq ;
611607 struct amd_cpudata * cpudata = policy -> driver_data ;
612608
613609 max_perf = READ_ONCE (cpudata -> highest_perf );
614610 max_freq = READ_ONCE (cpudata -> max_freq );
615611 max_limit_perf = div_u64 (policy -> max * max_perf , max_freq );
616612 min_limit_perf = div_u64 (policy -> min * max_perf , max_freq );
617613
618- lowest_perf = READ_ONCE (cpudata -> lowest_perf );
619- if (min_limit_perf < lowest_perf )
620- min_limit_perf = lowest_perf ;
621-
622- if (max_limit_perf < min_limit_perf )
623- max_limit_perf = min_limit_perf ;
614+ if (cpudata -> policy == CPUFREQ_POLICY_PERFORMANCE )
615+ min_limit_perf = min (cpudata -> nominal_perf , max_limit_perf );
624616
625617 WRITE_ONCE (cpudata -> max_limit_perf , max_limit_perf );
626618 WRITE_ONCE (cpudata -> min_limit_perf , min_limit_perf );
@@ -1562,28 +1554,18 @@ static void amd_pstate_epp_cpu_exit(struct cpufreq_policy *policy)
15621554static int amd_pstate_epp_update_limit (struct cpufreq_policy * policy )
15631555{
15641556 struct amd_cpudata * cpudata = policy -> driver_data ;
1565- u32 max_perf , min_perf ;
15661557 u64 value ;
15671558 s16 epp ;
15681559
1569- max_perf = READ_ONCE (cpudata -> highest_perf );
1570- min_perf = READ_ONCE (cpudata -> lowest_perf );
15711560 amd_pstate_update_min_max_limit (policy );
15721561
1573- max_perf = clamp_t (unsigned long , max_perf , cpudata -> min_limit_perf ,
1574- cpudata -> max_limit_perf );
1575- min_perf = clamp_t (unsigned long , min_perf , cpudata -> min_limit_perf ,
1576- cpudata -> max_limit_perf );
15771562 value = READ_ONCE (cpudata -> cppc_req_cached );
15781563
1579- if (cpudata -> policy == CPUFREQ_POLICY_PERFORMANCE )
1580- min_perf = min (cpudata -> nominal_perf , max_perf );
1581-
15821564 value &= ~(AMD_CPPC_MAX_PERF_MASK | AMD_CPPC_MIN_PERF_MASK |
15831565 AMD_CPPC_DES_PERF_MASK );
1584- value |= FIELD_PREP (AMD_CPPC_MAX_PERF_MASK , max_perf );
1566+ value |= FIELD_PREP (AMD_CPPC_MAX_PERF_MASK , cpudata -> max_limit_perf );
15851567 value |= FIELD_PREP (AMD_CPPC_DES_PERF_MASK , 0 );
1586- value |= FIELD_PREP (AMD_CPPC_MIN_PERF_MASK , min_perf );
1568+ value |= FIELD_PREP (AMD_CPPC_MIN_PERF_MASK , cpudata -> min_limit_perf );
15871569
15881570 /* Get BIOS pre-defined epp value */
15891571 epp = amd_pstate_get_epp (cpudata , value );
0 commit comments