2024-10-29 05:12:06 +03:00
|
|
|
From f7b2b3a1c0d015c4272793bed89734c5cffb354c Mon Sep 17 00:00:00 2001
|
|
|
|
From: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
|
|
|
|
Date: Thu, 3 Oct 2024 08:39:56 +0000
|
|
|
|
Subject: cpufreq/amd-pstate: Cleanup the old min_freq qos request remnants
|
|
|
|
|
|
|
|
Convert the freq_qos_request array in struct amd_cpudata to a single
|
|
|
|
variable (only for max_freq request). Remove the references to cpudata->req
|
|
|
|
array. Remove and rename the jump labels accordingly.
|
|
|
|
|
|
|
|
Signed-off-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
|
|
|
|
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
|
|
|
|
---
|
|
|
|
drivers/cpufreq/amd-pstate.c | 19 ++++++++-----------
|
|
|
|
drivers/cpufreq/amd-pstate.h | 4 ++--
|
|
|
|
2 files changed, 10 insertions(+), 13 deletions(-)
|
|
|
|
|
|
|
|
--- a/drivers/cpufreq/amd-pstate.c
|
|
|
|
+++ b/drivers/cpufreq/amd-pstate.c
|
2024-12-05 18:46:18 +03:00
|
|
|
@@ -704,7 +704,7 @@ static int amd_pstate_cpu_boost_update(s
|
2024-10-29 05:12:06 +03:00
|
|
|
policy->max = policy->cpuinfo.max_freq;
|
|
|
|
|
|
|
|
if (cppc_state == AMD_PSTATE_PASSIVE) {
|
|
|
|
- ret = freq_qos_update_request(&cpudata->req[1], policy->cpuinfo.max_freq);
|
|
|
|
+ ret = freq_qos_update_request(&cpudata->max_freq_req, policy->cpuinfo.max_freq);
|
|
|
|
if (ret < 0)
|
|
|
|
pr_debug("Failed to update freq constraint: CPU%d\n", cpudata->cpu);
|
|
|
|
}
|
2024-12-05 18:46:18 +03:00
|
|
|
@@ -971,17 +971,17 @@ static int amd_pstate_cpu_init(struct cp
|
2024-10-29 05:12:06 +03:00
|
|
|
|
|
|
|
ret = amd_pstate_init_perf(cpudata);
|
|
|
|
if (ret)
|
|
|
|
- goto free_cpudata1;
|
|
|
|
+ goto free_cpudata;
|
|
|
|
|
|
|
|
amd_pstate_init_prefcore(cpudata);
|
|
|
|
|
|
|
|
ret = amd_pstate_init_freq(cpudata);
|
|
|
|
if (ret)
|
|
|
|
- goto free_cpudata1;
|
|
|
|
+ goto free_cpudata;
|
|
|
|
|
|
|
|
ret = amd_pstate_init_boost_support(cpudata);
|
|
|
|
if (ret)
|
|
|
|
- goto free_cpudata1;
|
|
|
|
+ goto free_cpudata;
|
|
|
|
|
|
|
|
min_freq = READ_ONCE(cpudata->min_freq);
|
|
|
|
max_freq = READ_ONCE(cpudata->max_freq);
|
2024-12-05 18:46:18 +03:00
|
|
|
@@ -1003,11 +1003,11 @@ static int amd_pstate_cpu_init(struct cp
|
2024-10-29 05:12:06 +03:00
|
|
|
if (cpu_feature_enabled(X86_FEATURE_CPPC))
|
|
|
|
policy->fast_switch_possible = true;
|
|
|
|
|
|
|
|
- ret = freq_qos_add_request(&policy->constraints, &cpudata->req[1],
|
|
|
|
+ ret = freq_qos_add_request(&policy->constraints, &cpudata->max_freq_req,
|
|
|
|
FREQ_QOS_MAX, policy->cpuinfo.max_freq);
|
|
|
|
if (ret < 0) {
|
|
|
|
dev_err(dev, "Failed to add max-freq constraint (%d)\n", ret);
|
|
|
|
- goto free_cpudata2;
|
|
|
|
+ goto free_cpudata;
|
|
|
|
}
|
|
|
|
|
|
|
|
cpudata->max_limit_freq = max_freq;
|
2024-12-05 18:46:18 +03:00
|
|
|
@@ -1020,9 +1020,7 @@ static int amd_pstate_cpu_init(struct cp
|
2024-10-29 05:12:06 +03:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
-free_cpudata2:
|
|
|
|
- freq_qos_remove_request(&cpudata->req[0]);
|
|
|
|
-free_cpudata1:
|
|
|
|
+free_cpudata:
|
|
|
|
kfree(cpudata);
|
|
|
|
return ret;
|
|
|
|
}
|
2024-12-05 18:46:18 +03:00
|
|
|
@@ -1031,8 +1029,7 @@ static void amd_pstate_cpu_exit(struct c
|
2024-10-29 05:12:06 +03:00
|
|
|
{
|
|
|
|
struct amd_cpudata *cpudata = policy->driver_data;
|
|
|
|
|
|
|
|
- freq_qos_remove_request(&cpudata->req[1]);
|
|
|
|
- freq_qos_remove_request(&cpudata->req[0]);
|
|
|
|
+ freq_qos_remove_request(&cpudata->max_freq_req);
|
|
|
|
policy->fast_switch_possible = false;
|
|
|
|
kfree(cpudata);
|
|
|
|
}
|
|
|
|
--- a/drivers/cpufreq/amd-pstate.h
|
|
|
|
+++ b/drivers/cpufreq/amd-pstate.h
|
|
|
|
@@ -28,7 +28,7 @@ struct amd_aperf_mperf {
|
|
|
|
/**
|
|
|
|
* struct amd_cpudata - private CPU data for AMD P-State
|
|
|
|
* @cpu: CPU number
|
|
|
|
- * @req: constraint request to apply
|
|
|
|
+ * @max_freq_req: maximum frequency constraint request to apply
|
|
|
|
* @cppc_req_cached: cached performance request hints
|
|
|
|
* @highest_perf: the maximum performance an individual processor may reach,
|
|
|
|
* assuming ideal conditions
|
|
|
|
@@ -68,7 +68,7 @@ struct amd_aperf_mperf {
|
|
|
|
struct amd_cpudata {
|
|
|
|
int cpu;
|
|
|
|
|
|
|
|
- struct freq_qos_request req[2];
|
|
|
|
+ struct freq_qos_request max_freq_req;
|
|
|
|
u64 cppc_req_cached;
|
|
|
|
|
|
|
|
u32 highest_perf;
|