Skip to content

Commit 942718f

Browse files
committed
cpufreq/amd-pstate: Change amd_pstate_update_perf() to return an int
As msr_update_perf() calls an MSR it's possible that it fails. Pass this return code up to the caller. Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com> Link: https://lore.kernel.org/r/20241209185248.16301-10-mario.limonciello@amd.com Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
1 parent 68cb0e7 commit 942718f

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

drivers/cpufreq/amd-pstate.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -251,24 +251,26 @@ static int amd_pstate_get_energy_pref_index(struct amd_cpudata *cpudata)
251251
return index;
252252
}
253253

254-
static void msr_update_perf(struct amd_cpudata *cpudata, u32 min_perf,
254+
static int msr_update_perf(struct amd_cpudata *cpudata, u32 min_perf,
255255
u32 des_perf, u32 max_perf, bool fast_switch)
256256
{
257-
if (fast_switch)
257+
if (fast_switch) {
258258
wrmsrl(MSR_AMD_CPPC_REQ, READ_ONCE(cpudata->cppc_req_cached));
259-
else
260-
wrmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_REQ,
261-
READ_ONCE(cpudata->cppc_req_cached));
259+
return 0;
260+
}
261+
262+
return wrmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_REQ,
263+
READ_ONCE(cpudata->cppc_req_cached));
262264
}
263265

264266
DEFINE_STATIC_CALL(amd_pstate_update_perf, msr_update_perf);
265267

266-
static inline void amd_pstate_update_perf(struct amd_cpudata *cpudata,
268+
static inline int amd_pstate_update_perf(struct amd_cpudata *cpudata,
267269
u32 min_perf, u32 des_perf,
268270
u32 max_perf, bool fast_switch)
269271
{
270-
static_call(amd_pstate_update_perf)(cpudata, min_perf, des_perf,
271-
max_perf, fast_switch);
272+
return static_call(amd_pstate_update_perf)(cpudata, min_perf, des_perf,
273+
max_perf, fast_switch);
272274
}
273275

274276
static int msr_set_epp(struct amd_cpudata *cpudata, u32 epp)
@@ -480,7 +482,7 @@ static inline int amd_pstate_init_perf(struct amd_cpudata *cpudata)
480482
return static_call(amd_pstate_init_perf)(cpudata);
481483
}
482484

483-
static void shmem_update_perf(struct amd_cpudata *cpudata,
485+
static int shmem_update_perf(struct amd_cpudata *cpudata,
484486
u32 min_perf, u32 des_perf,
485487
u32 max_perf, bool fast_switch)
486488
{
@@ -490,7 +492,7 @@ static void shmem_update_perf(struct amd_cpudata *cpudata,
490492
perf_ctrls.min_perf = min_perf;
491493
perf_ctrls.desired_perf = des_perf;
492494

493-
cppc_set_perf(cpudata->cpu, &perf_ctrls);
495+
return cppc_set_perf(cpudata->cpu, &perf_ctrls);
494496
}
495497

496498
static inline bool amd_pstate_sample(struct amd_cpudata *cpudata)

0 commit comments

Comments
 (0)