mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
cpufreq/amd-pstate: Fix the scaling_max_freq setting on shared memory CPPC systems
[ Upstream commit 738d7d03571c7e38565bd245c0815a2c74665018 ]
On shared memory CPPC systems, with amd_pstate=active mode, the change
in scaling_max_freq doesn't get written to the shared memory
region. Due to this, the writes to the scaling_max_freq sysfs file
don't take effect. Fix this by propagating the scaling_max_freq
changes to the shared memory region.
Fixes: ffa5096a7c
("cpufreq: amd-pstate: implement Pstate EPP support for the AMD processors")
Reported-by: David Arcari <darcari@redhat.com>
Signed-off-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20240702081413.5688-3-Dhananjay.Ugwekar@amd.com
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
72ff9d2696
commit
13a71384ae
1 changed files with 23 additions and 20 deletions
|
@ -175,6 +175,26 @@ static int amd_pstate_get_energy_pref_index(struct amd_cpudata *cpudata)
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void pstate_update_perf(struct amd_cpudata *cpudata, u32 min_perf,
|
||||||
|
u32 des_perf, u32 max_perf, bool fast_switch)
|
||||||
|
{
|
||||||
|
if (fast_switch)
|
||||||
|
wrmsrl(MSR_AMD_CPPC_REQ, READ_ONCE(cpudata->cppc_req_cached));
|
||||||
|
else
|
||||||
|
wrmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_REQ,
|
||||||
|
READ_ONCE(cpudata->cppc_req_cached));
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_STATIC_CALL(amd_pstate_update_perf, pstate_update_perf);
|
||||||
|
|
||||||
|
static inline void amd_pstate_update_perf(struct amd_cpudata *cpudata,
|
||||||
|
u32 min_perf, u32 des_perf,
|
||||||
|
u32 max_perf, bool fast_switch)
|
||||||
|
{
|
||||||
|
static_call(amd_pstate_update_perf)(cpudata, min_perf, des_perf,
|
||||||
|
max_perf, fast_switch);
|
||||||
|
}
|
||||||
|
|
||||||
static int amd_pstate_set_epp(struct amd_cpudata *cpudata, u32 epp)
|
static int amd_pstate_set_epp(struct amd_cpudata *cpudata, u32 epp)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -191,6 +211,9 @@ static int amd_pstate_set_epp(struct amd_cpudata *cpudata, u32 epp)
|
||||||
if (!ret)
|
if (!ret)
|
||||||
cpudata->epp_cached = epp;
|
cpudata->epp_cached = epp;
|
||||||
} else {
|
} else {
|
||||||
|
amd_pstate_update_perf(cpudata, cpudata->min_limit_perf, 0U,
|
||||||
|
cpudata->max_limit_perf, false);
|
||||||
|
|
||||||
perf_ctrls.energy_perf = epp;
|
perf_ctrls.energy_perf = epp;
|
||||||
ret = cppc_set_epp_perf(cpudata->cpu, &perf_ctrls, 1);
|
ret = cppc_set_epp_perf(cpudata->cpu, &perf_ctrls, 1);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -361,16 +384,6 @@ static inline int amd_pstate_init_perf(struct amd_cpudata *cpudata)
|
||||||
return static_call(amd_pstate_init_perf)(cpudata);
|
return static_call(amd_pstate_init_perf)(cpudata);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pstate_update_perf(struct amd_cpudata *cpudata, u32 min_perf,
|
|
||||||
u32 des_perf, u32 max_perf, bool fast_switch)
|
|
||||||
{
|
|
||||||
if (fast_switch)
|
|
||||||
wrmsrl(MSR_AMD_CPPC_REQ, READ_ONCE(cpudata->cppc_req_cached));
|
|
||||||
else
|
|
||||||
wrmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_REQ,
|
|
||||||
READ_ONCE(cpudata->cppc_req_cached));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void cppc_update_perf(struct amd_cpudata *cpudata,
|
static void cppc_update_perf(struct amd_cpudata *cpudata,
|
||||||
u32 min_perf, u32 des_perf,
|
u32 min_perf, u32 des_perf,
|
||||||
u32 max_perf, bool fast_switch)
|
u32 max_perf, bool fast_switch)
|
||||||
|
@ -384,16 +397,6 @@ static void cppc_update_perf(struct amd_cpudata *cpudata,
|
||||||
cppc_set_perf(cpudata->cpu, &perf_ctrls);
|
cppc_set_perf(cpudata->cpu, &perf_ctrls);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_STATIC_CALL(amd_pstate_update_perf, pstate_update_perf);
|
|
||||||
|
|
||||||
static inline void amd_pstate_update_perf(struct amd_cpudata *cpudata,
|
|
||||||
u32 min_perf, u32 des_perf,
|
|
||||||
u32 max_perf, bool fast_switch)
|
|
||||||
{
|
|
||||||
static_call(amd_pstate_update_perf)(cpudata, min_perf, des_perf,
|
|
||||||
max_perf, fast_switch);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool amd_pstate_sample(struct amd_cpudata *cpudata)
|
static inline bool amd_pstate_sample(struct amd_cpudata *cpudata)
|
||||||
{
|
{
|
||||||
u64 aperf, mperf, tsc;
|
u64 aperf, mperf, tsc;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue