[v2,0/15] powercap/intel_rapl: Introduce RAPL TPMI support

Message ID 20230419024419.324436-1-rui.zhang@intel.com
Headers
Series powercap/intel_rapl: Introduce RAPL TPMI support |

Message

Zhang, Rui April 19, 2023, 2:44 a.m. UTC
  The TPMI (Topology Aware Register and PM Capsule Interface) provides a
flexible, extendable and PCIe enumerable MMIO interface for PM features.

The TPMI documentation can be downloaded from:
https://github.com/intel/tpmi_power_management

Intel RAPL (Running Average Power Limit) is one of the features that
benefit from this. Using TPMI Interface has advantage over traditional MSR
(Model Specific Register) interface, where a thread needs to be scheduled
on the target CPU to read or write. Also the RAPL features vary between
CPU models, and hence lot of model specific code. Here TPMI provides an
architectural interface by providing hierarchical tables and fields,
which will not need any model specific implementation.

Given that there are some differences between RAPL TPMI Interface and the
existing RAPL MSR/MMIO Interface, this patch series improves the RAPL
common code to satisfy the new requirements from TPMI interface, and then
introduces the RAPL TPMI Interface driver.

Patch 1-4	cleanups and preparation work.
Patch 5		adds support for per Domain Unit register.
Patch 6-10	improves Power Limits handling, and provides support
		for per Power Limit register, and per Power Limit Lock.
Patch 11-12	support rapl_package without online CPUs. So that TPMI
		rapl_package still works with whole package offlined.
Patch 13-15	introduces RAPL Core support for TPMI Interface and the
		RAPL TPMI Interface driver.

This series depends on the TPMI base driver which has been merged in 6.3-rc1.

thanks,
rui
---
Changes since v1:
   - use set_defaults() and variable name 'defaults' for rapl_defaults
     structure.
   - use 'rpi_default' instead of 'rpis' for the default rapl primitive
     information of MSR/MMIO Interface.
   - rephase the changelog of patch 7/15.
   - change the subject of patch 10/15 and use a helper for getting the
     primitive for power limit LOCK bit control.

----------------------------------------------------------------
Zhang Rui (15):
      powercap/intel_rapl: Remove unused field in struct rapl_if_priv
      powercap/intel_rapl: Allow probing without CPUID match
      powercap/intel_rapl: Support per Interface rapl_defaults
      powercap/intel_rapl: Support per Interface primitive information
      powercap/intel_rapl: Support per domain energy/power/time unit
      powercap/intel_rapl: Use index to initialize primitive information
      powercap/intel_rapl: Change primitive order
      powercap/intel_rapl: Use bitmap for Power Limits
      powercap/intel_rapl: Cleanup Power Limits support
      powercap/intel_rapl: Introduce per Power Limit lock
      powercap/intel_rapl: Remove redundant cpu parameter
      powercap/intel_rapl: Make cpu optional for rapl_package
      powercap/intel_rapl: Introduce RAPL I/F type
      powercap/intel_rapl: Introduce core support for TPMI interface
      powercap/intel_rapl_tpmi: Introduce RAPL TPMI interface driver

 drivers/powercap/Kconfig                           |  14 +
 drivers/powercap/Makefile                          |   1 +
 drivers/powercap/intel_rapl_common.c               | 868 ++++++++++++---------
 drivers/powercap/intel_rapl_msr.c                  |  14 +-
 drivers/powercap/intel_rapl_tpmi.c                 | 325 ++++++++
 .../intel/int340x_thermal/processor_thermal_rapl.c |  11 +-
 include/linux/intel_rapl.h                         |  40 +-
 7 files changed, 875 insertions(+), 398 deletions(-)
 create mode 100644 drivers/powercap/intel_rapl_tpmi.c
  

Comments

Rafael J. Wysocki May 24, 2023, 4:54 p.m. UTC | #1
On Wed, Apr 19, 2023 at 4:44 AM Zhang Rui <rui.zhang@intel.com> wrote:
>
> The TPMI (Topology Aware Register and PM Capsule Interface) provides a
> flexible, extendable and PCIe enumerable MMIO interface for PM features.
>
> The TPMI documentation can be downloaded from:
> https://github.com/intel/tpmi_power_management
>
> Intel RAPL (Running Average Power Limit) is one of the features that
> benefit from this. Using TPMI Interface has advantage over traditional MSR
> (Model Specific Register) interface, where a thread needs to be scheduled
> on the target CPU to read or write. Also the RAPL features vary between
> CPU models, and hence lot of model specific code. Here TPMI provides an
> architectural interface by providing hierarchical tables and fields,
> which will not need any model specific implementation.
>
> Given that there are some differences between RAPL TPMI Interface and the
> existing RAPL MSR/MMIO Interface, this patch series improves the RAPL
> common code to satisfy the new requirements from TPMI interface, and then
> introduces the RAPL TPMI Interface driver.
>
> Patch 1-4       cleanups and preparation work.
> Patch 5         adds support for per Domain Unit register.
> Patch 6-10      improves Power Limits handling, and provides support
>                 for per Power Limit register, and per Power Limit Lock.
> Patch 11-12     support rapl_package without online CPUs. So that TPMI
>                 rapl_package still works with whole package offlined.
> Patch 13-15     introduces RAPL Core support for TPMI Interface and the
>                 RAPL TPMI Interface driver.
>
> This series depends on the TPMI base driver which has been merged in 6.3-rc1.
>
> thanks,
> rui
> ---
> Changes since v1:
>    - use set_defaults() and variable name 'defaults' for rapl_defaults
>      structure.
>    - use 'rpi_default' instead of 'rpis' for the default rapl primitive
>      information of MSR/MMIO Interface.
>    - rephase the changelog of patch 7/15.
>    - change the subject of patch 10/15 and use a helper for getting the
>      primitive for power limit LOCK bit control.
>
> ----------------------------------------------------------------
> Zhang Rui (15):
>       powercap/intel_rapl: Remove unused field in struct rapl_if_priv
>       powercap/intel_rapl: Allow probing without CPUID match
>       powercap/intel_rapl: Support per Interface rapl_defaults
>       powercap/intel_rapl: Support per Interface primitive information
>       powercap/intel_rapl: Support per domain energy/power/time unit
>       powercap/intel_rapl: Use index to initialize primitive information
>       powercap/intel_rapl: Change primitive order
>       powercap/intel_rapl: Use bitmap for Power Limits
>       powercap/intel_rapl: Cleanup Power Limits support
>       powercap/intel_rapl: Introduce per Power Limit lock
>       powercap/intel_rapl: Remove redundant cpu parameter
>       powercap/intel_rapl: Make cpu optional for rapl_package
>       powercap/intel_rapl: Introduce RAPL I/F type
>       powercap/intel_rapl: Introduce core support for TPMI interface
>       powercap/intel_rapl_tpmi: Introduce RAPL TPMI interface driver
>
>  drivers/powercap/Kconfig                           |  14 +
>  drivers/powercap/Makefile                          |   1 +
>  drivers/powercap/intel_rapl_common.c               | 868 ++++++++++++---------
>  drivers/powercap/intel_rapl_msr.c                  |  14 +-
>  drivers/powercap/intel_rapl_tpmi.c                 | 325 ++++++++
>  .../intel/int340x_thermal/processor_thermal_rapl.c |  11 +-
>  include/linux/intel_rapl.h                         |  40 +-
>  7 files changed, 875 insertions(+), 398 deletions(-)
>  create mode 100644 drivers/powercap/intel_rapl_tpmi.c

The whole series has been applied as 6.5 material, thanks!