From: "zhenglifeng (A)" <zhenglifeng1@huawei.com>
To: Sumit Gupta <sumitg@nvidia.com>, <rafael@kernel.org>,
<viresh.kumar@linaro.org>, <pierre.gondois@arm.com>,
<ionela.voinescu@arm.com>, <zhanjie9@hisilicon.com>,
<saket.dumbre@intel.com>, <lenb@kernel.org>,
<linux-kernel@vger.kernel.org>, <linux-pm@vger.kernel.org>,
<linux-acpi@vger.kernel.org>, <acpica-devel@lists.linux.dev>,
<linux-tegra@vger.kernel.org>
Cc: <treding@nvidia.com>, <jonathanh@nvidia.com>, <vsethi@nvidia.com>,
<ksitaraman@nvidia.com>, <sanjayc@nvidia.com>, <mochs@nvidia.com>,
<bbasu@nvidia.com>
Subject: Re: [PATCH v2 2/3] ACPI: CPPC: Add u64 wrappers for the autonomous selection register
Date: Fri, 17 Jul 2026 11:47:12 +0800 [thread overview]
Message-ID: <31525db3-a7a6-48fa-bea9-5de28a4332c4@huawei.com> (raw)
In-Reply-To: <20260716153820.2007095-3-sumitg@nvidia.com>
On 7/16/2026 11:38 PM, Sumit Gupta wrote:
> cppc_get_auto_sel()/cppc_set_auto_sel() use a bool, unlike the other
> CPPC register get/set helpers which use a u64.
>
> The next patch in this series saves and restores the OSPM-set registers
> across CPU hotplug using a common table of get/set helpers typed as
> int (*)(int, u64 *) and int (*)(int, u64), which the bool autonomous
> selection helpers do not fit.
>
> Add cppc_get_auto_sel_u64()/cppc_set_auto_sel_u64() wrappers with the u64
> signature so the autonomous selection register fits alongside the others.
>
> Suggested-by: Pierre Gondois <pierre.gondois@arm.com>
> Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
If this is necessary, I think it is better to just change the input parameter
of the original cppc_get/set_auto_sel() to u64.
> ---
> drivers/acpi/cppc_acpi.c | 40 ++++++++++++++++++++++++++++++++++++++++
> include/acpi/cppc_acpi.h | 10 ++++++++++
> 2 files changed, 50 insertions(+)
>
> diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
> index 9f572f481241..a7fec6c93178 100644
> --- a/drivers/acpi/cppc_acpi.c
> +++ b/drivers/acpi/cppc_acpi.c
> @@ -1788,6 +1788,46 @@ int cppc_set_auto_sel(int cpu, bool enable)
> }
> EXPORT_SYMBOL_GPL(cppc_set_auto_sel);
>
> +/**
> + * cppc_get_auto_sel_u64 - Read the autonomous selection register as a u64.
> + * @cpu: CPU from which to read the register.
> + * @val: Return address, set to 0 or 1.
> + *
> + * u64-typed wrapper around cppc_get_auto_sel() for callers that keep CPPC
> + * register accessors in a common table.
> + *
> + * Return: 0 for success, -ERRNO otherwise.
> + */
> +int cppc_get_auto_sel_u64(int cpu, u64 *val)
> +{
> + bool enable;
> + int ret;
> +
> + ret = cppc_get_auto_sel(cpu, &enable);
> + if (ret)
> + return ret;
> +
> + *val = enable;
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(cppc_get_auto_sel_u64);
> +
> +/**
> + * cppc_set_auto_sel_u64 - Write the autonomous selection register from a u64.
> + * @cpu: CPU to which to write the register.
> + * @val: Value to write, any non-zero value enables autonomous selection.
> + *
> + * u64-typed wrapper around cppc_set_auto_sel().
> + *
> + * Return: 0 for success, -ERRNO otherwise.
> + */
> +int cppc_set_auto_sel_u64(int cpu, u64 val)
> +{
> + return cppc_set_auto_sel(cpu, !!val);
> +}
> +EXPORT_SYMBOL_GPL(cppc_set_auto_sel_u64);
> +
> /**
> * cppc_set_enable - Set to enable CPPC on the processor by writing the
> * Continuous Performance Control package EnableRegister field.
> diff --git a/include/acpi/cppc_acpi.h b/include/acpi/cppc_acpi.h
> index 8693890a7275..cd07e1e92bf4 100644
> --- a/include/acpi/cppc_acpi.h
> +++ b/include/acpi/cppc_acpi.h
> @@ -184,6 +184,8 @@ extern int cppc_get_auto_act_window(int cpu, u64 *auto_act_window);
> extern int cppc_set_auto_act_window(int cpu, u64 auto_act_window);
> extern int cppc_get_auto_sel(int cpu, bool *enable);
> extern int cppc_set_auto_sel(int cpu, bool enable);
> +extern int cppc_get_auto_sel_u64(int cpu, u64 *val);
> +extern int cppc_set_auto_sel_u64(int cpu, u64 val);
> extern int cppc_get_perf_limited(int cpu, u64 *perf_limited);
> extern int cppc_set_perf_limited(int cpu, u64 bits_to_clear);
> extern int amd_get_highest_perf(unsigned int cpu, u32 *highest_perf);
> @@ -282,6 +284,14 @@ static inline int cppc_set_auto_sel(int cpu, bool enable)
> {
> return -EOPNOTSUPP;
> }
> +static inline int cppc_get_auto_sel_u64(int cpu, u64 *val)
> +{
> + return -EOPNOTSUPP;
> +}
> +static inline int cppc_set_auto_sel_u64(int cpu, u64 val)
> +{
> + return -EOPNOTSUPP;
> +}
> static inline int cppc_get_perf_limited(int cpu, u64 *perf_limited)
> {
> return -EOPNOTSUPP;
next prev parent reply other threads:[~2026-07-17 3:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-16 15:38 [PATCH v2 0/3] cpufreq: CPPC: Preserve OSPM-set registers across hotplug and unload Sumit Gupta
2026-07-16 15:38 ` [PATCH v2 1/3] cpufreq: CPPC: Keep the policy across CPU hotplug Sumit Gupta
2026-07-22 10:18 ` Christian Loehle
2026-07-23 21:27 ` Sumit Gupta
2026-07-16 15:38 ` [PATCH v2 2/3] ACPI: CPPC: Add u64 wrappers for the autonomous selection register Sumit Gupta
2026-07-17 3:47 ` zhenglifeng (A) [this message]
2026-07-21 15:34 ` Rafael J. Wysocki (Intel)
2026-07-23 19:28 ` Sumit Gupta
2026-07-16 15:38 ` [PATCH v2 3/3] cpufreq: CPPC: Preserve OSPM-set registers across hotplug and unload Sumit Gupta
2026-07-22 10:17 ` Christian Loehle
2026-07-23 19:39 ` Sumit Gupta
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=31525db3-a7a6-48fa-bea9-5de28a4332c4@huawei.com \
--to=zhenglifeng1@huawei.com \
--cc=acpica-devel@lists.linux.dev \
--cc=bbasu@nvidia.com \
--cc=ionela.voinescu@arm.com \
--cc=jonathanh@nvidia.com \
--cc=ksitaraman@nvidia.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=mochs@nvidia.com \
--cc=pierre.gondois@arm.com \
--cc=rafael@kernel.org \
--cc=saket.dumbre@intel.com \
--cc=sanjayc@nvidia.com \
--cc=sumitg@nvidia.com \
--cc=treding@nvidia.com \
--cc=viresh.kumar@linaro.org \
--cc=vsethi@nvidia.com \
--cc=zhanjie9@hisilicon.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
all inboxes | Powered by JetHome®