From: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com>
To: rafael@kernel.org
Cc: linux-pm@vger.kernel.org, shuah@kernel.org,
linux-kselftest@vger.kernel.org,
manaf.pallikunhi@oss.qualcomm.com
Subject: [PATCH v2 0/6] powercap: Add generic hierarchy support and convert DTPM
Date: Wed, 23 Sep 2026 16:34:10 +0200 [thread overview]
Message-ID: <20260923143416.3713485-1-daniel.lezcano@oss.qualcomm.com> (raw)
Powercap controllers frequently expose a hierarchy of power zones, for
example packages, 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 powercap controller to instantiate and destroy an
entire hierarchy from a static description. The powercap core 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 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@oss.qualcomm.com/
A kselftest is added to exercise the new API. It creates a synthetic
hierarchy, validates the resulting sysfs hierarchy and attributes, and
checks that all resources are correctly released when the hierarchy is
destroyed.
DTPM currently implements its own hierarchy creation logic to walk a
platform-provided description, create the corresponding DTPM zones and
tear them down. With the generic powercap hierarchy infrastructure in
place, this logic can instead be shared at the powercap core level.
The series therefore converts DTPM to use the generic powercap hierarchy
helpers. The platform hierarchy is duplicated before use, while
powercap_hierarchy_create() and powercap_hierarchy_destroy() handle its
lifetime and traversal. DTPM only provides the callbacks responsible for
creating and destroying the DTPM instance associated with each powercap
node. The CPU and devfreq backends are adjusted accordingly.
As part of this conversion, the existing RK3399 description is
simplified. The CPU backend creates one DTPM zone per cpufreq policy, so
describing every CPU belonging to the same policy results in duplicate
zones. The RK3399 hierarchy is therefore reduced to one CPU node per
cpufreq policy.
The Rockchip virtual node descriptor is also made SoC-independent so it
can be reused by other Rockchip platforms.
Finally, an RK3588 hierarchy is added. The RK3588 exposes three cpufreq
policies, represented by cpu@0, cpu@400 and cpu@600. These three CPU
domains are grouped below a virtual package node:
rk3588
`-- package
|-- cpu0-cpufreq
|-- cpu4-cpufreq
`-- cpu6-cpufreq
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 | 165 ++++++------
drivers/powercap/dtpm_cpu.c | 22 +-
drivers/powercap/dtpm_devfreq.c | 22 +-
drivers/powercap/powercap_sys.c | 148 +++++++++++
drivers/soc/rockchip/dtpm.c | 127 ++++++---
include/linux/dtpm.h | 5 +-
include/linux/powercap.h | 178 +++++++++++++
tools/testing/selftests/Makefile | 1 +
tools/testing/selftests/powercap/Kbuild | 3 +
tools/testing/selftests/powercap/Makefile | 17 ++
.../selftests/powercap/powercap_hierarchy.c | 246 ++++++++++++++++++
.../selftests/powercap/powercap_hierarchy.sh | 118 +++++++++
12 files changed, 906 insertions(+), 146 deletions(-)
create mode 100644 tools/testing/selftests/powercap/Kbuild
create mode 100644 tools/testing/selftests/powercap/Makefile
create mode 100644 tools/testing/selftests/powercap/powercap_hierarchy.c
create mode 100755 tools/testing/selftests/powercap/powercap_hierarchy.sh
--
2.43.0
next reply other threads:[~2026-09-23 14:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 14:34 Daniel Lezcano [this message]
2026-09-23 14:34 ` [PATCH v2 1/6] powercap: Add generic zone hierarchy creation helpers Daniel Lezcano
2026-09-29 18:02 ` Rafael J. Wysocki (Intel)
2026-09-23 14:34 ` [PATCH v2 2/6] selftests/powercap: Add powercap hierarchy creation API tests Daniel Lezcano
2026-09-23 14:34 ` [PATCH v2 3/6] powercap: dtpm: Remove duplicate RK3399 CPU hierarchy nodes Daniel Lezcano
2026-09-23 14:34 ` [PATCH v2 4/6] powercap: dtpm: Use generic powercap hierarchy helpers Daniel Lezcano
2026-09-23 14:34 ` [PATCH v2 5/6] powercap: dtpm: Rename Rockchip virtual node descriptor Daniel Lezcano
2026-09-23 14:34 ` [PATCH v2 6/6] powercap: dtpm: Add RK3588 hierarchy Daniel Lezcano
2026-09-28 21:13 ` [PATCH v2 0/6] powercap: Add generic hierarchy support and convert DTPM Daniel Lezcano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260923143416.3713485-1-daniel.lezcano@oss.qualcomm.com \
--to=daniel.lezcano@oss.qualcomm.com \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=manaf.pallikunhi@oss.qualcomm.com \
--cc=rafael@kernel.org \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox