The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Mario Limonciello <mario.limonciello@amd.com>
To: "Gautham R . Shenoy" <gautham.shenoy@amd.com>
Cc: Perry Yuan <perry.yuan@amd.com>, <linux-kernel@vger.kernel.org>,
	<linux-pm@vger.kernel.org>,
	Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>,
	Mario Limonciello <mario.limonciello@amd.com>
Subject: [PATCH 3/4] cpufreq/amd-pstate: Use amd_pstate_update_min_max_limit() for EPP limits
Date: Sat, 12 Oct 2024 12:45:18 -0500	[thread overview]
Message-ID: <20241012174519.897-3-mario.limonciello@amd.com> (raw)
In-Reply-To: <20241012174519.897-1-mario.limonciello@amd.com>

When the EPP updates are set the maximum capable frequency for the
CPU is used to set the upper limit instead of that of the policy.

Adjust amd_pstate_epp_update_limit() to reuse policy calculation code
from amd_pstate_update_min_max_limit().

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 drivers/cpufreq/amd-pstate.c | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index 13dec8b1e7a8..8d2541f2c74b 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -1485,26 +1485,13 @@ static void amd_pstate_epp_cpu_exit(struct cpufreq_policy *policy)
 static int amd_pstate_epp_update_limit(struct cpufreq_policy *policy)
 {
 	struct amd_cpudata *cpudata = policy->driver_data;
-	u32 max_perf, min_perf, min_limit_perf, max_limit_perf;
+	u32 max_perf, min_perf;
 	u64 value;
 	s16 epp;
 
-	if (cpudata->boost_supported && !policy->boost_enabled)
-		max_perf = READ_ONCE(cpudata->nominal_perf);
-	else
-		max_perf = READ_ONCE(cpudata->highest_perf);
+	max_perf = READ_ONCE(cpudata->highest_perf);
 	min_perf = READ_ONCE(cpudata->lowest_perf);
-	max_limit_perf = div_u64(policy->max * max_perf, policy->cpuinfo.max_freq);
-	min_limit_perf = div_u64(policy->min * max_perf, policy->cpuinfo.max_freq);
-
-	if (min_limit_perf < min_perf)
-		min_limit_perf = min_perf;
-
-	if (max_limit_perf < min_limit_perf)
-		max_limit_perf = min_limit_perf;
-
-	WRITE_ONCE(cpudata->max_limit_perf, max_limit_perf);
-	WRITE_ONCE(cpudata->min_limit_perf, min_limit_perf);
+	amd_pstate_update_min_max_limit(policy);
 
 	max_perf = clamp_t(unsigned long, max_perf, cpudata->min_limit_perf,
 			cpudata->max_limit_perf);
-- 
2.43.0


  parent reply	other threads:[~2024-10-12 17:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-12 17:45 [PATCH 1/4] cpufreq/amd-pstate: Use nominal perf for limits when boost is disabled Mario Limonciello
2024-10-12 17:45 ` [PATCH 2/4] cpufreq/amd-pstate: Don't update CPPC request in amd_pstate_cpu_boost_update() Mario Limonciello
2024-10-16  4:42   ` Yuan, Perry
2024-10-16  9:50     ` Gautham R. Shenoy
2024-10-12 17:45 ` Mario Limonciello [this message]
2024-10-16  4:38   ` [PATCH 3/4] cpufreq/amd-pstate: Use amd_pstate_update_min_max_limit() for EPP limits Yuan, Perry
2024-10-16 10:14   ` Gautham R. Shenoy
2024-10-12 17:45 ` [PATCH 4/4] cpufreq/amd-pstate: Drop needless EPP initialization Mario Limonciello
2024-10-15  9:07   ` Dhananjay Ugwekar
2024-10-16  4:33   ` Yuan, Perry
2024-10-16 10:33   ` Gautham R. Shenoy
2024-10-16  4:10 ` [PATCH 1/4] cpufreq/amd-pstate: Use nominal perf for limits when boost is disabled Gautham R. Shenoy
2024-10-16  4:45 ` Yuan, Perry

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241012174519.897-3-mario.limonciello@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=Dhananjay.Ugwekar@amd.com \
    --cc=gautham.shenoy@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=perry.yuan@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox