From: srinivas pandruvada <srinivas.pandruvada@linux.intel.com>
To: Xueqin Luo <luoxueqin@kylinos.cn>,
rafael@kernel.org, lenb@kernel.org, viresh.kumar@linaro.org,
saket.dumbre@intel.com, linux-acpi@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
acpica-devel@lists.linux.dev
Subject: Re: [PATCH] ACPI: CPPC: Add helper to get effective guaranteed performance
Date: Fri, 29 May 2026 08:33:19 -0700 [thread overview]
Message-ID: <60119eb883057391dc6def200be119e56a6e4fb5.camel@linux.intel.com> (raw)
In-Reply-To: <20260529081801.29346-1-luoxueqin@kylinos.cn>
On Fri, 2026-05-29 at 16:18 +0800, Xueqin Luo wrote:
> According to the ACPI CPPC specification, if the Guaranteed
> Performance register is not implemented, OSPM assumes the
> guaranteed performance is equal to nominal performance.
>
> Add cppc_get_effective_guaranteed_perf() helper to provide a
> spec-compliant effective guaranteed performance value while
> preserving the raw values returned by cppc_get_perf_caps().
>
Hi Luo,
Are you trying to fix any issue where you have issue with
"base_frequency" display? intel_pstate will revert to native MSR, which
is always present when we are using CPPC.
I worry about some bad nominal perf in some platforms as we will be
dependent on OEM BIOS.
Thanks,
Srinivas
> Signed-off-by: Xueqin Luo <luoxueqin@kylinos.cn>
> ---
> drivers/acpi/cppc_acpi.c | 26 ++++++++++++++++++++++++++
> drivers/cpufreq/intel_pstate.c | 10 ++++------
> include/acpi/cppc_acpi.h | 5 +++++
> 3 files changed, 35 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
> index f370be8715ae..6dc11030707a 100644
> --- a/drivers/acpi/cppc_acpi.c
> +++ b/drivers/acpi/cppc_acpi.c
> @@ -1328,6 +1328,32 @@ int cppc_get_highest_perf(int cpunum, u64
> *highest_perf)
> }
> EXPORT_SYMBOL_GPL(cppc_get_highest_perf);
>
> +/**
> + * cppc_get_effective_guaranteed_perf - get effective guaranteed
> performance
> + * @cpunum: CPU number
> + * @guaranteed_perf: Effective guaranteed performance value
> + *
> + * The ACPI CPPC specification states that if the Guaranteed
> + * Performance register is not implemented, OSPM assumes the
> + * guaranteed performance is equal to nominal performance.
> + *
> + * Return: 0 on success, negative errno on failure.
> + */
> +int cppc_get_effective_guaranteed_perf(int cpunum, u64
> *guaranteed_perf)
> +{
> + struct cppc_perf_caps perf_caps;
> + int ret;
> +
> + ret = cppc_get_perf_caps(cpunum, &perf_caps);
> + if (ret)
> + return ret;
> + *guaranteed_perf = perf_caps.guaranteed_perf ?:
> + perf_caps.nominal_perf;
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(cppc_get_effective_guaranteed_perf);
> +
> /**
> * cppc_get_epp_perf - Get the epp register value.
> * @cpunum: CPU from which to get epp preference value.
> diff --git a/drivers/cpufreq/intel_pstate.c
> b/drivers/cpufreq/intel_pstate.c
> index 8dc22a65e025..8934e48f71a2 100644
> --- a/drivers/cpufreq/intel_pstate.c
> +++ b/drivers/cpufreq/intel_pstate.c
> @@ -404,17 +404,15 @@ static void intel_pstate_set_itmt_prio(int cpu)
>
> static int intel_pstate_get_cppc_guaranteed(int cpu)
> {
> - struct cppc_perf_caps cppc_perf;
> + u64 guaranteed_perf;
> int ret;
>
> - ret = cppc_get_perf_caps(cpu, &cppc_perf);
> + ret = cppc_get_effective_guaranteed_perf(cpu,
> &guaranteed_perf);
> +
> if (ret)
> return ret;
>
> - if (cppc_perf.guaranteed_perf)
> - return cppc_perf.guaranteed_perf;
> -
> - return cppc_perf.nominal_perf;
> + return guaranteed_perf;
> }
>
> static int intel_pstate_cppc_get_scaling(int cpu)
> diff --git a/include/acpi/cppc_acpi.h b/include/acpi/cppc_acpi.h
> index d1f02ceec4f9..c02f3bc1fc1a 100644
> --- a/include/acpi/cppc_acpi.h
> +++ b/include/acpi/cppc_acpi.h
> @@ -155,6 +155,7 @@ struct cppc_cpudata {
> extern int cppc_get_desired_perf(int cpunum, u64 *desired_perf);
> extern int cppc_get_nominal_perf(int cpunum, u64 *nominal_perf);
> extern int cppc_get_highest_perf(int cpunum, u64 *highest_perf);
> +extern int cppc_get_effective_guaranteed_perf(int cpunum, u64
> *guaranteed_perf);
> extern int cppc_get_perf_ctrs(int cpu, struct cppc_perf_fb_ctrs
> *perf_fb_ctrs);
> extern int cppc_get_perf(int cpu, struct cppc_perf_ctrls
> *perf_ctrls);
> extern int cppc_set_perf(int cpu, struct cppc_perf_ctrls
> *perf_ctrls);
> @@ -198,6 +199,10 @@ static inline int cppc_get_highest_perf(int
> cpunum, u64 *highest_perf)
> {
> return -EOPNOTSUPP;
> }
> +static inline int cppc_get_effective_guaranteed_perf(int cpunum, u64
> *guaranteed_perf)
> +{
> + return -EOPNOTSUPP;
> +}
> static inline int cppc_get_perf_ctrs(int cpu, struct
> cppc_perf_fb_ctrs *perf_fb_ctrs)
> {
> return -EOPNOTSUPP;
next prev parent reply other threads:[~2026-05-29 15:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-29 8:18 Xueqin Luo
2026-05-29 15:33 ` srinivas pandruvada [this message]
2026-06-01 2:31 ` luoxueqin
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=60119eb883057391dc6def200be119e56a6e4fb5.camel@linux.intel.com \
--to=srinivas.pandruvada@linux.intel.com \
--cc=acpica-devel@lists.linux.dev \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=luoxueqin@kylinos.cn \
--cc=rafael@kernel.org \
--cc=saket.dumbre@intel.com \
--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®