diff mbox series

[3/4] cpufreq/amd-pstate: Call cppc_set_epp_perf in the reenable function

Message ID 20241023102108.5980-4-Dhananjay.Ugwekar@amd.com (mailing list archive)
State Accepted, archived
Delegated to: Mario Limonciello
Headers show
Series cpufreq/amd-pstate:Cleanups | expand

Commit Message

Dhananjay Ugwekar Oct. 23, 2024, 10:21 a.m. UTC
The EPP value being set in perf_ctrls.energy_perf is not being propagated
to the shared memory, fix that.

Signed-off-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
---
 drivers/cpufreq/amd-pstate.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Yuan, Perry Oct. 24, 2024, 5:14 a.m. UTC | #1
[AMD Official Use Only - AMD Internal Distribution Only]

> -----Original Message-----
> From: Ugwekar, Dhananjay <Dhananjay.Ugwekar@amd.com>
> Sent: Wednesday, October 23, 2024 6:21 PM
> To: Shenoy, Gautham Ranjal <gautham.shenoy@amd.com>; Limonciello, Mario
> <Mario.Limonciello@amd.com>; Yuan, Perry <Perry.Yuan@amd.com>;
> rafael@kernel.org; viresh.kumar@linaro.org
> Cc: linux-pm@vger.kernel.org; linux-kernel@vger.kernel.org; Ugwekar, Dhananjay
> <Dhananjay.Ugwekar@amd.com>
> Subject: [PATCH 3/4] cpufreq/amd-pstate: Call cppc_set_epp_perf in the reenable
> function
>
> The EPP value being set in perf_ctrls.energy_perf is not being propagated to the
> shared memory, fix that.
>
> Signed-off-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
> ---
>  drivers/cpufreq/amd-pstate.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index
> 576251e61ce0..bbeddce90823 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -1616,8 +1616,9 @@ static void amd_pstate_epp_reenable(struct
> amd_cpudata *cpudata)
>               wrmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_REQ, value);
>       } else {
>               perf_ctrls.max_perf = max_perf;
> -             perf_ctrls.energy_perf =
> AMD_CPPC_ENERGY_PERF_PREF(cpudata->epp_cached);
>               cppc_set_perf(cpudata->cpu, &perf_ctrls);
> +             perf_ctrls.energy_perf =
> AMD_CPPC_ENERGY_PERF_PREF(cpudata->epp_cached);
> +             cppc_set_epp_perf(cpudata->cpu, &perf_ctrls, 1);
>       }
>  }
>
> @@ -1658,8 +1659,9 @@ static void amd_pstate_epp_offline(struct cpufreq_policy
> *policy)
>       } else {
>               perf_ctrls.desired_perf = 0;
>               perf_ctrls.max_perf = min_perf;
> -             perf_ctrls.energy_perf =
> AMD_CPPC_ENERGY_PERF_PREF(HWP_EPP_BALANCE_POWERSAVE);
>               cppc_set_perf(cpudata->cpu, &perf_ctrls);
> +             perf_ctrls.energy_perf =
> AMD_CPPC_ENERGY_PERF_PREF(HWP_EPP_BALANCE_POWERSAVE);
> +             cppc_set_epp_perf(cpudata->cpu, &perf_ctrls, 1);
>       }
>       mutex_unlock(&amd_pstate_limits_lock);
>  }
> --
> 2.34.1

LGTM, thanks.


Reviewed-by: Perry Yuan <perry.yuan@amd.com>


Best Regards.

Perry.
Gautham R. Shenoy Oct. 25, 2024, 4:24 p.m. UTC | #2
On Wed, Oct 23, 2024 at 10:21:10AM +0000, Dhananjay Ugwekar wrote:
> The EPP value being set in perf_ctrls.energy_perf is not being propagated
> to the shared memory, fix that.

Thanks for fixing this.

Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>

> 
> Signed-off-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
> ---
>  drivers/cpufreq/amd-pstate.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index 576251e61ce0..bbeddce90823 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -1616,8 +1616,9 @@ static void amd_pstate_epp_reenable(struct amd_cpudata *cpudata)
>  		wrmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_REQ, value);
>  	} else {
>  		perf_ctrls.max_perf = max_perf;
> -		perf_ctrls.energy_perf = AMD_CPPC_ENERGY_PERF_PREF(cpudata->epp_cached);
>  		cppc_set_perf(cpudata->cpu, &perf_ctrls);
> +		perf_ctrls.energy_perf = AMD_CPPC_ENERGY_PERF_PREF(cpudata->epp_cached);
> +		cppc_set_epp_perf(cpudata->cpu, &perf_ctrls, 1);
>  	}
>  }
>  
> @@ -1658,8 +1659,9 @@ static void amd_pstate_epp_offline(struct cpufreq_policy *policy)
>  	} else {
>  		perf_ctrls.desired_perf = 0;
>  		perf_ctrls.max_perf = min_perf;
> -		perf_ctrls.energy_perf = AMD_CPPC_ENERGY_PERF_PREF(HWP_EPP_BALANCE_POWERSAVE);
>  		cppc_set_perf(cpudata->cpu, &perf_ctrls);
> +		perf_ctrls.energy_perf = AMD_CPPC_ENERGY_PERF_PREF(HWP_EPP_BALANCE_POWERSAVE);
> +		cppc_set_epp_perf(cpudata->cpu, &perf_ctrls, 1);
>  	}
>  	mutex_unlock(&amd_pstate_limits_lock);
>  }
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index 576251e61ce0..bbeddce90823 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -1616,8 +1616,9 @@  static void amd_pstate_epp_reenable(struct amd_cpudata *cpudata)
 		wrmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_REQ, value);
 	} else {
 		perf_ctrls.max_perf = max_perf;
-		perf_ctrls.energy_perf = AMD_CPPC_ENERGY_PERF_PREF(cpudata->epp_cached);
 		cppc_set_perf(cpudata->cpu, &perf_ctrls);
+		perf_ctrls.energy_perf = AMD_CPPC_ENERGY_PERF_PREF(cpudata->epp_cached);
+		cppc_set_epp_perf(cpudata->cpu, &perf_ctrls, 1);
 	}
 }
 
@@ -1658,8 +1659,9 @@  static void amd_pstate_epp_offline(struct cpufreq_policy *policy)
 	} else {
 		perf_ctrls.desired_perf = 0;
 		perf_ctrls.max_perf = min_perf;
-		perf_ctrls.energy_perf = AMD_CPPC_ENERGY_PERF_PREF(HWP_EPP_BALANCE_POWERSAVE);
 		cppc_set_perf(cpudata->cpu, &perf_ctrls);
+		perf_ctrls.energy_perf = AMD_CPPC_ENERGY_PERF_PREF(HWP_EPP_BALANCE_POWERSAVE);
+		cppc_set_epp_perf(cpudata->cpu, &perf_ctrls, 1);
 	}
 	mutex_unlock(&amd_pstate_limits_lock);
 }