[PATCH v2 0/3] cpufreq: CPPC: Preserve OSPM-set registers across hotplug and unload

Sumit Gupta <[email protected]> Thu, 16 Jul 2026 21:08:17 +0530
Newsgroups dev.linux.lists.acpica-devel,org.kernel.vger.linux-acpi,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pm,org.kernel.vger.linux-tegra
Message-ID <[email protected]>
CPPC registers that OSPM programs at runtime, via sysfs (auto_sel,
energy_performance_preference, auto_act_window) or via the autonomous
mode boot parameter, can be silently lost across CPU hotplug or left
behind on driver unload:

 - Across CPU hotplug: the cpufreq core tears the policy down and the
   platform may reset the registers while the CPU is offline.
 - On driver unload: the value the driver wrote is left in the register
   instead of returning to its pre-driver state.

This series makes cppc_cpufreq keep these values consistent:

 - Patch 1: adds online()/offline() callbacks so core keeps the policy
   alive across CPU hotplug instead of tearing it down and rebuilding it.
 - Patch 2: adds u64 wrappers for the autonomous selection register.
 - Patch 3: adds a table-driven mechanism that captures each register's
   firmware value, restores it when the policy goes down, and reapplies
   the OSPM-set value when the policy comes back online.

v[1] -> v2:
 - New patch 1: keep policy across hotplug by adding online()/offline().
 - New patch 2: move the auto_sel u64 wrappers into cppc_acpi.c.
 - Restore fw values from offline(), which covers both hotplug and unload
 - Drop cppc_cache_perf_ctrls() and read reg values at offline() instead
   of caching them.
 - Add auto_act_window and defer OSPM Nominal Perf to a later series.

Sumit Gupta (3):
  cpufreq: CPPC: Keep the policy across CPU hotplug
  ACPI: CPPC: Add u64 wrappers for the autonomous selection register
  cpufreq: CPPC: Preserve OSPM-set registers across hotplug and unload

 drivers/acpi/cppc_acpi.c       |  40 +++++++++
 drivers/cpufreq/cppc_cpufreq.c | 156 +++++++++++++++++++++++++++++++++
 include/acpi/cppc_acpi.h       |  10 +++
 3 files changed, 206 insertions(+)

[1] v1: https://lore.kernel.org/lkml/[email protected]/

-- 
2.34.1