Re: [PATCH 10/14] cpufreq/amd-pstate: Update cppc_req_cached for shared mem EPP writes
From: Dhananjay Ugwekar
Date: Tue Feb 11 2025 - 08:02:13 EST
On 2/7/2025 3:26 AM, Mario Limonciello wrote:
> From: Mario Limonciello <mario.limonciello@xxxxxxx>
>
> On EPP only writes update the cached variable so that the min/max
> performance controls don't need to be updated again.
Looks good to me,
Reviewed-by: Dhananjay Ugwekar <dhananjay.ugwekar@xxxxxxx>
Thanks,
Dhananjay
>
> Signed-off-by: Mario Limonciello <mario.limonciello@xxxxxxx>
> ---
> drivers/cpufreq/amd-pstate.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index e66ccfce5893f..754f2d606b371 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -338,6 +338,7 @@ static int shmem_set_epp(struct cpufreq_policy *policy, u8 epp)
> {
> struct amd_cpudata *cpudata = policy->driver_data;
> struct cppc_perf_ctrls perf_ctrls;
> + u64 value;
> int ret;
>
> lockdep_assert_held(&cpudata->lock);
> @@ -366,6 +367,11 @@ static int shmem_set_epp(struct cpufreq_policy *policy, u8 epp)
> }
> WRITE_ONCE(cpudata->epp_cached, epp);
>
> + value = READ_ONCE(cpudata->cppc_req_cached);
> + value &= ~AMD_CPPC_EPP_PERF_MASK;
> + value |= FIELD_PREP(AMD_CPPC_EPP_PERF_MASK, epp);
> + WRITE_ONCE(cpudata->cppc_req_cached, value);
> +
> return ret;
> }
>