[PATCH v1 0/9] Move RAPL defaults to interface drivers

Kuppuswamy Sathyanarayanan posted 9 patches 1 week, 1 day ago
drivers/powercap/intel_rapl_common.c          | 755 ++++++------------
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, 561 insertions(+), 522 deletions(-)
[PATCH v1 0/9] Move RAPL defaults to interface drivers
Posted by Kuppuswamy Sathyanarayanan 1 week, 1 day ago
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-4/9: Preparatory patches that do code cleanups in intel_rapl_common
             driver.
Patch 5/9: Preparatory patch that renames/declares the common functions.
Patch 6/9: Move TPMI default settings from the common driver into the
           TPMI interface driver.

Patch 7/9: Move MMIO default settings from the common driver into the
           MMIO interface driver.

Patch 8/9: Register the PM notifier only when a RAPL package exists.

Patch 9/9: 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.

Kuppuswamy Sathyanarayanan (9):
  powercap: intel_rapl: Add a symbol namespace for intel_rapl exports
  powercap: intel_rapl: Cleanup coding style
  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          | 755 ++++++------------
 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, 561 insertions(+), 522 deletions(-)

-- 
2.43.0
Re: [PATCH v1 0/9] Move RAPL defaults to interface drivers
Posted by srinivas pandruvada 1 week, 1 day ago
On Thu, 2026-01-29 at 10:36 -0800, Kuppuswamy Sathyanarayanan wrote:
> 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.
> 

For the series:

Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>


> Patch Summary:
> 
> Patch 1-4/9: Preparatory patches that do code cleanups in
> intel_rapl_common
>              driver.
> Patch 5/9: Preparatory patch that renames/declares the common
> functions.
> Patch 6/9: Move TPMI default settings from the common driver into the
>            TPMI interface driver.
> 
> Patch 7/9: Move MMIO default settings from the common driver into the
>            MMIO interface driver.
> 
> Patch 8/9: Register the PM notifier only when a RAPL package exists.
> 
> Patch 9/9: 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.
> 
> Kuppuswamy Sathyanarayanan (9):
>   powercap: intel_rapl: Add a symbol namespace for intel_rapl exports
>   powercap: intel_rapl: Cleanup coding style
>   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          | 755 ++++++----------
> --
>  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, 561 insertions(+), 522 deletions(-)