diff mbox series

[2/5] cpufreq/amd-pstate: Move the invocation of amd_pstate_update_perf()

Message ID 20241204144842.164178-3-Dhananjay.Ugwekar@amd.com
State New
Headers show
Series cpufreq/amd-pstate: Reuse and refactor code | expand

Commit Message

Dhananjay Ugwekar Dec. 4, 2024, 2:48 p.m. UTC
amd_pstate_update_perf() should not be a part of shmem_set_epp() function,
so move it to the amd_pstate_epp_update_limit() function, where it is needed.

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

Comments

Gautham R. Shenoy Dec. 6, 2024, 4:45 a.m. UTC | #1
On Wed, Dec 04, 2024 at 02:48:39PM +0000, Dhananjay Ugwekar wrote:
> amd_pstate_update_perf() should not be a part of shmem_set_epp() function,
> so move it to the amd_pstate_epp_update_limit() function, where it is needed.
> 
> Signed-off-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>


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

--
Thanks and Regards
gautham.

> ---
>  drivers/cpufreq/amd-pstate.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index d391e8cafeca..a1b2393cef22 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -296,9 +296,6 @@ static int shmem_set_epp(struct amd_cpudata *cpudata, u32 epp)
>  	int ret;
>  	struct cppc_perf_ctrls perf_ctrls;
>  
> -	amd_pstate_update_perf(cpudata, cpudata->min_limit_perf, 0U,
> -				     cpudata->max_limit_perf, false);
> -
>  	perf_ctrls.energy_perf = epp;
>  	ret = cppc_set_epp_perf(cpudata->cpu, &perf_ctrls, 1);
>  	if (ret) {
> @@ -1598,6 +1595,10 @@ static int amd_pstate_epp_update_limit(struct cpufreq_policy *policy)
>  		epp = 0;
>  
>  	WRITE_ONCE(cpudata->cppc_req_cached, value);
> +
> +	amd_pstate_update_perf(cpudata, cpudata->min_limit_perf, 0U,
> +			       cpudata->max_limit_perf, false);
> +
>  	return amd_pstate_set_epp(cpudata, epp);
>  }
>  
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index d391e8cafeca..a1b2393cef22 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -296,9 +296,6 @@  static int shmem_set_epp(struct amd_cpudata *cpudata, u32 epp)
 	int ret;
 	struct cppc_perf_ctrls perf_ctrls;
 
-	amd_pstate_update_perf(cpudata, cpudata->min_limit_perf, 0U,
-				     cpudata->max_limit_perf, false);
-
 	perf_ctrls.energy_perf = epp;
 	ret = cppc_set_epp_perf(cpudata->cpu, &perf_ctrls, 1);
 	if (ret) {
@@ -1598,6 +1595,10 @@  static int amd_pstate_epp_update_limit(struct cpufreq_policy *policy)
 		epp = 0;
 
 	WRITE_ONCE(cpudata->cppc_req_cached, value);
+
+	amd_pstate_update_perf(cpudata, cpudata->min_limit_perf, 0U,
+			       cpudata->max_limit_perf, false);
+
 	return amd_pstate_set_epp(cpudata, epp);
 }