[GIT PULL] powercap: Add generic hierarchy support and convert DTPM

Rafael J. Wysocki (Intel) rafael at kernel.org
Fri Nov 13 06:43:30 PST 2026


Hi Daniel,

On Tue, Nov 10, 2026 at 2:21 PM Daniel Lezcano
<daniel.lezcano at oss.qualcomm.com> wrote:
>
>
> Hi Rafael,
>
> as requested please consider the following changes since commit
> 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4:
>
>    Linux 7.4-rc1 (2026-11-01 13:26:31 -0800)
>
> are available in the Git repository at:
>
>    git://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git
> tags/powercap-hierarchy
>
> for you to fetch changes up to 6ba41a1519ff1f91f96d90a6bf4f70131a8f7c73:
>
>    powercap: dtpm: Add RK3588 hierarchy (2026-11-09 17:33:40 +0100)
>
> ----------------------------------------------------------------
> Powercap controllers may expose trees of power zones, such as packages,
> clusters and CPUs. This series adds generic helpers to duplicate a static
> hierarchy description, create its zones through backend callbacks, and
> destroy them in reverse order. Parents must precede their children in the
> node array; the helpers validate that ordering rather than sorting nodes.
>
> Drivers supporting multiple platforms can place each platform's hierarchy
> description and node array in initdata. powercap_hierarchy_dup() creates a
> working copy of the selected hierarchy and rebases its parent pointers.
> All original descriptions, including those for unused platforms, can then
> be reclaimed automatically with init memory. Names and backend-private
> data are not duplicated and must remain valid for the working hierarchy.
>
> The controller supplies creation and destruction callbacks to connect the
> generic hierarchy traversal to its backend. The creation callback receives
> the control type, node name, private data and parent zone, registers the
> zone with its operations and constraints, and returns it to the helper.
> The destruction callback unregisters it during rollback or teardown.
>
> The API supports both fatal creation errors, which roll back previously
> created zones, and optional nodes: a NULL callback result skips a node and
> its descendants while allowing independent branches to be created.
>
> The helpers were motivated by the SPEL work and also let DTPM share the
> same hierarchy infrastructure:
> https://lore.kernel.org/lkml/20260702-qcom_spel_driver_upstream-v3-0-434d50f0c5b0@oss.qualcomm.com/
>
> A kselftest exercises static and duplicated hierarchies, skipped branches,
> reuse after partial destruction, and rejection of repeated creation. Its
> userspace script checks the 16 exported zones and selected attribute
> values, then removes the module with a sysfs attribute descriptor open.
>
> DTPM is converted to the generic helpers while preserving best-effort
> creation when individual backends are unavailable. The CPU backend finds
> an online sibling when a hierarchy's representative CPU is offline.
> Entirely offline policies remain unavailable during initialization.
>
> The RK3399 description is reduced to one CPU entry per cpufreq policy.
> The old backend already suppressed duplicate registration; the extra
> entries were redundant descriptions, not additional registered zones.
> Finally, a shared Rockchip virtual descriptor and an RK3588 CPU hierarchy
> are added. RK3588's three frequency domains are represented by cpu at 0,
> cpu at 400 and cpu at 600 below a virtual package node; no GPU zone is added
> for RK3588 in this series.
>
> ----------------------------------------------------------------
> Daniel Lezcano (6):
>        powercap: Add generic zone hierarchy creation helpers
>        selftests/powercap: Add powercap hierarchy creation API tests
>        powercap: dtpm: Remove duplicate RK3399 CPU hierarchy nodes
>        powercap: dtpm: Use generic powercap hierarchy helpers
>        powercap: dtpm: Rename Rockchip virtual node descriptor
>        powercap: dtpm: Add RK3588 hierarchy
>
>   drivers/powercap/dtpm.c                            | 180 ++++++------
>   drivers/powercap/dtpm_cpu.c                        |  62 +++-
>   drivers/powercap/dtpm_devfreq.c                    |  22 +-
>   drivers/powercap/powercap_sys.c                    | 204 +++++++++++++
>   drivers/soc/rockchip/dtpm.c                        | 129 +++++++--
>   include/linux/dtpm.h                               |   6 +-
>   include/linux/powercap.h                           | 205 ++++++++++++++
>   tools/testing/selftests/Makefile                   |   1 +
>   tools/testing/selftests/powercap/Kbuild            |   5 +
>   tools/testing/selftests/powercap/Makefile          |  46 +++
>   tools/testing/selftests/powercap/config            |   3 +
>   .../selftests/powercap/powercap_hierarchy.c        | 314
> +++++++++++++++++++++
>   .../selftests/powercap/powercap_hierarchy.sh       | 128 +++++++++
>   13 files changed, 1153 insertions(+), 152 deletions(-)
>   create mode 100644 tools/testing/selftests/powercap/Kbuild
>   create mode 100644 tools/testing/selftests/powercap/Makefile
>   create mode 100644 tools/testing/selftests/powercap/config
>   create mode 100644 tools/testing/selftests/powercap/powercap_hierarchy.c
>   create mode 100755 tools/testing/selftests/powercap/powercap_hierarchy.sh

Pulled, but it had a small merge conflict with a previous cleanup.
Please see my resolution:

https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/commit/?h=bleeding-edge&id=95a9e882f5cb3ec891d1c021df3983358dd9b9e4

and let me know in case something is missing.

Thanks!



More information about the Linux-rockchip mailing list