From: Christian Loehle <christian.loehle@arm.com>
To: Sumit Gupta <sumitg@nvidia.com>,
rafael@kernel.org, viresh.kumar@linaro.org,
pierre.gondois@arm.com, ionela.voinescu@arm.com,
zhenglifeng1@huawei.com, zhanjie9@hisilicon.com, lenb@kernel.org,
saket.dumbre@intel.co, ray.huang@amd.com,
mario.limonciello@amd.com, perry.yuan@amd.com,
kprateek.nayak@amd.com, 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 v3 3/4] cpufreq: CPPC: Preserve OSPM-set registers across hotplug and unload
Date: Mon, 27 Jul 2026 14:15:12 +0100 [thread overview]
Message-ID: <c8f62b1d-4ab5-4d85-ae15-b5fc9ec2e3bc@arm.com> (raw)
In-Reply-To: <20260724215937.3368276-4-sumitg@nvidia.com>
On 7/24/26 22:59, Sumit Gupta wrote:
> Values written to OSPM-set CPPC registers (via sysfs or the autonomous
> boot parameter) can be lost in two ways:
>
> - Across CPU hotplug: the platform may reset a CPU's registers while it
> is offline.
> - On driver unload: the value the driver wrote is left in the register
> instead of returning to its pre-driver state.
>
> Add a small table-driven mechanism that handles both:
>
> - On init(), capture each register's firmware value before the
> driver programs anything.
> - On offline(), read back each register's current value (whatever was
> last set via sysfs or the boot parameter) so it can be reapplied, then
> restore the firmware value.
> - On online(), reapply the value captured at offline() after the
> performance request is re-established.
>
> Keep Autonomous Selection (auto_sel) last in the table so that, on
> online(), its saved value is reapplied after the other registers that
> shape its behaviour.
>
> Cover the Autonomous Selection (auto_sel), Energy Performance Preference
> (EPP) and Autonomous Activity Window (auto_act_window) registers.
>
> Suggested-by: Pierre Gondois <pierre.gondois@arm.com>
> Link: https://lore.kernel.org/all/86780f97-29ee-4a72-b311-38c89434b707@arm.com/
> Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
> ---
> drivers/cpufreq/cppc_cpufreq.c | 157 +++++++++++++++++++++++++++++++++
> 1 file changed, 157 insertions(+)
>
> diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c
> index 34cdba00e61a..8a13ec49eb9d 100644
> --- a/drivers/cpufreq/cppc_cpufreq.c
> +++ b/drivers/cpufreq/cppc_cpufreq.c
> @@ -28,6 +28,150 @@
>
> static struct cpufreq_driver cppc_cpufreq_driver;
>
> +/*
> + * OSPM-set CPPC registers tracked for save/restore. A value set via sysfs or
> + * the autonomous boot parameter is reapplied from online() across CPU
> + * hotplug, and the firmware value is restored from offline().
> + *
> + * Autonomous Selection (auto_sel) is kept last so its saved value is
> + * reapplied after the other registers that shape its behaviour.
While that would make sense, unfortunately:
"8.4.6.1.6 Autonomous Activity Window Register
Writes to this register only have meaning when Autonomous Selection is enabled."
I think restoring an inappropriate EPP/AUTO_ACT_WINDOW temporarily is okay though.
AFAICS it has to be:
1. enable CPPC
2. restore a valid DESIRED/MIN/MAX
3. restore AUTO_SEL_ENABLE
4. if autonomous mode is enabled, restore EPP and AUTO_ACT_WINDOW
> + */
> +enum cppc_saved_reg_id {
> + CPPC_SAVED_EPP,
> + CPPC_SAVED_AUTO_ACT_WINDOW,
> + CPPC_SAVED_AUTO_SEL,
> + CPPC_NR_SAVED_REGS,
> +};
> [snip]
next prev parent reply other threads:[~2026-07-27 13:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-24 21:59 [PATCH v3 0/4] cpufreq: CPPC: Preserve OSPM-set registers across hotplug and unload Sumit Gupta
2026-07-24 21:59 ` [PATCH v3 1/4] cpufreq: CPPC: Keep the policy across CPU hotplug Sumit Gupta
2026-07-27 13:27 ` Christian Loehle
2026-07-29 14:41 ` Sumit Gupta
2026-07-28 8:41 ` zhenglifeng (A)
2026-07-29 17:05 ` Sumit Gupta
2026-07-24 21:59 ` [PATCH v3 2/4] ACPI: CPPC: Make autonomous selection helpers take a u64 Sumit Gupta
2026-07-24 21:59 ` [PATCH v3 3/4] cpufreq: CPPC: Preserve OSPM-set registers across hotplug and unload Sumit Gupta
2026-07-27 13:15 ` Christian Loehle [this message]
2026-07-24 21:59 ` [PATCH v3 4/4] cpufreq: CPPC: Preserve OSPM-set registers across suspend/resume Sumit Gupta
2026-07-27 13:45 ` Christian Loehle
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=c8f62b1d-4ab5-4d85-ae15-b5fc9ec2e3bc@arm.com \
--to=christian.loehle@arm.com \
--cc=acpica-devel@lists.linux.dev \
--cc=bbasu@nvidia.com \
--cc=ionela.voinescu@arm.com \
--cc=jonathanh@nvidia.com \
--cc=kprateek.nayak@amd.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=mario.limonciello@amd.com \
--cc=mochs@nvidia.com \
--cc=perry.yuan@amd.com \
--cc=pierre.gondois@arm.com \
--cc=rafael@kernel.org \
--cc=ray.huang@amd.com \
--cc=saket.dumbre@intel.co \
--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 \
--cc=zhenglifeng1@huawei.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