[PATCH v2 00/12] Move RAPL defaults to interface drivers

From: Kuppuswamy Sathyanarayanan

Date: Thu Feb 12 2026 - 18:31:25 EST


Hi All,

The Intel RAPL common driver has accumulated a significant amount of
interface-specific logic over time. There is very little common code
shared across the MSR, TPMI, and MMIO interface-specific defaults.
Keeping these interface-specific defaults in the common layer therefore
provides no real benefit and instead increases complexity and
maintenance burden.

As a first step toward cleaning this up, this series moves
rapl_defaults ownership from the common driver into the individual
interface drivers and allows each interface to provide its own defaults
directly. Additional interface-specific cleanups in the RAPL common
driver will be addressed in follow-up work. This series is a
continuation of the earlier cleanup and refactoring effort initiated
by Zhang Rui.

Patch Summary:

Patch 1-7/12: Preparatory patches that do code cleanups in intel_rapl_common
driver.
Patch 8/12: Preparatory patch that renames/declares the common functions.
Patch 9/12: Move TPMI default settings from the common driver into the
TPMI interface driver.

Patch 10/12: Move MMIO default settings from the common driver into the
MMIO interface driver.

Patch 11/12: Register the PM notifier only when a RAPL package exists.

Patch 12/12: Move MSR default settings from the common driver into the MSR
interface driver.

No functional changes are intended across the series. This is strictly a
structural refactoring to simplify the common RAPL code and prepare it
for further cleanups.

Changes since v1:
* Removed BIT(val) usage in divisions (David Laight).
* Divided the cleanup patch into 4 patches for clarity.
* Added Acked-by tag from Srinivas.

Kuppuswamy Sathyanarayanan (12):
powercap: intel_rapl: Add a symbol namespace for intel_rapl exports
powercap: intel_rapl: Cleanup coding style
powercap: intel_rapl: Remove unused TIME_WINDOW macros
powercap: intel_rapl: Simplify rapl_compute_time_window_atom()
powercap: intel_rapl: Use shifts for power-of-2 operations
powercap: intel_rapl: Use GENMASK() and BIT() macros
powercap: intel_rapl: Use unit conversion macros from units.h
powercap: intel_rapl: Allow interface drivers to configure
rapl_defaults
powercap: intel_rapl: Move TPMI default settings into TPMI interface
driver
thermal: intel: int340x: processor: Move RAPL defaults to MMIO driver
powercap: intel_rapl: Register PM notifier only when RAPL package
exists
powercap: intel_rapl: Move MSR default settings into MSR interface
driver

drivers/powercap/intel_rapl_common.c | 757 ++++++------------
drivers/powercap/intel_rapl_msr.c | 251 +++++-
drivers/powercap/intel_rapl_tpmi.c | 48 ++
.../int340x_thermal/processor_thermal_rapl.c | 9 +
include/linux/intel_rapl.h | 17 +-
include/linux/units.h | 3 +
6 files changed, 562 insertions(+), 523 deletions(-)

--
2.43.0