release 6.14.2
This commit is contained in:
@@ -1,59 +0,0 @@
|
||||
From c8c9ab8ff5cc5c0809cd958679614ade200a6ab3 Mon Sep 17 00:00:00 2001
|
||||
From: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>
|
||||
Date: Wed, 5 Feb 2025 11:25:14 +0000
|
||||
Subject: cpufreq/amd-pstate: Modify the min_perf calculation in adjust_perf
|
||||
callback
|
||||
|
||||
Instead of setting a fixed floor at lowest_nonlinear_perf, use the
|
||||
min_limit_perf value, so that it gives the user the freedom to lower the
|
||||
floor further.
|
||||
|
||||
There are two minimum frequency/perf limits that we need to consider in
|
||||
the adjust_perf callback. One provided by schedutil i.e. the sg_cpu->bw_min
|
||||
value passed in _min_perf arg, another is the effective value of
|
||||
min_freq_qos request that is updated in cpudata->min_limit_perf. Modify the
|
||||
code to use the bigger of these two values.
|
||||
|
||||
Signed-off-by: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>
|
||||
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
|
||||
---
|
||||
drivers/cpufreq/amd-pstate.c | 12 ++++++------
|
||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
--- a/drivers/cpufreq/amd-pstate.c
|
||||
+++ b/drivers/cpufreq/amd-pstate.c
|
||||
@@ -672,7 +672,7 @@ static void amd_pstate_adjust_perf(unsig
|
||||
unsigned long capacity)
|
||||
{
|
||||
unsigned long max_perf, min_perf, des_perf,
|
||||
- cap_perf, lowest_nonlinear_perf;
|
||||
+ cap_perf, min_limit_perf;
|
||||
struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
|
||||
struct amd_cpudata *cpudata;
|
||||
|
||||
@@ -684,20 +684,20 @@ static void amd_pstate_adjust_perf(unsig
|
||||
if (policy->min != cpudata->min_limit_freq || policy->max != cpudata->max_limit_freq)
|
||||
amd_pstate_update_min_max_limit(policy);
|
||||
|
||||
-
|
||||
cap_perf = READ_ONCE(cpudata->highest_perf);
|
||||
- lowest_nonlinear_perf = READ_ONCE(cpudata->lowest_nonlinear_perf);
|
||||
+ min_limit_perf = READ_ONCE(cpudata->min_limit_perf);
|
||||
|
||||
des_perf = cap_perf;
|
||||
if (target_perf < capacity)
|
||||
des_perf = DIV_ROUND_UP(cap_perf * target_perf, capacity);
|
||||
|
||||
- min_perf = READ_ONCE(cpudata->lowest_perf);
|
||||
if (_min_perf < capacity)
|
||||
min_perf = DIV_ROUND_UP(cap_perf * _min_perf, capacity);
|
||||
+ else
|
||||
+ min_perf = cap_perf;
|
||||
|
||||
- if (min_perf < lowest_nonlinear_perf)
|
||||
- min_perf = lowest_nonlinear_perf;
|
||||
+ if (min_perf < min_limit_perf)
|
||||
+ min_perf = min_limit_perf;
|
||||
|
||||
max_perf = cpudata->max_limit_perf;
|
||||
if (max_perf < min_perf)
|
@@ -1,4 +1,4 @@
|
||||
From 16466d169a187b4c650771234de119279346f523 Mon Sep 17 00:00:00 2001
|
||||
From 769d2f0a23fcf67207d5e931610eab2ced40548a Mon Sep 17 00:00:00 2001
|
||||
From: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>
|
||||
Date: Wed, 5 Feb 2025 11:25:15 +0000
|
||||
Subject: cpufreq/amd-pstate: Remove the redundant des_perf clamping in
|
||||
@@ -16,7 +16,7 @@ Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
|
||||
|
||||
--- a/drivers/cpufreq/amd-pstate.c
|
||||
+++ b/drivers/cpufreq/amd-pstate.c
|
||||
@@ -703,8 +703,6 @@ static void amd_pstate_adjust_perf(unsig
|
||||
@@ -705,8 +705,6 @@ static void amd_pstate_adjust_perf(unsig
|
||||
if (max_perf < min_perf)
|
||||
max_perf = min_perf;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
From b132b889dc7aa398a789e02dd6fbd5a512b4a9e0 Mon Sep 17 00:00:00 2001
|
||||
From c2642290e7fbce1a301cd30fa3f78ef37defd52e Mon Sep 17 00:00:00 2001
|
||||
From: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>
|
||||
Date: Wed, 5 Feb 2025 11:25:18 +0000
|
||||
Subject: cpufreq/amd-pstate: Modularize perf<->freq conversion
|
||||
@@ -35,7 +35,7 @@ Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
|
||||
static int __init dmi_matched_7k62_bios_bug(const struct dmi_system_id *dmi)
|
||||
{
|
||||
/**
|
||||
@@ -534,14 +548,12 @@ static inline bool amd_pstate_sample(str
|
||||
@@ -534,7 +548,6 @@ static inline bool amd_pstate_sample(str
|
||||
static void amd_pstate_update(struct amd_cpudata *cpudata, u8 min_perf,
|
||||
u8 des_perf, u8 max_perf, bool fast_switch, int gov_flags)
|
||||
{
|
||||
@@ -43,6 +43,8 @@ Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
|
||||
struct cpufreq_policy *policy = cpufreq_cpu_get(cpudata->cpu);
|
||||
u8 nominal_perf = READ_ONCE(cpudata->nominal_perf);
|
||||
|
||||
@@ -543,8 +556,7 @@ static void amd_pstate_update(struct amd
|
||||
|
||||
des_perf = clamp_t(u8, des_perf, min_perf, max_perf);
|
||||
|
||||
- max_freq = READ_ONCE(cpudata->max_limit_freq);
|
||||
@@ -51,7 +53,7 @@ Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
|
||||
|
||||
if ((cppc_state == AMD_PSTATE_GUIDED) && (gov_flags & CPUFREQ_GOV_DYNAMIC_SWITCHING)) {
|
||||
min_perf = des_perf;
|
||||
@@ -591,14 +603,11 @@ static int amd_pstate_verify(struct cpuf
|
||||
@@ -594,14 +606,11 @@ static int amd_pstate_verify(struct cpuf
|
||||
|
||||
static int amd_pstate_update_min_max_limit(struct cpufreq_policy *policy)
|
||||
{
|
||||
@@ -69,7 +71,7 @@ Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
|
||||
|
||||
if (cpudata->policy == CPUFREQ_POLICY_PERFORMANCE)
|
||||
min_limit_perf = min(cpudata->nominal_perf, max_limit_perf);
|
||||
@@ -616,21 +625,15 @@ static int amd_pstate_update_freq(struct
|
||||
@@ -619,21 +628,15 @@ static int amd_pstate_update_freq(struct
|
||||
{
|
||||
struct cpufreq_freqs freqs;
|
||||
struct amd_cpudata *cpudata = policy->driver_data;
|
||||
@@ -93,7 +95,7 @@ Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
|
||||
|
||||
WARN_ON(fast_switch && !policy->fast_switch_enabled);
|
||||
/*
|
||||
@@ -905,7 +908,6 @@ static int amd_pstate_init_freq(struct a
|
||||
@@ -908,7 +911,6 @@ static int amd_pstate_init_freq(struct a
|
||||
{
|
||||
int ret;
|
||||
u32 min_freq, max_freq;
|
||||
@@ -101,7 +103,7 @@ Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
|
||||
u32 nominal_freq, lowest_nonlinear_freq;
|
||||
struct cppc_perf_caps cppc_perf;
|
||||
|
||||
@@ -923,16 +925,17 @@ static int amd_pstate_init_freq(struct a
|
||||
@@ -926,16 +928,17 @@ static int amd_pstate_init_freq(struct a
|
||||
else
|
||||
nominal_freq = cppc_perf.nominal_freq;
|
||||
|
@@ -1,51 +0,0 @@
|
||||
From 0dfebf0094ea7c512cf3db1013cf82124d4bbc3a Mon Sep 17 00:00:00 2001
|
||||
From: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>
|
||||
Date: Wed, 5 Feb 2025 11:25:16 +0000
|
||||
Subject: cpufreq/amd-pstate: Pass min/max_limit_perf as min/max_perf to
|
||||
amd_pstate_update
|
||||
|
||||
Currently, amd_pstate_update_freq passes the hardware perf limits as
|
||||
min/max_perf to amd_pstate_update, which eventually gets programmed into
|
||||
the min/max_perf fields of the CPPC_REQ register.
|
||||
|
||||
Instead pass the effective perf limits i.e. min/max_limit_perf values to
|
||||
amd_pstate_update as min/max_perf.
|
||||
|
||||
Signed-off-by: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>
|
||||
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
|
||||
---
|
||||
drivers/cpufreq/amd-pstate.c | 9 ++++-----
|
||||
1 file changed, 4 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/drivers/cpufreq/amd-pstate.c
|
||||
+++ b/drivers/cpufreq/amd-pstate.c
|
||||
@@ -615,7 +615,7 @@ static int amd_pstate_update_freq(struct
|
||||
{
|
||||
struct cpufreq_freqs freqs;
|
||||
struct amd_cpudata *cpudata = policy->driver_data;
|
||||
- unsigned long max_perf, min_perf, des_perf, cap_perf;
|
||||
+ unsigned long des_perf, cap_perf;
|
||||
|
||||
if (!cpudata->max_freq)
|
||||
return -ENODEV;
|
||||
@@ -624,8 +624,6 @@ static int amd_pstate_update_freq(struct
|
||||
amd_pstate_update_min_max_limit(policy);
|
||||
|
||||
cap_perf = READ_ONCE(cpudata->highest_perf);
|
||||
- min_perf = READ_ONCE(cpudata->lowest_perf);
|
||||
- max_perf = cap_perf;
|
||||
|
||||
freqs.old = policy->cur;
|
||||
freqs.new = target_freq;
|
||||
@@ -642,8 +640,9 @@ static int amd_pstate_update_freq(struct
|
||||
if (!fast_switch)
|
||||
cpufreq_freq_transition_begin(policy, &freqs);
|
||||
|
||||
- amd_pstate_update(cpudata, min_perf, des_perf,
|
||||
- max_perf, fast_switch, policy->governor->flags);
|
||||
+ amd_pstate_update(cpudata, cpudata->min_limit_perf, des_perf,
|
||||
+ cpudata->max_limit_perf, fast_switch,
|
||||
+ policy->governor->flags);
|
||||
|
||||
if (!fast_switch)
|
||||
cpufreq_freq_transition_end(policy, &freqs, false);
|
@@ -1,4 +1,4 @@
|
||||
From 6c284985cc268da10f0e38f1f3b9af62ecfc3998 Mon Sep 17 00:00:00 2001
|
||||
From 9560891ef76a2badb9f2e9cb2778938086ac9a04 Mon Sep 17 00:00:00 2001
|
||||
From: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>
|
||||
Date: Wed, 5 Feb 2025 11:25:19 +0000
|
||||
Subject: cpufreq/amd-pstate: Remove the unnecessary cpufreq_update_policy call
|
||||
@@ -24,7 +24,7 @@ Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
|
||||
|
||||
--- a/drivers/cpufreq/amd-pstate.c
|
||||
+++ b/drivers/cpufreq/amd-pstate.c
|
||||
@@ -853,10 +853,6 @@ static void amd_pstate_update_limits(uns
|
||||
@@ -856,10 +856,6 @@ static void amd_pstate_update_limits(uns
|
||||
sched_set_itmt_core_prio((int)cur_high, cpu);
|
||||
}
|
||||
cpufreq_cpu_put(policy);
|
@@ -1,355 +0,0 @@
|
||||
From 3daf64b383bc41feb0bf23790939b4512ba9170d Mon Sep 17 00:00:00 2001
|
||||
From: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>
|
||||
Date: Wed, 5 Feb 2025 11:25:17 +0000
|
||||
Subject: cpufreq/amd-pstate: Convert all perf values to u8
|
||||
|
||||
All perf values are always within 0-255 range, hence convert their
|
||||
datatype to u8 everywhere.
|
||||
|
||||
Signed-off-by: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>
|
||||
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
|
||||
---
|
||||
drivers/cpufreq/amd-pstate-trace.h | 46 +++++++++++------------
|
||||
drivers/cpufreq/amd-pstate.c | 60 +++++++++++++++---------------
|
||||
drivers/cpufreq/amd-pstate.h | 18 ++++-----
|
||||
3 files changed, 62 insertions(+), 62 deletions(-)
|
||||
|
||||
--- a/drivers/cpufreq/amd-pstate-trace.h
|
||||
+++ b/drivers/cpufreq/amd-pstate-trace.h
|
||||
@@ -24,9 +24,9 @@
|
||||
|
||||
TRACE_EVENT(amd_pstate_perf,
|
||||
|
||||
- TP_PROTO(unsigned long min_perf,
|
||||
- unsigned long target_perf,
|
||||
- unsigned long capacity,
|
||||
+ TP_PROTO(u8 min_perf,
|
||||
+ u8 target_perf,
|
||||
+ u8 capacity,
|
||||
u64 freq,
|
||||
u64 mperf,
|
||||
u64 aperf,
|
||||
@@ -47,9 +47,9 @@ TRACE_EVENT(amd_pstate_perf,
|
||||
),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
- __field(unsigned long, min_perf)
|
||||
- __field(unsigned long, target_perf)
|
||||
- __field(unsigned long, capacity)
|
||||
+ __field(u8, min_perf)
|
||||
+ __field(u8, target_perf)
|
||||
+ __field(u8, capacity)
|
||||
__field(unsigned long long, freq)
|
||||
__field(unsigned long long, mperf)
|
||||
__field(unsigned long long, aperf)
|
||||
@@ -70,10 +70,10 @@ TRACE_EVENT(amd_pstate_perf,
|
||||
__entry->fast_switch = fast_switch;
|
||||
),
|
||||
|
||||
- TP_printk("amd_min_perf=%lu amd_des_perf=%lu amd_max_perf=%lu freq=%llu mperf=%llu aperf=%llu tsc=%llu cpu_id=%u fast_switch=%s",
|
||||
- (unsigned long)__entry->min_perf,
|
||||
- (unsigned long)__entry->target_perf,
|
||||
- (unsigned long)__entry->capacity,
|
||||
+ TP_printk("amd_min_perf=%hhu amd_des_perf=%hhu amd_max_perf=%hhu freq=%llu mperf=%llu aperf=%llu tsc=%llu cpu_id=%u fast_switch=%s",
|
||||
+ (u8)__entry->min_perf,
|
||||
+ (u8)__entry->target_perf,
|
||||
+ (u8)__entry->capacity,
|
||||
(unsigned long long)__entry->freq,
|
||||
(unsigned long long)__entry->mperf,
|
||||
(unsigned long long)__entry->aperf,
|
||||
@@ -86,10 +86,10 @@ TRACE_EVENT(amd_pstate_perf,
|
||||
TRACE_EVENT(amd_pstate_epp_perf,
|
||||
|
||||
TP_PROTO(unsigned int cpu_id,
|
||||
- unsigned int highest_perf,
|
||||
- unsigned int epp,
|
||||
- unsigned int min_perf,
|
||||
- unsigned int max_perf,
|
||||
+ u8 highest_perf,
|
||||
+ u8 epp,
|
||||
+ u8 min_perf,
|
||||
+ u8 max_perf,
|
||||
bool boost
|
||||
),
|
||||
|
||||
@@ -102,10 +102,10 @@ TRACE_EVENT(amd_pstate_epp_perf,
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field(unsigned int, cpu_id)
|
||||
- __field(unsigned int, highest_perf)
|
||||
- __field(unsigned int, epp)
|
||||
- __field(unsigned int, min_perf)
|
||||
- __field(unsigned int, max_perf)
|
||||
+ __field(u8, highest_perf)
|
||||
+ __field(u8, epp)
|
||||
+ __field(u8, min_perf)
|
||||
+ __field(u8, max_perf)
|
||||
__field(bool, boost)
|
||||
),
|
||||
|
||||
@@ -118,12 +118,12 @@ TRACE_EVENT(amd_pstate_epp_perf,
|
||||
__entry->boost = boost;
|
||||
),
|
||||
|
||||
- TP_printk("cpu%u: [%u<->%u]/%u, epp=%u, boost=%u",
|
||||
+ TP_printk("cpu%u: [%hhu<->%hhu]/%hhu, epp=%hhu, boost=%u",
|
||||
(unsigned int)__entry->cpu_id,
|
||||
- (unsigned int)__entry->min_perf,
|
||||
- (unsigned int)__entry->max_perf,
|
||||
- (unsigned int)__entry->highest_perf,
|
||||
- (unsigned int)__entry->epp,
|
||||
+ (u8)__entry->min_perf,
|
||||
+ (u8)__entry->max_perf,
|
||||
+ (u8)__entry->highest_perf,
|
||||
+ (u8)__entry->epp,
|
||||
(bool)__entry->boost
|
||||
)
|
||||
);
|
||||
--- a/drivers/cpufreq/amd-pstate.c
|
||||
+++ b/drivers/cpufreq/amd-pstate.c
|
||||
@@ -186,7 +186,7 @@ static inline int get_mode_idx_from_str(
|
||||
static DEFINE_MUTEX(amd_pstate_limits_lock);
|
||||
static DEFINE_MUTEX(amd_pstate_driver_lock);
|
||||
|
||||
-static s16 msr_get_epp(struct amd_cpudata *cpudata)
|
||||
+static u8 msr_get_epp(struct amd_cpudata *cpudata)
|
||||
{
|
||||
u64 value;
|
||||
int ret;
|
||||
@@ -207,7 +207,7 @@ static inline s16 amd_pstate_get_epp(str
|
||||
return static_call(amd_pstate_get_epp)(cpudata);
|
||||
}
|
||||
|
||||
-static s16 shmem_get_epp(struct amd_cpudata *cpudata)
|
||||
+static u8 shmem_get_epp(struct amd_cpudata *cpudata)
|
||||
{
|
||||
u64 epp;
|
||||
int ret;
|
||||
@@ -218,11 +218,11 @@ static s16 shmem_get_epp(struct amd_cpud
|
||||
return ret;
|
||||
}
|
||||
|
||||
- return (s16)(epp & 0xff);
|
||||
+ return FIELD_GET(AMD_CPPC_EPP_PERF_MASK, epp);
|
||||
}
|
||||
|
||||
-static int msr_update_perf(struct amd_cpudata *cpudata, u32 min_perf,
|
||||
- u32 des_perf, u32 max_perf, u32 epp, bool fast_switch)
|
||||
+static int msr_update_perf(struct amd_cpudata *cpudata, u8 min_perf,
|
||||
+ u8 des_perf, u8 max_perf, u8 epp, bool fast_switch)
|
||||
{
|
||||
u64 value, prev;
|
||||
|
||||
@@ -257,15 +257,15 @@ static int msr_update_perf(struct amd_cp
|
||||
DEFINE_STATIC_CALL(amd_pstate_update_perf, msr_update_perf);
|
||||
|
||||
static inline int amd_pstate_update_perf(struct amd_cpudata *cpudata,
|
||||
- u32 min_perf, u32 des_perf,
|
||||
- u32 max_perf, u32 epp,
|
||||
+ u8 min_perf, u8 des_perf,
|
||||
+ u8 max_perf, u8 epp,
|
||||
bool fast_switch)
|
||||
{
|
||||
return static_call(amd_pstate_update_perf)(cpudata, min_perf, des_perf,
|
||||
max_perf, epp, fast_switch);
|
||||
}
|
||||
|
||||
-static int msr_set_epp(struct amd_cpudata *cpudata, u32 epp)
|
||||
+static int msr_set_epp(struct amd_cpudata *cpudata, u8 epp)
|
||||
{
|
||||
u64 value, prev;
|
||||
int ret;
|
||||
@@ -292,12 +292,12 @@ static int msr_set_epp(struct amd_cpudat
|
||||
|
||||
DEFINE_STATIC_CALL(amd_pstate_set_epp, msr_set_epp);
|
||||
|
||||
-static inline int amd_pstate_set_epp(struct amd_cpudata *cpudata, u32 epp)
|
||||
+static inline int amd_pstate_set_epp(struct amd_cpudata *cpudata, u8 epp)
|
||||
{
|
||||
return static_call(amd_pstate_set_epp)(cpudata, epp);
|
||||
}
|
||||
|
||||
-static int shmem_set_epp(struct amd_cpudata *cpudata, u32 epp)
|
||||
+static int shmem_set_epp(struct amd_cpudata *cpudata, u8 epp)
|
||||
{
|
||||
int ret;
|
||||
struct cppc_perf_ctrls perf_ctrls;
|
||||
@@ -320,7 +320,7 @@ static int amd_pstate_set_energy_pref_in
|
||||
int pref_index)
|
||||
{
|
||||
struct amd_cpudata *cpudata = policy->driver_data;
|
||||
- int epp;
|
||||
+ u8 epp;
|
||||
|
||||
if (!pref_index)
|
||||
epp = cpudata->epp_default;
|
||||
@@ -479,8 +479,8 @@ static inline int amd_pstate_init_perf(s
|
||||
return static_call(amd_pstate_init_perf)(cpudata);
|
||||
}
|
||||
|
||||
-static int shmem_update_perf(struct amd_cpudata *cpudata, u32 min_perf,
|
||||
- u32 des_perf, u32 max_perf, u32 epp, bool fast_switch)
|
||||
+static int shmem_update_perf(struct amd_cpudata *cpudata, u8 min_perf,
|
||||
+ u8 des_perf, u8 max_perf, u8 epp, bool fast_switch)
|
||||
{
|
||||
struct cppc_perf_ctrls perf_ctrls;
|
||||
|
||||
@@ -531,14 +531,14 @@ static inline bool amd_pstate_sample(str
|
||||
return true;
|
||||
}
|
||||
|
||||
-static void amd_pstate_update(struct amd_cpudata *cpudata, u32 min_perf,
|
||||
- u32 des_perf, u32 max_perf, bool fast_switch, int gov_flags)
|
||||
+static void amd_pstate_update(struct amd_cpudata *cpudata, u8 min_perf,
|
||||
+ u8 des_perf, u8 max_perf, bool fast_switch, int gov_flags)
|
||||
{
|
||||
unsigned long max_freq;
|
||||
struct cpufreq_policy *policy = cpufreq_cpu_get(cpudata->cpu);
|
||||
- u32 nominal_perf = READ_ONCE(cpudata->nominal_perf);
|
||||
+ u8 nominal_perf = READ_ONCE(cpudata->nominal_perf);
|
||||
|
||||
- des_perf = clamp_t(unsigned long, des_perf, min_perf, max_perf);
|
||||
+ des_perf = clamp_t(u8, des_perf, min_perf, max_perf);
|
||||
|
||||
max_freq = READ_ONCE(cpudata->max_limit_freq);
|
||||
policy->cur = div_u64(des_perf * max_freq, max_perf);
|
||||
@@ -550,7 +550,7 @@ static void amd_pstate_update(struct amd
|
||||
|
||||
/* limit the max perf when core performance boost feature is disabled */
|
||||
if (!cpudata->boost_supported)
|
||||
- max_perf = min_t(unsigned long, nominal_perf, max_perf);
|
||||
+ max_perf = min_t(u8, nominal_perf, max_perf);
|
||||
|
||||
if (trace_amd_pstate_perf_enabled() && amd_pstate_sample(cpudata)) {
|
||||
trace_amd_pstate_perf(min_perf, des_perf, max_perf, cpudata->freq,
|
||||
@@ -591,7 +591,8 @@ static int amd_pstate_verify(struct cpuf
|
||||
|
||||
static int amd_pstate_update_min_max_limit(struct cpufreq_policy *policy)
|
||||
{
|
||||
- u32 max_limit_perf, min_limit_perf, max_perf, max_freq;
|
||||
+ u8 max_limit_perf, min_limit_perf, max_perf;
|
||||
+ u32 max_freq;
|
||||
struct amd_cpudata *cpudata = policy->driver_data;
|
||||
|
||||
max_perf = READ_ONCE(cpudata->highest_perf);
|
||||
@@ -615,7 +616,7 @@ static int amd_pstate_update_freq(struct
|
||||
{
|
||||
struct cpufreq_freqs freqs;
|
||||
struct amd_cpudata *cpudata = policy->driver_data;
|
||||
- unsigned long des_perf, cap_perf;
|
||||
+ u8 des_perf, cap_perf;
|
||||
|
||||
if (!cpudata->max_freq)
|
||||
return -ENODEV;
|
||||
@@ -670,8 +671,7 @@ static void amd_pstate_adjust_perf(unsig
|
||||
unsigned long target_perf,
|
||||
unsigned long capacity)
|
||||
{
|
||||
- unsigned long max_perf, min_perf, des_perf,
|
||||
- cap_perf, min_limit_perf;
|
||||
+ u8 max_perf, min_perf, des_perf, cap_perf, min_limit_perf;
|
||||
struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
|
||||
struct amd_cpudata *cpudata;
|
||||
|
||||
@@ -905,8 +905,8 @@ static int amd_pstate_init_freq(struct a
|
||||
{
|
||||
int ret;
|
||||
u32 min_freq, max_freq;
|
||||
- u32 highest_perf, nominal_perf, nominal_freq;
|
||||
- u32 lowest_nonlinear_perf, lowest_nonlinear_freq;
|
||||
+ u8 highest_perf, nominal_perf, lowest_nonlinear_perf;
|
||||
+ u32 nominal_freq, lowest_nonlinear_freq;
|
||||
struct cppc_perf_caps cppc_perf;
|
||||
|
||||
ret = cppc_get_perf_caps(cpudata->cpu, &cppc_perf);
|
||||
@@ -1113,7 +1113,7 @@ static ssize_t show_amd_pstate_lowest_no
|
||||
static ssize_t show_amd_pstate_highest_perf(struct cpufreq_policy *policy,
|
||||
char *buf)
|
||||
{
|
||||
- u32 perf;
|
||||
+ u8 perf;
|
||||
struct amd_cpudata *cpudata = policy->driver_data;
|
||||
|
||||
perf = READ_ONCE(cpudata->highest_perf);
|
||||
@@ -1124,7 +1124,7 @@ static ssize_t show_amd_pstate_highest_p
|
||||
static ssize_t show_amd_pstate_prefcore_ranking(struct cpufreq_policy *policy,
|
||||
char *buf)
|
||||
{
|
||||
- u32 perf;
|
||||
+ u8 perf;
|
||||
struct amd_cpudata *cpudata = policy->driver_data;
|
||||
|
||||
perf = READ_ONCE(cpudata->prefcore_ranking);
|
||||
@@ -1187,7 +1187,7 @@ static ssize_t show_energy_performance_p
|
||||
struct cpufreq_policy *policy, char *buf)
|
||||
{
|
||||
struct amd_cpudata *cpudata = policy->driver_data;
|
||||
- int preference;
|
||||
+ u8 preference;
|
||||
|
||||
switch (cpudata->epp_cached) {
|
||||
case AMD_CPPC_EPP_PERFORMANCE:
|
||||
@@ -1549,7 +1549,7 @@ static void amd_pstate_epp_cpu_exit(stru
|
||||
static int amd_pstate_epp_update_limit(struct cpufreq_policy *policy)
|
||||
{
|
||||
struct amd_cpudata *cpudata = policy->driver_data;
|
||||
- u32 epp;
|
||||
+ u8 epp;
|
||||
|
||||
amd_pstate_update_min_max_limit(policy);
|
||||
|
||||
@@ -1598,7 +1598,7 @@ static int amd_pstate_epp_set_policy(str
|
||||
static int amd_pstate_epp_reenable(struct cpufreq_policy *policy)
|
||||
{
|
||||
struct amd_cpudata *cpudata = policy->driver_data;
|
||||
- u64 max_perf;
|
||||
+ u8 max_perf;
|
||||
int ret;
|
||||
|
||||
ret = amd_pstate_cppc_enable(true);
|
||||
@@ -1635,7 +1635,7 @@ static int amd_pstate_epp_cpu_online(str
|
||||
static int amd_pstate_epp_cpu_offline(struct cpufreq_policy *policy)
|
||||
{
|
||||
struct amd_cpudata *cpudata = policy->driver_data;
|
||||
- int min_perf;
|
||||
+ u8 min_perf;
|
||||
|
||||
if (cpudata->suspended)
|
||||
return 0;
|
||||
--- a/drivers/cpufreq/amd-pstate.h
|
||||
+++ b/drivers/cpufreq/amd-pstate.h
|
||||
@@ -70,13 +70,13 @@ struct amd_cpudata {
|
||||
struct freq_qos_request req[2];
|
||||
u64 cppc_req_cached;
|
||||
|
||||
- u32 highest_perf;
|
||||
- u32 nominal_perf;
|
||||
- u32 lowest_nonlinear_perf;
|
||||
- u32 lowest_perf;
|
||||
- u32 prefcore_ranking;
|
||||
- u32 min_limit_perf;
|
||||
- u32 max_limit_perf;
|
||||
+ u8 highest_perf;
|
||||
+ u8 nominal_perf;
|
||||
+ u8 lowest_nonlinear_perf;
|
||||
+ u8 lowest_perf;
|
||||
+ u8 prefcore_ranking;
|
||||
+ u8 min_limit_perf;
|
||||
+ u8 max_limit_perf;
|
||||
u32 min_limit_freq;
|
||||
u32 max_limit_freq;
|
||||
|
||||
@@ -93,11 +93,11 @@ struct amd_cpudata {
|
||||
bool hw_prefcore;
|
||||
|
||||
/* EPP feature related attributes*/
|
||||
- s16 epp_cached;
|
||||
+ u8 epp_cached;
|
||||
u32 policy;
|
||||
u64 cppc_cap1_cached;
|
||||
bool suspended;
|
||||
- s16 epp_default;
|
||||
+ u8 epp_default;
|
||||
};
|
||||
|
||||
/*
|
@@ -1,4 +1,4 @@
|
||||
From b5b334f66595052e69ecaa501b8a6ebdb0fd6eed Mon Sep 17 00:00:00 2001
|
||||
From 47e014be8e6a12cdfa6502bd9c93df9f83ba2b40 Mon Sep 17 00:00:00 2001
|
||||
From: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>
|
||||
Date: Wed, 5 Feb 2025 11:25:22 +0000
|
||||
Subject: cpufreq/amd-pstate: Use scope based cleanup for cpufreq_policy refs
|
@@ -1,4 +1,4 @@
|
||||
From eff2c5a3f292e822968919a9792010de65b417b5 Mon Sep 17 00:00:00 2001
|
||||
From ca860ed821a42d909190ca3f33d9c8b2cae6fe52 Mon Sep 17 00:00:00 2001
|
||||
From: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>
|
||||
Date: Wed, 5 Feb 2025 11:25:23 +0000
|
||||
Subject: cpufreq/amd-pstate: Remove the unncecessary driver_lock in
|
@@ -1,4 +1,4 @@
|
||||
From e836285ca35390d656adffee520d48cd7bedd5b3 Mon Sep 17 00:00:00 2001
|
||||
From cfa4817d112187bb3e2c16dfc0a70da23dff02fb Mon Sep 17 00:00:00 2001
|
||||
From: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>
|
||||
Date: Sat, 22 Feb 2025 03:32:22 +0000
|
||||
Subject: cpufreq/amd-pstate: Fix the clamping of perf values
|
@@ -1,26 +0,0 @@
|
||||
From f50ac94149bc07092ecf5b68558f02920436f77c Mon Sep 17 00:00:00 2001
|
||||
From: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>
|
||||
Date: Wed, 5 Feb 2025 11:25:21 +0000
|
||||
Subject: cpufreq/amd-pstate: Add missing NULL ptr check in amd_pstate_update
|
||||
|
||||
Check if policy is NULL before dereferencing it in amd_pstate_update.
|
||||
|
||||
Fixes: e8f555daacd3 ("cpufreq/amd-pstate: fix setting policy current frequency value")
|
||||
Signed-off-by: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>
|
||||
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
|
||||
---
|
||||
drivers/cpufreq/amd-pstate.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
--- a/drivers/cpufreq/amd-pstate.c
|
||||
+++ b/drivers/cpufreq/amd-pstate.c
|
||||
@@ -551,6 +551,9 @@ static void amd_pstate_update(struct amd
|
||||
struct cpufreq_policy *policy = cpufreq_cpu_get(cpudata->cpu);
|
||||
u8 nominal_perf = READ_ONCE(cpudata->nominal_perf);
|
||||
|
||||
+ if (!policy)
|
||||
+ return;
|
||||
+
|
||||
des_perf = clamp_t(u8, des_perf, min_perf, max_perf);
|
||||
|
||||
policy->cur = perf_to_freq(cpudata, des_perf);
|
@@ -1,4 +1,4 @@
|
||||
From 0a417434299b27aebbb444e7545a7d668c40d288 Mon Sep 17 00:00:00 2001
|
||||
From 7f2dd53f1064ad9118a7346c154eb6b07535ccc1 Mon Sep 17 00:00:00 2001
|
||||
From: Mario Limonciello <mario.limonciello@amd.com>
|
||||
Date: Wed, 26 Feb 2025 01:49:16 -0600
|
||||
Subject: cpufreq/amd-pstate: Invalidate cppc_req_cached during suspend
|
@@ -1,4 +1,4 @@
|
||||
From ea1821eae465dfff9a9ef90662c2ce79e5abfe6e Mon Sep 17 00:00:00 2001
|
||||
From c37ee0cb65bd828d36ebe05bd3fea883685f8da3 Mon Sep 17 00:00:00 2001
|
||||
From: Mario Limonciello <mario.limonciello@amd.com>
|
||||
Date: Wed, 26 Feb 2025 01:49:17 -0600
|
||||
Subject: cpufreq/amd-pstate: Show a warning when a CPU fails to setup
|
@@ -1,4 +1,4 @@
|
||||
From 72016df62985637e59f075e25233d8ca942eb391 Mon Sep 17 00:00:00 2001
|
||||
From b4e1ebe4f5e836d9395383acc71f130846f925fb Mon Sep 17 00:00:00 2001
|
||||
From: Mario Limonciello <mario.limonciello@amd.com>
|
||||
Date: Wed, 26 Feb 2025 01:49:18 -0600
|
||||
Subject: cpufreq/amd-pstate: Drop min and max cached frequencies
|
@@ -1,4 +1,4 @@
|
||||
From 289c4432443c54497bfe75410a516ca24475504d Mon Sep 17 00:00:00 2001
|
||||
From 719a773ca04ac885a29b292ef5b64dd4c25f39fe Mon Sep 17 00:00:00 2001
|
||||
From: Mario Limonciello <mario.limonciello@amd.com>
|
||||
Date: Wed, 26 Feb 2025 01:49:19 -0600
|
||||
Subject: cpufreq/amd-pstate: Move perf values into a union
|
@@ -1,4 +1,4 @@
|
||||
From 34925ac1038d19197f0a2ac8574496e77645fdf5 Mon Sep 17 00:00:00 2001
|
||||
From 79ecccde4094c468608328a349c5fd16fbf2f43e Mon Sep 17 00:00:00 2001
|
||||
From: Mario Limonciello <mario.limonciello@amd.com>
|
||||
Date: Wed, 26 Feb 2025 01:49:20 -0600
|
||||
Subject: cpufreq/amd-pstate: Overhaul locking
|
@@ -1,4 +1,4 @@
|
||||
From 33c2b6f10f140e35f44d2be9bd8dc9eb459fb29a Mon Sep 17 00:00:00 2001
|
||||
From 2b570ed010d10b0c2531642a7e0eba7b942ac6d4 Mon Sep 17 00:00:00 2001
|
||||
From: Mario Limonciello <mario.limonciello@amd.com>
|
||||
Date: Wed, 26 Feb 2025 01:49:21 -0600
|
||||
Subject: cpufreq/amd-pstate: Drop `cppc_cap1_cached`
|
@@ -1,4 +1,4 @@
|
||||
From 22a3d411de53a42057ab0dc45bb00306fd855807 Mon Sep 17 00:00:00 2001
|
||||
From 47fac320cc620c0df7597d28394279d87f94e9a4 Mon Sep 17 00:00:00 2001
|
||||
From: Mario Limonciello <mario.limonciello@amd.com>
|
||||
Date: Wed, 26 Feb 2025 01:49:22 -0600
|
||||
Subject: cpufreq/amd-pstate-ut: Use _free macro to free put policy
|
@@ -1,4 +1,4 @@
|
||||
From e42e4d9ee2e953137488e531be82c4d2d1c10d1c Mon Sep 17 00:00:00 2001
|
||||
From 70f7a9af7ff80b58393e62168523c0a27f12da22 Mon Sep 17 00:00:00 2001
|
||||
From: Mario Limonciello <mario.limonciello@amd.com>
|
||||
Date: Wed, 26 Feb 2025 01:49:23 -0600
|
||||
Subject: cpufreq/amd-pstate-ut: Allow lowest nonlinear and lowest to be the
|
@@ -1,4 +1,4 @@
|
||||
From 141c02d0bbbca11a1fceae703a6b7dbfe6315b18 Mon Sep 17 00:00:00 2001
|
||||
From fc2391caced7c17d7228faf7fdff83fe01240888 Mon Sep 17 00:00:00 2001
|
||||
From: Mario Limonciello <mario.limonciello@amd.com>
|
||||
Date: Wed, 26 Feb 2025 01:49:24 -0600
|
||||
Subject: cpufreq/amd-pstate-ut: Drop SUCCESS and FAIL enums
|
@@ -1,4 +1,4 @@
|
||||
From 2fe00ce7f79ef57185bdd84e736d8bf47286eb8f Mon Sep 17 00:00:00 2001
|
||||
From c4b9333baaa421f7930f2c9f776dac1ba71999d0 Mon Sep 17 00:00:00 2001
|
||||
From: Mario Limonciello <mario.limonciello@amd.com>
|
||||
Date: Wed, 26 Feb 2025 01:49:25 -0600
|
||||
Subject: cpufreq/amd-pstate-ut: Run on all of the correct CPUs
|
@@ -1,4 +1,4 @@
|
||||
From 95bbcd16b467dceea295dbd97c7347e7dd15dabc Mon Sep 17 00:00:00 2001
|
||||
From 84e96fb98ef86f82afc0ab00c17bf263163ea5df Mon Sep 17 00:00:00 2001
|
||||
From: Mario Limonciello <mario.limonciello@amd.com>
|
||||
Date: Wed, 26 Feb 2025 01:49:26 -0600
|
||||
Subject: cpufreq/amd-pstate-ut: Adjust variable scope
|
@@ -1,4 +1,4 @@
|
||||
From 98519671cd3691a45f23a7de4862ec0642b5921e Mon Sep 17 00:00:00 2001
|
||||
From 0b5b3c1580120d99ab30a883086961138037a310 Mon Sep 17 00:00:00 2001
|
||||
From: Mario Limonciello <mario.limonciello@amd.com>
|
||||
Date: Wed, 26 Feb 2025 01:49:27 -0600
|
||||
Subject: cpufreq/amd-pstate: Replace all AMD_CPPC_* macros with masks
|
@@ -1,4 +1,4 @@
|
||||
From fc5fe86b4f63ed2ff8230c48e737185451e9c3a4 Mon Sep 17 00:00:00 2001
|
||||
From 47cc0c90ca4166b134bf13b959ba85a74dd62e6f Mon Sep 17 00:00:00 2001
|
||||
From: Mario Limonciello <mario.limonciello@amd.com>
|
||||
Date: Wed, 26 Feb 2025 01:49:28 -0600
|
||||
Subject: cpufreq/amd-pstate: Cache CPPC request in shared mem case too
|
@@ -1,4 +1,4 @@
|
||||
From e1b5c43aa7bf8d75d2043809ff38fee0b7d26259 Mon Sep 17 00:00:00 2001
|
||||
From f1030cf846b41bb466ca139da33d5cc743a8dca6 Mon Sep 17 00:00:00 2001
|
||||
From: Mario Limonciello <mario.limonciello@amd.com>
|
||||
Date: Wed, 26 Feb 2025 01:49:29 -0600
|
||||
Subject: cpufreq/amd-pstate: Move all EPP tracing into *_update_perf and
|
@@ -1,4 +1,4 @@
|
||||
From d53216c4c9f67163c9dec656862f1135d6f4af63 Mon Sep 17 00:00:00 2001
|
||||
From 0355adaaef43590373457b0a33195fa458cfecbc Mon Sep 17 00:00:00 2001
|
||||
From: Mario Limonciello <mario.limonciello@amd.com>
|
||||
Date: Wed, 26 Feb 2025 01:49:30 -0600
|
||||
Subject: cpufreq/amd-pstate: Update cppc_req_cached for shared mem EPP writes
|
@@ -1,4 +1,4 @@
|
||||
From cecd79d237f4b5d19adac7fb9d57c59c77e40547 Mon Sep 17 00:00:00 2001
|
||||
From 65fa376d4387463f1b06248ef590898c1ad35b46 Mon Sep 17 00:00:00 2001
|
||||
From: Mario Limonciello <mario.limonciello@amd.com>
|
||||
Date: Wed, 26 Feb 2025 01:49:31 -0600
|
||||
Subject: cpufreq/amd-pstate: Drop debug statements for policy setting
|
@@ -1,4 +1,4 @@
|
||||
From bbb0d5ec2d1d757fc7b71086f505113845cc2aab Mon Sep 17 00:00:00 2001
|
||||
From 394034d8e0bde7bd8bd482d4924f8883ff6f4cbe Mon Sep 17 00:00:00 2001
|
||||
From: Mario Limonciello <mario.limonciello@amd.com>
|
||||
Date: Wed, 26 Feb 2025 01:49:32 -0600
|
||||
Subject: cpufreq/amd-pstate: Rework CPPC enabling
|
@@ -1,4 +1,4 @@
|
||||
From f11b0be50d2c87af1a401397f8918015e15199c6 Mon Sep 17 00:00:00 2001
|
||||
From 50fccd9d8304b992bbea9088abe4ee33786d9805 Mon Sep 17 00:00:00 2001
|
||||
From: Mario Limonciello <mario.limonciello@amd.com>
|
||||
Date: Wed, 26 Feb 2025 01:49:33 -0600
|
||||
Subject: cpufreq/amd-pstate: Stop caching EPP
|
@@ -1,4 +1,4 @@
|
||||
From 509a6a82d6558983a84407e77aa398501b5c814a Mon Sep 17 00:00:00 2001
|
||||
From c940323e2d0e3f449f6a1c343c9d94f2e57c3eda Mon Sep 17 00:00:00 2001
|
||||
From: Mario Limonciello <mario.limonciello@amd.com>
|
||||
Date: Wed, 26 Feb 2025 01:49:34 -0600
|
||||
Subject: cpufreq/amd-pstate: Drop actions in amd_pstate_epp_cpu_offline()
|
@@ -1,4 +1,4 @@
|
||||
From 476817b414eddbf798161c3b33ef1209098bdf50 Mon Sep 17 00:00:00 2001
|
||||
From 401a66269205902153f18f78963e53cb14f99b83 Mon Sep 17 00:00:00 2001
|
||||
From: Mario Limonciello <superm1@kernel.org>
|
||||
Date: Thu, 27 Feb 2025 14:09:08 -0600
|
||||
Subject: cpufreq/amd-pstate: fix warning noticed by kernel test robot
|
@@ -0,0 +1,42 @@
|
||||
From 6b89403370ff0c33e2491dd700b601c438c7f9b2 Mon Sep 17 00:00:00 2001
|
||||
From: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>
|
||||
Date: Mon, 7 Apr 2025 08:19:26 +0000
|
||||
Subject: cpufreq/amd-pstate: Fix min_limit perf and freq updation for
|
||||
performance governor
|
||||
|
||||
The min_limit perf and freq values can get disconnected with performance
|
||||
governor, as we only modify the perf value in the special case. Fix that
|
||||
by modifying the perf and freq values together
|
||||
|
||||
Fixes: 009d1c29a451 ("cpufreq/amd-pstate: Move perf values into a union")
|
||||
Signed-off-by: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>
|
||||
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
|
||||
Link: https://lore.kernel.org/r/20250407081925.850473-1-dhananjay.ugwekar@amd.com
|
||||
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
|
||||
@@ -607,13 +607,16 @@ static void amd_pstate_update_min_max_li
|
||||
union perf_cached perf = READ_ONCE(cpudata->perf);
|
||||
|
||||
perf.max_limit_perf = freq_to_perf(perf, cpudata->nominal_freq, policy->max);
|
||||
- perf.min_limit_perf = freq_to_perf(perf, cpudata->nominal_freq, policy->min);
|
||||
+ WRITE_ONCE(cpudata->max_limit_freq, policy->max);
|
||||
|
||||
- if (cpudata->policy == CPUFREQ_POLICY_PERFORMANCE)
|
||||
+ if (cpudata->policy == CPUFREQ_POLICY_PERFORMANCE) {
|
||||
perf.min_limit_perf = min(perf.nominal_perf, perf.max_limit_perf);
|
||||
+ WRITE_ONCE(cpudata->min_limit_freq, min(cpudata->nominal_freq, cpudata->max_limit_freq));
|
||||
+ } else {
|
||||
+ perf.min_limit_perf = freq_to_perf(perf, cpudata->nominal_freq, policy->min);
|
||||
+ WRITE_ONCE(cpudata->min_limit_freq, policy->min);
|
||||
+ }
|
||||
|
||||
- WRITE_ONCE(cpudata->max_limit_freq, policy->max);
|
||||
- WRITE_ONCE(cpudata->min_limit_freq, policy->min);
|
||||
WRITE_ONCE(cpudata->perf, perf);
|
||||
}
|
||||
|
Reference in New Issue
Block a user