@@ -186,7 +186,7 @@ static inline int get_mode_idx_from_str(const char *str, size_t size)
186186static DEFINE_MUTEX (amd_pstate_limits_lock );
187187static DEFINE_MUTEX (amd_pstate_driver_lock );
188188
189- static s16 msr_get_epp (struct amd_cpudata * cpudata )
189+ static u8 msr_get_epp (struct amd_cpudata * cpudata )
190190{
191191 u64 value ;
192192 int ret ;
@@ -207,7 +207,7 @@ static inline s16 amd_pstate_get_epp(struct amd_cpudata *cpudata)
207207 return static_call (amd_pstate_get_epp )(cpudata );
208208}
209209
210- static s16 shmem_get_epp (struct amd_cpudata * cpudata )
210+ static u8 shmem_get_epp (struct amd_cpudata * cpudata )
211211{
212212 u64 epp ;
213213 int ret ;
@@ -218,11 +218,11 @@ static s16 shmem_get_epp(struct amd_cpudata *cpudata)
218218 return ret ;
219219 }
220220
221- return ( s16 )( epp & 0xff );
221+ return FIELD_GET ( AMD_CPPC_EPP_PERF_MASK , epp );
222222}
223223
224- static int msr_update_perf (struct amd_cpudata * cpudata , u32 min_perf ,
225- u32 des_perf , u32 max_perf , u32 epp , bool fast_switch )
224+ static int msr_update_perf (struct amd_cpudata * cpudata , u8 min_perf ,
225+ u8 des_perf , u8 max_perf , u8 epp , bool fast_switch )
226226{
227227 u64 value , prev ;
228228
@@ -257,15 +257,15 @@ static int msr_update_perf(struct amd_cpudata *cpudata, u32 min_perf,
257257DEFINE_STATIC_CALL (amd_pstate_update_perf , msr_update_perf );
258258
259259static inline int amd_pstate_update_perf (struct amd_cpudata * cpudata ,
260- u32 min_perf , u32 des_perf ,
261- u32 max_perf , u32 epp ,
260+ u8 min_perf , u8 des_perf ,
261+ u8 max_perf , u8 epp ,
262262 bool fast_switch )
263263{
264264 return static_call (amd_pstate_update_perf )(cpudata , min_perf , des_perf ,
265265 max_perf , epp , fast_switch );
266266}
267267
268- static int msr_set_epp (struct amd_cpudata * cpudata , u32 epp )
268+ static int msr_set_epp (struct amd_cpudata * cpudata , u8 epp )
269269{
270270 u64 value , prev ;
271271 int ret ;
@@ -292,12 +292,12 @@ static int msr_set_epp(struct amd_cpudata *cpudata, u32 epp)
292292
293293DEFINE_STATIC_CALL (amd_pstate_set_epp , msr_set_epp );
294294
295- static inline int amd_pstate_set_epp (struct amd_cpudata * cpudata , u32 epp )
295+ static inline int amd_pstate_set_epp (struct amd_cpudata * cpudata , u8 epp )
296296{
297297 return static_call (amd_pstate_set_epp )(cpudata , epp );
298298}
299299
300- static int shmem_set_epp (struct amd_cpudata * cpudata , u32 epp )
300+ static int shmem_set_epp (struct amd_cpudata * cpudata , u8 epp )
301301{
302302 int ret ;
303303 struct cppc_perf_ctrls perf_ctrls ;
@@ -320,7 +320,7 @@ static int amd_pstate_set_energy_pref_index(struct cpufreq_policy *policy,
320320 int pref_index )
321321{
322322 struct amd_cpudata * cpudata = policy -> driver_data ;
323- int epp ;
323+ u8 epp ;
324324
325325 if (!pref_index )
326326 epp = cpudata -> epp_default ;
@@ -479,8 +479,8 @@ static inline int amd_pstate_init_perf(struct amd_cpudata *cpudata)
479479 return static_call (amd_pstate_init_perf )(cpudata );
480480}
481481
482- static int shmem_update_perf (struct amd_cpudata * cpudata , u32 min_perf ,
483- u32 des_perf , u32 max_perf , u32 epp , bool fast_switch )
482+ static int shmem_update_perf (struct amd_cpudata * cpudata , u8 min_perf ,
483+ u8 des_perf , u8 max_perf , u8 epp , bool fast_switch )
484484{
485485 struct cppc_perf_ctrls perf_ctrls ;
486486
@@ -531,14 +531,14 @@ static inline bool amd_pstate_sample(struct amd_cpudata *cpudata)
531531 return true;
532532}
533533
534- static void amd_pstate_update (struct amd_cpudata * cpudata , u32 min_perf ,
535- u32 des_perf , u32 max_perf , bool fast_switch , int gov_flags )
534+ static void amd_pstate_update (struct amd_cpudata * cpudata , u8 min_perf ,
535+ u8 des_perf , u8 max_perf , bool fast_switch , int gov_flags )
536536{
537537 unsigned long max_freq ;
538538 struct cpufreq_policy * policy = cpufreq_cpu_get (cpudata -> cpu );
539- u32 nominal_perf = READ_ONCE (cpudata -> nominal_perf );
539+ u8 nominal_perf = READ_ONCE (cpudata -> nominal_perf );
540540
541- des_perf = clamp_t (unsigned long , des_perf , min_perf , max_perf );
541+ des_perf = clamp_t (u8 , des_perf , min_perf , max_perf );
542542
543543 max_freq = READ_ONCE (cpudata -> max_limit_freq );
544544 policy -> cur = div_u64 (des_perf * max_freq , max_perf );
@@ -550,7 +550,7 @@ static void amd_pstate_update(struct amd_cpudata *cpudata, u32 min_perf,
550550
551551 /* limit the max perf when core performance boost feature is disabled */
552552 if (!cpudata -> boost_supported )
553- max_perf = min_t (unsigned long , nominal_perf , max_perf );
553+ max_perf = min_t (u8 , nominal_perf , max_perf );
554554
555555 if (trace_amd_pstate_perf_enabled () && amd_pstate_sample (cpudata )) {
556556 trace_amd_pstate_perf (min_perf , des_perf , max_perf , cpudata -> freq ,
@@ -591,7 +591,8 @@ static int amd_pstate_verify(struct cpufreq_policy_data *policy_data)
591591
592592static int amd_pstate_update_min_max_limit (struct cpufreq_policy * policy )
593593{
594- u32 max_limit_perf , min_limit_perf , max_perf , max_freq ;
594+ u8 max_limit_perf , min_limit_perf , max_perf ;
595+ u32 max_freq ;
595596 struct amd_cpudata * cpudata = policy -> driver_data ;
596597
597598 max_perf = READ_ONCE (cpudata -> highest_perf );
@@ -615,7 +616,7 @@ static int amd_pstate_update_freq(struct cpufreq_policy *policy,
615616{
616617 struct cpufreq_freqs freqs ;
617618 struct amd_cpudata * cpudata = policy -> driver_data ;
618- unsigned long des_perf , cap_perf ;
619+ u8 des_perf , cap_perf ;
619620
620621 if (!cpudata -> max_freq )
621622 return - ENODEV ;
@@ -670,8 +671,7 @@ static void amd_pstate_adjust_perf(unsigned int cpu,
670671 unsigned long target_perf ,
671672 unsigned long capacity )
672673{
673- unsigned long max_perf , min_perf , des_perf ,
674- cap_perf , min_limit_perf ;
674+ u8 max_perf , min_perf , des_perf , cap_perf , min_limit_perf ;
675675 struct cpufreq_policy * policy = cpufreq_cpu_get (cpu );
676676 struct amd_cpudata * cpudata ;
677677
@@ -905,8 +905,8 @@ static int amd_pstate_init_freq(struct amd_cpudata *cpudata)
905905{
906906 int ret ;
907907 u32 min_freq , max_freq ;
908- u32 highest_perf , nominal_perf , nominal_freq ;
909- u32 lowest_nonlinear_perf , lowest_nonlinear_freq ;
908+ u8 highest_perf , nominal_perf , lowest_nonlinear_perf ;
909+ u32 nominal_freq , lowest_nonlinear_freq ;
910910 struct cppc_perf_caps cppc_perf ;
911911
912912 ret = cppc_get_perf_caps (cpudata -> cpu , & cppc_perf );
@@ -1113,7 +1113,7 @@ static ssize_t show_amd_pstate_lowest_nonlinear_freq(struct cpufreq_policy *poli
11131113static ssize_t show_amd_pstate_highest_perf (struct cpufreq_policy * policy ,
11141114 char * buf )
11151115{
1116- u32 perf ;
1116+ u8 perf ;
11171117 struct amd_cpudata * cpudata = policy -> driver_data ;
11181118
11191119 perf = READ_ONCE (cpudata -> highest_perf );
@@ -1124,7 +1124,7 @@ static ssize_t show_amd_pstate_highest_perf(struct cpufreq_policy *policy,
11241124static ssize_t show_amd_pstate_prefcore_ranking (struct cpufreq_policy * policy ,
11251125 char * buf )
11261126{
1127- u32 perf ;
1127+ u8 perf ;
11281128 struct amd_cpudata * cpudata = policy -> driver_data ;
11291129
11301130 perf = READ_ONCE (cpudata -> prefcore_ranking );
@@ -1187,7 +1187,7 @@ static ssize_t show_energy_performance_preference(
11871187 struct cpufreq_policy * policy , char * buf )
11881188{
11891189 struct amd_cpudata * cpudata = policy -> driver_data ;
1190- int preference ;
1190+ u8 preference ;
11911191
11921192 switch (cpudata -> epp_cached ) {
11931193 case AMD_CPPC_EPP_PERFORMANCE :
@@ -1549,7 +1549,7 @@ static void amd_pstate_epp_cpu_exit(struct cpufreq_policy *policy)
15491549static int amd_pstate_epp_update_limit (struct cpufreq_policy * policy )
15501550{
15511551 struct amd_cpudata * cpudata = policy -> driver_data ;
1552- u32 epp ;
1552+ u8 epp ;
15531553
15541554 amd_pstate_update_min_max_limit (policy );
15551555
@@ -1598,7 +1598,7 @@ static int amd_pstate_epp_set_policy(struct cpufreq_policy *policy)
15981598static int amd_pstate_epp_reenable (struct cpufreq_policy * policy )
15991599{
16001600 struct amd_cpudata * cpudata = policy -> driver_data ;
1601- u64 max_perf ;
1601+ u8 max_perf ;
16021602 int ret ;
16031603
16041604 ret = amd_pstate_cppc_enable (true);
@@ -1635,7 +1635,7 @@ static int amd_pstate_epp_cpu_online(struct cpufreq_policy *policy)
16351635static int amd_pstate_epp_cpu_offline (struct cpufreq_policy * policy )
16361636{
16371637 struct amd_cpudata * cpudata = policy -> driver_data ;
1638- int min_perf ;
1638+ u8 min_perf ;
16391639
16401640 if (cpudata -> suspended )
16411641 return 0 ;
0 commit comments