[PATCH v1 0/6] powercap: intel_rapl: Move primitives to interface drivers

Kuppuswamy Sathyanarayanan posted 6 patches 3 weeks, 3 days ago
drivers/powercap/intel_rapl_common.c          | 206 ------------------
drivers/powercap/intel_rapl_msr.c             |  99 +++++++++
drivers/powercap/intel_rapl_tpmi.c            |  53 +++++
.../int340x_thermal/processor_thermal_rapl.c  |  72 ++++++
include/linux/intel_rapl.h                    |  33 ++-
5 files changed, 254 insertions(+), 209 deletions(-)
[PATCH v1 0/6] powercap: intel_rapl: Move primitives to interface drivers
Posted by Kuppuswamy Sathyanarayanan 3 weeks, 3 days ago
RAPL supports multiple interfaces (MSR, MMIO, and TPMI), each with their
own register layouts and bitmask definitions. Currently, the primitive
tables and bitmasks for all three interfaces live in the common driver,
which requires interface-specific handling logic in shared code and makes
the common layer unnecessarily complex.

This series cleans this up by moving each interface's primitive
definitions into its own driver, so the common driver no longer needs to
know anything about per-interface register layouts.

All patches are no-functional-change refactoring.

This series is based on top of the earlier RAPL cleanup series:

  https://lore.kernel.org/linux-pm/20260212233044.329790-1-sathyanarayanan.kuppuswamy@linux.intel.com/T/#t

Patch Summary:
Patch 1/6: Remove unused AVERAGE_POWER primitive and RAPL_PRIMITIVE_DERIVED
           flag from the common driver.
Patch 2/6: Remove other unused macro definitions from the common driver.
Patch 3/6: Move struct rapl_primitive_info, enum unit_type, and
           PRIMITIVE_INFO_INIT macro to intel_rapl.h to allow interface
           drivers to define their own primitive tables.
Patch 4/6: Move TPMI primitive definitions and associated bitmasks into
           the TPMI interface driver.
Patch 5/6: Move MMIO primitive definitions and associated bitmasks into
           the MMIO interface driver.
Patch 6/6: Move MSR primitive definitions and associated bitmasks into
           the MSR interface driver.

Kuppuswamy Sathyanarayanan (6):
  powercap: intel_rapl: Remove unused AVERAGE_POWER primitive
  powercap: intel_rapl: Remove unused macro definitions
  powercap: intel_rapl: Move primitive info to header for interface
    drivers
  powercap: intel_rapl: Move TPMI primitives to TPMI driver
  thermal: intel: int340x: processor: Move MMIO primitives to MMIO
    driver
  powercap: intel_rapl: Move MSR primitives to MSR driver

 drivers/powercap/intel_rapl_common.c          | 206 ------------------
 drivers/powercap/intel_rapl_msr.c             |  99 +++++++++
 drivers/powercap/intel_rapl_tpmi.c            |  53 +++++
 .../int340x_thermal/processor_thermal_rapl.c  |  72 ++++++
 include/linux/intel_rapl.h                    |  33 ++-
 5 files changed, 254 insertions(+), 209 deletions(-)

-- 
2.43.0
Re: [PATCH v1 0/6] powercap: intel_rapl: Move primitives to interface drivers
Posted by srinivas pandruvada 2 weeks, 3 days ago
On Fri, 2026-03-13 at 11:53 -0700, Kuppuswamy Sathyanarayanan wrote:
> RAPL supports multiple interfaces (MSR, MMIO, and TPMI), each with
> their
> own register layouts and bitmask definitions. Currently, the
> primitive
> tables and bitmasks for all three interfaces live in the common
> driver,
> which requires interface-specific handling logic in shared code and
> makes
> the common layer unnecessarily complex.
> 
> This series cleans this up by moving each interface's primitive
> definitions into its own driver, so the common driver no longer needs
> to
> know anything about per-interface register layouts.
> 
> All patches are no-functional-change refactoring.
> 
> This series is based on top of the earlier RAPL cleanup series:
> 
>  
> https://lore.kernel.org/linux-pm/20260212233044.329790-1-sathyanarayanan.kuppuswamy@linux.intel.com/T/#t
> 

For whole series:

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



> Patch Summary:
> Patch 1/6: Remove unused AVERAGE_POWER primitive and
> RAPL_PRIMITIVE_DERIVED
>            flag from the common driver.
> Patch 2/6: Remove other unused macro definitions from the common
> driver.
> Patch 3/6: Move struct rapl_primitive_info, enum unit_type, and
>            PRIMITIVE_INFO_INIT macro to intel_rapl.h to allow
> interface
>            drivers to define their own primitive tables.
> Patch 4/6: Move TPMI primitive definitions and associated bitmasks
> into
>            the TPMI interface driver.
> Patch 5/6: Move MMIO primitive definitions and associated bitmasks
> into
>            the MMIO interface driver.
> Patch 6/6: Move MSR primitive definitions and associated bitmasks
> into
>            the MSR interface driver.
> 
> Kuppuswamy Sathyanarayanan (6):
>   powercap: intel_rapl: Remove unused AVERAGE_POWER primitive
>   powercap: intel_rapl: Remove unused macro definitions
>   powercap: intel_rapl: Move primitive info to header for interface
>     drivers
>   powercap: intel_rapl: Move TPMI primitives to TPMI driver
>   thermal: intel: int340x: processor: Move MMIO primitives to MMIO
>     driver
>   powercap: intel_rapl: Move MSR primitives to MSR driver
> 
>  drivers/powercap/intel_rapl_common.c          | 206 ----------------
> --
>  drivers/powercap/intel_rapl_msr.c             |  99 +++++++++
>  drivers/powercap/intel_rapl_tpmi.c            |  53 +++++
>  .../int340x_thermal/processor_thermal_rapl.c  |  72 ++++++
>  include/linux/intel_rapl.h                    |  33 ++-
>  5 files changed, 254 insertions(+), 209 deletions(-)
Re: [PATCH v1 0/6] powercap: intel_rapl: Move primitives to interface drivers
Posted by Rafael J. Wysocki 2 weeks, 3 days ago
On Fri, Mar 20, 2026 at 6:02 PM srinivas pandruvada
<srinivas.pandruvada@linux.intel.com> wrote:
>
> On Fri, 2026-03-13 at 11:53 -0700, Kuppuswamy Sathyanarayanan wrote:
> > RAPL supports multiple interfaces (MSR, MMIO, and TPMI), each with
> > their
> > own register layouts and bitmask definitions. Currently, the
> > primitive
> > tables and bitmasks for all three interfaces live in the common
> > driver,
> > which requires interface-specific handling logic in shared code and
> > makes
> > the common layer unnecessarily complex.
> >
> > This series cleans this up by moving each interface's primitive
> > definitions into its own driver, so the common driver no longer needs
> > to
> > know anything about per-interface register layouts.
> >
> > All patches are no-functional-change refactoring.
> >
> > This series is based on top of the earlier RAPL cleanup series:
> >
> >
> > https://lore.kernel.org/linux-pm/20260212233044.329790-1-sathyanarayanan.kuppuswamy@linux.intel.com/T/#t
> >
>
> For whole series:
>
> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>

Whole series applied as 7.1 material, thanks!