mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christian Loehle <christian.loehle@arm.com>
To: "Mario Limonciello (AMD)" <superm1@kernel.org>,
	"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 <mario.limonciello@amd.com>
Subject: Re: [PATCH v3 3/3] cpufreq/amd-pstate: Get Highest Freq for a CPU
Date: Thu, 1 Oct 2026 11:03:01 +0100	[thread overview]
Message-ID: <5b748ac7-26da-4010-bfc8-014a0c97abe2@arm.com> (raw)
In-Reply-To: <20260924160052.2858456-4-superm1@kernel.org>

On 9/24/26 17:00, Mario Limonciello (AMD) wrote:
> From: Mario Limonciello <mario.limonciello@amd.com>
> 
> If the highest frequency is known for a CPU, use this instead of
> trying to calculate by linear interpolation.
> 
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
>  drivers/cpufreq/amd-pstate.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index 496e0342c1c90..2a0cbfe21a67d 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -1102,8 +1102,10 @@ static int amd_pstate_init_freq(struct amd_cpudata *cpudata)
>  
>  	WRITE_ONCE(cpudata->nominal_freq, nominal_freq);
>  
> -	/* max_freq is calculated according to (nominal_freq * highest_perf)/nominal_perf */
> -	max_freq = perf_to_freq(perf, nominal_freq, perf.highest_perf);
> +	/* try to look up from BIOS/quirk first, fall back to (nominal_freq * highest_perf)/nominal_perf */
> +	max_freq = amd_get_max_frequency(cpudata->cpu) * 1000;
> +	if (!max_freq)
> +		max_freq = perf_to_freq(perf, nominal_freq, perf.highest_perf);

Don't you need to align freq_to_perf() (or the callers) for the BIOS-overwrite case too?
amd_pstate_update_min_max_limit() still uses the nominal-based conversion for policy->max,
so the new maximum frequency maps back to highest_perf on each core type?
(and we end up with max_limit_perf < highest_perf if the BIOS-overwrite values are below
the interpolation result.)


>  	WRITE_ONCE(cpudata->max_freq, max_freq);
>  
>  	lowest_nonlinear_freq = perf_to_freq(perf, nominal_freq, perf.lowest_nonlinear_perf);


      reply	other threads:[~2026-10-01 10:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-24 16:00 [PATCH v3 0/3] Zen6 client CPPC Mario Limonciello (AMD)
2026-09-24 16:00 ` [PATCH v3 1/3] ACPI: CPPC: Refactor boost ratio handling Mario Limonciello (AMD)
2026-09-25  9:40   ` Christian Loehle
2026-09-25 14:54     ` Mario Limonciello
2026-09-30 19:37       ` Rafael J. Wysocki (Intel)
2026-09-30 19:41         ` Mario Limonciello
2026-09-30 19:43           ` Rafael J. Wysocki (Intel)
2026-09-30 19:45             ` Mario Limonciello
2026-09-24 16:00 ` [PATCH v3 2/3] cpufreq/acpi-cpufreq: Use amd_get_boost_ratio() Mario Limonciello (AMD)
2026-09-24 16:00 ` [PATCH v3 3/3] cpufreq/amd-pstate: Get Highest Freq for a CPU Mario Limonciello (AMD)
2026-10-01 10:03   ` Christian Loehle [this message]

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=5b748ac7-26da-4010-bfc8-014a0c97abe2@arm.com \
    --to=christian.loehle@arm.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=rafael@kernel.org \
    --cc=superm1@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

all inboxes | Powered by JetHome®