Re: [PATCH 0/2] powercap: Introduce generic hierarchy helpers and selftests

From: Daniel Lezcano

Date: Mon Sep 07 2026 - 06:11:57 EST



Hi Rafael,

On 8/6/26 13:01, Daniel Lezcano wrote:
Powercap controllers frequently expose a hierarchy of power zones (for
example package, clusters and CPUs). Until now, each driver had to
implement its own hierarchy traversal, parent lookup, error handling and
teardown logic.

This series introduces a generic hierarchy description and helper
functions allowing a controller to instantiate and destroy an entire
powercap hierarchy from a static description. The framework takes care of
duplicating the hierarchy description, rebasing parent pointers,
creating zones in dependency order and performing the appropriate
rollback and cleanup on errors.

The series also adds a kselftest exercising the new API by creating a
synthetic hierarchy, validating the exported sysfs hierarchy and
attributes, and ensuring that all resources are correctly released when
the hierarchy is destroyed.

The patches are organized as follows:

1. powercap: Add generic zone hierarchy creation helpers
2. selftests/powercap: Add powercap hierarchy creation API tests

The API was primarily motivated by the recently posted SPEL series and
also provides a migration path for DTPM to use the same generic
infrastructure instead of maintaining its own hierarchy handling.

Link: SPEL cover letter <https://lore.kernel.org/lkml/20260702-qcom_spel_driver_upstream-v3-0-434d50f0c5b0@xxxxxxxxxxxxxxxx/>

Daniel Lezcano (2):
powercap: Add generic zone hierarchy creation helpers
selftests/powercap: Add powercap hierarchy creation API tests

--
It was easy to migrate DTPM to this API and AFAICT Manaf was able to migrate also its series to this new API.

Is it possible to consider it for merging ?

Thanks

-- Daniel

[1] https://lore.kernel.org/all/20260819165605.1398880-1-daniel.lezcano@xxxxxxxxxxxxxxxx/

[2] https://lore.kernel.org/all/20260702-qcom_spel_driver_upstream-v3-0-434d50f0c5b0@xxxxxxxxxxxxxxxx/