mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
To: <rafael@kernel.org>, <viresh.kumar@linaro.org>,
	<gautham.shenoy@amd.com>, <mario.limonciello@amd.com>,
	<perry.yuan@amd.com>, <skhan@linuxfoundation.org>,
	<li.meng@amd.com>, <ray.huang@amd.com>
Cc: <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	"Dhananjay Ugwekar" <Dhananjay.Ugwekar@amd.com>
Subject: [PATCH 2/2] cpufreq/amd-pstate: Fix the scaling_min/max_freq setting on shared memory CPPC systems
Date: Tue, 25 Jun 2024 13:41:29 +0000	[thread overview]
Message-ID: <20240625134127.4464-3-Dhananjay.Ugwekar@amd.com> (raw)
In-Reply-To: <20240625134127.4464-1-Dhananjay.Ugwekar@amd.com>

On shared memory CPPC systems, with amd_pstate=active mode, the change
in scaling_min/max_freq doesn't get written to the shared memory
region. Due to this, the writes to the scaling_min/max_freq sysfs file
don't take effect. Fix this by propagating the scaling_min/max_freq
changes to the shared memory region.

Fixes: ffa5096a7c33 ("cpufreq: amd-pstate: implement Pstate EPP support for the AMD processors")
Signed-off-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
---
 drivers/cpufreq/amd-pstate.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index 9ad62dbe8bfb..7c1c96abe5bd 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -264,6 +264,15 @@ static int amd_pstate_set_epp(struct amd_cpudata *cpudata, u32 epp)
 			cpudata->epp_cached = epp;
 	} else {
 		perf_ctrls.energy_perf = epp;
+		perf_ctrls.max_perf = cpudata->max_limit_perf;
+		perf_ctrls.min_perf = cpudata->min_limit_perf;
+		perf_ctrls.desired_perf = 0U;
+
+		ret = cppc_set_perf(cpudata->cpu, &perf_ctrls);
+		if (ret) {
+			pr_debug("failed to set min max limits (%d)\n", ret);
+			return ret;
+		}
 		ret = cppc_set_epp_perf(cpudata->cpu, &perf_ctrls, 1);
 		if (ret) {
 			pr_debug("failed to set energy perf value (%d)\n", ret);
@@ -1547,6 +1556,7 @@ static void amd_pstate_epp_update_limit(struct cpufreq_policy *policy)
 	}
 
 	WRITE_ONCE(cpudata->cppc_req_cached, value);
+
 	amd_pstate_set_epp(cpudata, epp);
 }
 
-- 
2.34.1


  parent reply	other threads:[~2024-06-25 13:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-25 13:41 [PATCH 0/2] AMD Pstate driver fixes Dhananjay Ugwekar
2024-06-25 13:41 ` [PATCH 1/2] cpufreq/amd-pstate-ut: Handle the inconsistency Dhananjay Ugwekar
2024-06-25 13:51   ` Dhananjay Ugwekar
2024-06-25 15:11     ` Mario Limonciello
2024-06-26  7:56       ` Dhananjay Ugwekar
2024-06-26  1:49     ` Meng, Li (Jassmine)
2024-06-26  5:22       ` Gautham R.Shenoy
2024-06-26  6:45         ` Dhananjay Ugwekar
2024-06-25 15:05   ` Mario Limonciello
2024-06-26  8:02     ` Dhananjay Ugwekar
2024-06-25 13:41 ` Dhananjay Ugwekar [this message]
2024-06-25 15:09   ` [PATCH 2/2] cpufreq/amd-pstate: Fix the scaling_min/max_freq setting on shared memory CPPC systems Mario Limonciello
2024-06-26  8:10     ` Dhananjay Ugwekar
2024-06-26  5:24   ` Gautham R.Shenoy
2024-06-26  7:57     ` Dhananjay Ugwekar

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=20240625134127.4464-3-Dhananjay.Ugwekar@amd.com \
    --to=dhananjay.ugwekar@amd.com \
    --cc=gautham.shenoy@amd.com \
    --cc=li.meng@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=perry.yuan@amd.com \
    --cc=rafael@kernel.org \
    --cc=ray.huang@amd.com \
    --cc=skhan@linuxfoundation.org \
    --cc=viresh.kumar@linaro.org \
    /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

all inboxes | Powered by JetHome®