@@ -537,10 +537,6 @@ static void amd_pstate_update(struct amd_cpudata *cpudata, u32 min_perf,
537
537
u32 nominal_perf = READ_ONCE (cpudata -> nominal_perf );
538
538
u64 value = prev ;
539
539
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 );
544
540
des_perf = clamp_t (unsigned long , des_perf , min_perf , max_perf );
545
541
546
542
max_freq = READ_ONCE (cpudata -> max_limit_freq );
@@ -607,20 +603,16 @@ static int amd_pstate_verify(struct cpufreq_policy_data *policy_data)
607
603
608
604
static int amd_pstate_update_min_max_limit (struct cpufreq_policy * policy )
609
605
{
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 ;
611
607
struct amd_cpudata * cpudata = policy -> driver_data ;
612
608
613
609
max_perf = READ_ONCE (cpudata -> highest_perf );
614
610
max_freq = READ_ONCE (cpudata -> max_freq );
615
611
max_limit_perf = div_u64 (policy -> max * max_perf , max_freq );
616
612
min_limit_perf = div_u64 (policy -> min * max_perf , max_freq );
617
613
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 );
624
616
625
617
WRITE_ONCE (cpudata -> max_limit_perf , max_limit_perf );
626
618
WRITE_ONCE (cpudata -> min_limit_perf , min_limit_perf );
@@ -1562,28 +1554,18 @@ static void amd_pstate_epp_cpu_exit(struct cpufreq_policy *policy)
1562
1554
static int amd_pstate_epp_update_limit (struct cpufreq_policy * policy )
1563
1555
{
1564
1556
struct amd_cpudata * cpudata = policy -> driver_data ;
1565
- u32 max_perf , min_perf ;
1566
1557
u64 value ;
1567
1558
s16 epp ;
1568
1559
1569
- max_perf = READ_ONCE (cpudata -> highest_perf );
1570
- min_perf = READ_ONCE (cpudata -> lowest_perf );
1571
1560
amd_pstate_update_min_max_limit (policy );
1572
1561
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 );
1577
1562
value = READ_ONCE (cpudata -> cppc_req_cached );
1578
1563
1579
- if (cpudata -> policy == CPUFREQ_POLICY_PERFORMANCE )
1580
- min_perf = min (cpudata -> nominal_perf , max_perf );
1581
-
1582
1564
value &= ~(AMD_CPPC_MAX_PERF_MASK | AMD_CPPC_MIN_PERF_MASK |
1583
1565
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 );
1585
1567
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 );
1587
1569
1588
1570
/* Get BIOS pre-defined epp value */
1589
1571
epp = amd_pstate_get_epp (cpudata , value );
0 commit comments