2024-10-29 05:12:06 +03:00
|
|
|
From 24e62fbc101d079d398ac6fc76f458676d3d9491 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Mario Limonciello <mario.limonciello@amd.com>
|
|
|
|
Date: Sun, 1 Sep 2024 00:00:35 -0500
|
|
|
|
Subject: cpufreq/amd-pstate: Catch failures for amd_pstate_epp_update_limit()
|
|
|
|
|
|
|
|
amd_pstate_set_epp() calls cppc_set_epp_perf() which can fail for
|
|
|
|
a variety of reasons but this is ignored. Change the return flow
|
|
|
|
to allow failures.
|
|
|
|
|
|
|
|
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
|
|
|
|
---
|
|
|
|
drivers/cpufreq/amd-pstate.c | 11 +++++++----
|
|
|
|
1 file changed, 7 insertions(+), 4 deletions(-)
|
|
|
|
|
|
|
|
--- a/drivers/cpufreq/amd-pstate.c
|
|
|
|
+++ b/drivers/cpufreq/amd-pstate.c
|
2024-12-05 18:46:18 +03:00
|
|
|
@@ -1583,7 +1583,7 @@ static void amd_pstate_epp_cpu_exit(stru
|
2024-10-29 05:12:06 +03:00
|
|
|
pr_debug("CPU %d exiting\n", policy->cpu);
|
|
|
|
}
|
|
|
|
|
|
|
|
-static void amd_pstate_epp_update_limit(struct cpufreq_policy *policy)
|
|
|
|
+static int amd_pstate_epp_update_limit(struct cpufreq_policy *policy)
|
|
|
|
{
|
|
|
|
struct amd_cpudata *cpudata = policy->driver_data;
|
|
|
|
u32 max_perf, min_perf, min_limit_perf, max_limit_perf;
|
2024-12-05 18:46:18 +03:00
|
|
|
@@ -1633,7 +1633,7 @@ static void amd_pstate_epp_update_limit(
|
2024-10-29 05:12:06 +03:00
|
|
|
* This return value can only be negative for shared_memory
|
|
|
|
* systems where EPP register read/write not supported.
|
|
|
|
*/
|
|
|
|
- return;
|
|
|
|
+ return epp;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cpudata->policy == CPUFREQ_POLICY_PERFORMANCE)
|
2024-12-05 18:46:18 +03:00
|
|
|
@@ -1646,12 +1646,13 @@ static void amd_pstate_epp_update_limit(
|
2024-10-29 05:12:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
WRITE_ONCE(cpudata->cppc_req_cached, value);
|
|
|
|
- amd_pstate_set_epp(cpudata, epp);
|
|
|
|
+ return amd_pstate_set_epp(cpudata, epp);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int amd_pstate_epp_set_policy(struct cpufreq_policy *policy)
|
|
|
|
{
|
|
|
|
struct amd_cpudata *cpudata = policy->driver_data;
|
|
|
|
+ int ret;
|
|
|
|
|
|
|
|
if (!policy->cpuinfo.max_freq)
|
|
|
|
return -ENODEV;
|
2024-12-05 18:46:18 +03:00
|
|
|
@@ -1661,7 +1662,9 @@ static int amd_pstate_epp_set_policy(str
|
2024-10-29 05:12:06 +03:00
|
|
|
|
|
|
|
cpudata->policy = policy->policy;
|
|
|
|
|
|
|
|
- amd_pstate_epp_update_limit(policy);
|
|
|
|
+ ret = amd_pstate_epp_update_limit(policy);
|
|
|
|
+ if (ret)
|
|
|
|
+ return ret;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* policy->cur is never updated with the amd_pstate_epp driver, but it
|