From: "Mario Limonciello (AMD)" <superm1@kernel.org>
To: "Rafael J . Wysocki ⏎" <rafael@kernel.org>
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-pm@vger.kernel.org,
K Prateek Nayak <kprateek.nayak@amd.com>,
x86@kernel.org, Mario Limonciello <superm1@kernel.org>
Subject: [PATCH 5/6] cpufreq/acpi-cpufreq: Use amd_get_boost_ratio()
Date: Sun, 26 Apr 2026 22:55:19 -0500 [thread overview]
Message-ID: <20260427035520.1427080-6-superm1@kernel.org> (raw)
In-Reply-To: <20260427035520.1427080-1-superm1@kernel.org>
Update get_max_boost_ratio() to use the new amd_get_boost_ratio()
helper function instead of calling amd_get_effective_highest_perf()
directly.
This ensures the boost ratio is calculated correctly on systems where
frequency values should be used instead of performance values.
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
---
drivers/cpufreq/acpi-cpufreq.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
index a1a005b29daba..6e80540311f60 100644
--- a/drivers/cpufreq/acpi-cpufreq.c
+++ b/drivers/cpufreq/acpi-cpufreq.c
@@ -626,7 +626,7 @@ static int acpi_cpufreq_blacklist(struct cpuinfo_x86 *c)
static u64 get_max_boost_ratio(unsigned int cpu, u64 *nominal_freq)
{
struct cppc_perf_caps perf_caps;
- u64 highest_perf, nominal_perf;
+ u64 numerator, denominator;
int ret;
if (acpi_pstate_strict)
@@ -640,33 +640,31 @@ static u64 get_max_boost_ratio(unsigned int cpu, u64 *nominal_freq)
}
if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) {
- ret = amd_get_effective_highest_perf(cpu);
- if (ret < 0) {
- pr_debug("CPU%d: Unable to get boost ratio numerator (%d)\n",
+ ret = amd_get_boost_ratio(cpu, &numerator, &denominator);
+ if (ret) {
+ pr_debug("CPU%d: Unable to get boost ratio (%d)\n",
cpu, ret);
return 0;
}
- highest_perf = ret;
} else {
- highest_perf = perf_caps.highest_perf;
+ numerator = perf_caps.highest_perf;
+ denominator = perf_caps.nominal_perf;
}
- nominal_perf = perf_caps.nominal_perf;
-
if (nominal_freq)
*nominal_freq = perf_caps.nominal_freq * 1000;
- if (!highest_perf || !nominal_perf) {
+ if (!numerator || !denominator) {
pr_debug("CPU%d: highest or nominal performance missing\n", cpu);
return 0;
}
- if (highest_perf < nominal_perf) {
+ if (numerator < denominator) {
pr_debug("CPU%d: nominal performance above highest\n", cpu);
return 0;
}
- return div_u64(highest_perf << SCHED_CAPACITY_SHIFT, nominal_perf);
+ return div_u64(numerator << SCHED_CAPACITY_SHIFT, denominator);
}
#else
--
2.43.0
next prev parent reply other threads:[~2026-04-27 3:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-27 3:55 [PATCH 0/6] Add CPPC HighestFreq support Mario Limonciello (AMD)
2026-04-27 3:55 ` [PATCH 1/6] Revert "ACPI: CPPC: Adjust debug messages in amd_set_max_freq_ratio() to warn" Mario Limonciello (AMD)
2026-04-27 3:55 ` [PATCH 2/6] ACPI: Add CPPC v4 definitions Mario Limonciello (AMD)
2026-04-27 3:55 ` [PATCH 3/6] ACPI: CPPC: Add support for reading HighestFreq Mario Limonciello (AMD)
2026-04-27 3:55 ` [PATCH 4/6] ACPI: CPPC: Refactor boost ratio handling Mario Limonciello (AMD)
2026-04-27 3:55 ` Mario Limonciello (AMD) [this message]
2026-04-27 3:55 ` [PATCH 6/6] cpufreq/amd-pstate: Get highest freq from CPPC if available Mario Limonciello (AMD)
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=20260427035520.1427080-6-superm1@kernel.org \
--to=superm1@kernel.org \
--cc=kprateek.nayak@amd.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=x86@kernel.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