public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Mario Limonciello <mario.limonciello@amd.com>
To: <perry.yuan@amd.com>, <gautham.shenoy@amd.com>
Cc: Linux PM <linux-pm@vger.kernel.org>,
	Perry Yuan <Perry.Yuan@amd.com>, Huang Rui <ray.huang@amd.com>,
	Mario Limonciello <mario.limonciello@amd.com>
Subject: [PATCH v14 3/5] cpufreq: amd-pstate: Cap the CPPC.max_perf to nominal_perf if CPB is off
Date: Mon, 24 Jun 2024 16:33:58 -0500	[thread overview]
Message-ID: <20240624213400.67773-4-mario.limonciello@amd.com> (raw)
In-Reply-To: <20240624213400.67773-1-mario.limonciello@amd.com>

From: Perry Yuan <Perry.Yuan@amd.com>

When Core Performance Boost is disabled by the user, the
CPPC_REQ.max_perf should not exceed the nominal_perf since by definition
the frequencies between nominal_perf and the highest_perf are in the
boost range. Fix this in amd_pstate_update()

Acked-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Signed-off-by: Perry Yuan <Perry.Yuan@amd.com>
Link: https://lore.kernel.org/r/66f55232be01092c423f0523f68b82b80c293943.1718988436.git.perry.yuan@amd.com
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 drivers/cpufreq/amd-pstate.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index 10cce7023208..6992f6169919 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -514,6 +514,7 @@ static void amd_pstate_update(struct amd_cpudata *cpudata, u32 min_perf,
 	unsigned long max_freq;
 	struct cpufreq_policy *policy = cpufreq_cpu_get(cpudata->cpu);
 	u64 prev = READ_ONCE(cpudata->cppc_req_cached);
+	u32 nominal_perf = READ_ONCE(cpudata->nominal_perf);
 	u64 value = prev;
 
 	min_perf = clamp_t(unsigned long, min_perf, cpudata->min_limit_perf,
@@ -536,6 +537,10 @@ static void amd_pstate_update(struct amd_cpudata *cpudata, u32 min_perf,
 	value &= ~AMD_CPPC_DES_PERF(~0L);
 	value |= AMD_CPPC_DES_PERF(des_perf);
 
+	/* limit the max perf when core performance boost feature is disabled */
+	if (!cpudata->boost_supported)
+		max_perf = min_t(unsigned long, nominal_perf, max_perf);
+
 	value &= ~AMD_CPPC_MAX_PERF(~0L);
 	value |= AMD_CPPC_MAX_PERF(max_perf);
 
-- 
2.43.0


  parent reply	other threads:[~2024-06-24 21:34 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-24 21:33 [PATCH v14 0/5] AMD Pstate Driver Core Performance Boost Mario Limonciello
2024-06-24 21:33 ` [PATCH v14 1/5] cpufreq: acpi: move MSR_K7_HWCR_CPB_DIS_BIT into msr-index.h Mario Limonciello
2024-06-24 21:33 ` [PATCH v14 2/5] cpufreq: amd-pstate: initialize core precision boost state Mario Limonciello
2024-06-24 21:33 ` Mario Limonciello [this message]
2024-06-24 21:33 ` [PATCH v14 4/5] Documentation: cpufreq: amd-pstate: update doc for Per CPU boost control method Mario Limonciello
2024-06-25 12:03   ` Gautham R.Shenoy
2024-06-24 21:34 ` [PATCH v14 5/5] cpufreq: Only disable boost during cpu online when using frequency tables Mario Limonciello
2024-06-25  6:30   ` Viresh Kumar
2024-06-25 12:31     ` Mario Limonciello
2024-06-26  3:11       ` Viresh Kumar
2024-06-26  3:14         ` Mario Limonciello
2024-06-26  3:17           ` Viresh Kumar
2024-06-26  3:20             ` Mario Limonciello
2024-06-26  3:25               ` Viresh Kumar
2024-06-26  3:27                 ` Viresh Kumar
2024-06-26  3:33                   ` Mario Limonciello
2024-06-26  3:44                     ` Viresh Kumar
2024-06-26  3:46                       ` Mario Limonciello
2024-06-25 11:55   ` Gautham R.Shenoy
2024-06-25 12:32     ` Mario Limonciello

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=20240624213400.67773-4-mario.limonciello@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=gautham.shenoy@amd.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=perry.yuan@amd.com \
    --cc=ray.huang@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