dt-bindings: Powerzone new bindings
Subsystems (4)
PATCH 1/5 dt-bindings: Powerzone new bindings
The proposed bindings are describing a set of powerzones.
A power zone is the logical name for a component which is capable of power capping and where we can measure the power consumption.
A power zone can aggregate several power zones in terms of power measurement and power limitations. That allows to apply power constraint to a group of components and let the system balance the allocated power in order to comply with the constraint.
The ARM System Control and Management Interface (SCMI) can provide a power zone description.
The powerzone semantic is also found on the Intel platform with the RAPL register.
The Linux kernel powercap framework deals with the powerzones:
https://www.kernel.org/doc/html/latest/power/powercap/powercap.html
The powerzone can also represent a group of children powerzones, hence the description can result on a hierarchy. Such hierarchy already exists with the hardware or can be represented an computed from the kernel.
The hierarchical description was initially proposed but not desired given there are other descriptions like the power domain proposing almost the same description.
https://lore.kernel.org/all/CAL_JsqLuLcHj7525tTUmh7pLqe7T2j6UcznyhV7joS8ipyb_VQ@mail.gmail.com/
The description gives the power constraint dependencies to apply on a specific group of logically or physically aggregated devices. They do not represent the physical location or the power domains of the SoC even if the description could be similar.
--- .../devicetree/bindings/power/powerzones.yaml | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/powerzones.yaml
Documentation/devicetree/bindings/power/powerzones.yaml new file +95 -0
@@ -0,0 +1,95 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/power/powerzones.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Power zones description + +maintainers: + - Daniel Lezcano <[email protected]> + +description: |+ + + A System on Chip contains a multitude of active components and each + of them is a source of heat. Even if a temperature sensor is not + present, a source of heat can be controlled by acting on the + consumed power via different techniques. + + A powerzone describes a component or a group of components where we + can control the maximum power consumption. For instance, a group of + CPUs via the performance domain, a LCD screen via the brightness, + etc ... + + Different components when they are used together can significantly + increase the overall temperature, so the description needs to + reflect this dependency in order to assign a power budget for a + group of powerzones. + + This description is done via a hierarchy and the DT reflects it. It + does not represent the physical location or a topology, eg. on a + big.Little system, the little CPUs may not be represented as they do + not contribute significantly to the heat, however the GPU can be + tied with the big CPUs as they usually have a connection for + multimedia or game workloads. + +properties: + $nodename: + const: powerzones + + "#powerzone-cells": + description: + Number of cells in powerzone specifier. Typically 0 for nodes + representing but it can be any number in the future to describe + parameters of the powerzone. + + powerzone: + description: + A phandle to a parent powerzone. If no powerzone attribute is set, the + described powerzone is the topmost in the hierarchy. + +examples: + - | + powerzones { + + SOC_PZ: soc { + }; + + PKG_PZ: pkg { + #powerzone-cells = <0>; + powerzone = <&SOC_PZ>; + }; + + BIG_PZ: big { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; + }; + + GPU_PZ: gpu { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; + }; + + MULTIMEDIA_PZ: multimedia { + #powerzone-cells = <0>; + powerzone = <&SOC_PZ>; + }; + }; + + - | + A57_0: big@0 { + compatible = "arm,cortex-a57"; + reg = <0x0 0x0>; + device_type = "cpu"; + #powerzone-cells = <0>; + powerzone = <&BIG_PZ>; + }; + + A57_1: big@1 { + compatible = "arm,cortex-a57"; + reg = <0x0 0x0>; + device_type = "cpu"; + #powerzone-cells = <0>; + powerzone = <&BIG_PZ>; + }; +...
Signature · 1 line
2.25.1
PATCH 2/5 arm64: dts: rockchip: Add powerzones definition for rock960
Add the powerzones description. This first step introduces the big, the little and the gpu as a powerzone place.
--- .../boot/dts/rockchip/rk3399-rock960.dts | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+)
arch/arm64/boot/dts/rockchip/rk3399-rock960.dts +45 -0
@@ -61,6 +61,51 @@ bt_active_led: led-6 { }; }; + powerzones { + + PKG_PZ: pkg { + #powerzone-cells = <0>; + powerzone = <&SOC_PZ>; + }; + + SOC_PZ: soc { + }; + }; +}; + +&cpu_b0 { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; +}; + +&cpu_b1 { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; +}; + +&cpu_l0 { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; +}; + +&cpu_l1 { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; +}; + +&cpu_l2 { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; +}; + +&cpu_l3 { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; +}; + +&gpu { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; }; &cpu_alert0 {
Signature · 7 lines
2.25.1 _______________________________________________ Linux-rockchip mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-rockchip
Re: [PATCH 2/5] arm64: dts: rockchip: Add powerzones definition for rock960
Quoted 2 lines · Daniel Lezcano
Add the powerzones description. This first step introduces the big, the little and the gpu as a powerzone place.
These look more like SoC-level properties than board-level ones - should they be in rk3399.dtsi?
Robin.
Quoted 52 lines
Signed-off-by Daniel Lezcano <[email protected]>--- .../boot/dts/rockchip/rk3399-rock960.dts | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+)arch/arm64/boot/dts/rockchip/rk3399-rock960.dts +38
-0@@ -61,6 +61,51 @@ bt_active_led: led-6 { }; }; + powerzones { + + PKG_PZ: pkg { + #powerzone-cells = <0>; + powerzone = <&SOC_PZ>; + }; + + SOC_PZ: soc { + }; + }; +}; + +&cpu_b0 { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; +}; + +&cpu_b1 { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; +}; + +&cpu_l0 { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; +}; + +&cpu_l1 { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; +}; + +&cpu_l2 { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; +}; + +&cpu_l3 {
arch/arm64/boot/dts/rockchip/rk3399-rock960.dts bt_active_led: led-6 { · line 111
Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk3399-rock960.dts +7
-0+ #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; +}; + +&gpu { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; }; &cpu_alert0 {
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
Re: [PATCH 2/5] arm64: dts: rockchip: Add powerzones definition for rock960
Quoted 6 lines · Robin Murphy
Quoted 2 lines · Daniel Lezcano
Add the powerzones description. This first step introduces the big, the little and the gpu as a powerzone place.
These look more like SoC-level properties than board-level ones - should they be in
rk3399.dtsi?
Yes, it makes sense
If Heiko is fine with that I can add this description in the rk3399.dtsi file
Quoted 60 lines
Quoted 60 lines
---
.../boot/dts/rockchip/rk3399-rock960.dts | 45 +++++++++++++++++++1 file changed, 45 insertions(+)arch/arm64/boot/dts/rockchip/rk3399-rock960.dts +44
-0@@ -61,6 +61,51 @@ bt_active_led: led-6 { }; }; + powerzones { + + PKG_PZ: pkg { + #powerzone-cells = <0>; + powerzone = <&SOC_PZ>; + }; + + SOC_PZ: soc { + }; + }; +}; + +&cpu_b0 { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; +}; + +&cpu_b1 { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; +}; + +&cpu_l0 { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; +}; + +&cpu_l1 { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; +}; + +&cpu_l2 { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; +}; + +&cpu_l3 { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; +}; + +&gpu { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; }; &cpu_alert0 {
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Heiko Stübner
maintainerRe: [PATCH 2/5] arm64: dts: rockchip: Add powerzones definition for rock960
Am Mittwoch, 24. November 2021, 17:41:34 CET schrieb Daniel Lezcano:
Quoted 5 lines · Robin Murphy
Quoted 4 lines · Daniel Lezcano
Quoted 2 lines
Add the powerzones description. This first step introduces the big, the little and the gpu as a powerzone place.
Quoted 7 lines
Quoted 2 lines
These look more like SoC-level properties than board-level ones - should they be in
rk3399.dtsi?Yes, it makes sense
If Heiko is fine with that I can add this description in the
rk3399.dtsifile
Sure. Robin's suggestion sounds very sensible as these properties are quite specific to the soc itself.
Heiko
Quoted 64 lines
Quoted 61 lines
Quoted 61 lines
--- .../boot/dts/rockchip/rk3399-rock960.dts | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+)arch/arm64/boot/dts/rockchip/rk3399-rock960.dts +44
-0@@ -61,6 +61,51 @@ bt_active_led: led-6 { }; }; + powerzones { + + PKG_PZ: pkg { + #powerzone-cells = <0>; + powerzone = <&SOC_PZ>; + }; + + SOC_PZ: soc { + }; + }; +}; + +&cpu_b0 { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; +}; + +&cpu_b1 { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; +}; + +&cpu_l0 { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; +}; + +&cpu_l1 { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; +}; + +&cpu_l2 { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; +}; + +&cpu_l3 { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; +}; + +&gpu { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; }; &cpu_alert0 {
PATCH 3/5 powercap/drivers/dtpm: Add DT initialization support
In reply to Daniel LezcanoThe DTPM framework is available but without a way to configure it.
These changes add DT support to initialize the powercap hierarchy via the powerzones description.
It acts in two steps. First it reads the powerzone dependencies and build the DTPM hierarchy. Second, it search for all devices which belongs to a powerzone and attach them to the hierarchy.
This approach makes the initialization self-encapsulated for the DTPM components.
In order to ensure a nice self-encapsulation, the DTPM table descriptors contains a couple of initialization functions, one to setup the DTPM backend and one to initialize it up. With this approach, the DTPM framework has a very few functions to export.
--- drivers/powercap/Kconfig | 1 + drivers/powercap/dtpm.c | 95 +++++++++++++++++++++++++++++++++++-- drivers/powercap/dtpm_cpu.c | 2 +- include/linux/dtpm.h | 19 +++++++- 4 files changed, 110 insertions(+), 7 deletions(-)
drivers/powercap/Kconfig +1 -0
@@ -46,6 +46,7 @@ config IDLE_INJECT config DTPM bool "Power capping for Dynamic Thermal Power Management (EXPERIMENTAL)" + depends on OF help This enables support for the power capping for the dynamic thermal power management userspace engine.
drivers/powercap/dtpm.c +91 -4
115 lines not on this page · raw message
drivers/powercap/dtpm_cpu.c +1 -1
@@ -269,4 +269,4 @@ static int __init dtpm_cpu_init(void)return 0 ; } -DTPM_DECLARE (dtpm_cpu, dtpm_cpu_init); +DTPM_DECLARE (dtpm_cpu, dtpm_cpu_init,NULL );
include/linux/dtpm.h +17 -2
@@ -32,23 +32,28 @@ struct dtpm_ops {void (*release)(struct dtpm *); }; +struct device_node ; +typedef int (*dtpm_init_t )(void ); +typedef int (*dtpm_setup_t )(struct dtpm *,struct device_node *);struct dtpm_descr {dtpm_init_t init; +dtpm_setup_t setup; };/* Init section thermal table */ extern struct dtpm_descr __dtpm_table[];extern struct dtpm_descr __dtpm_table_end[]; -#define DTPM_TABLE_ENTRY (name, __init) \ +#define DTPM_TABLE_ENTRY (name, __init, __setup) \ static struct dtpm_descr __dtpm_table_entry_##name \ __used __section("__dtpm_table") = { \ .init = __init, \ + .setup = __setup, \ } -#define DTPM_DECLARE (name, init) DTPM_TABLE_ENTRY(name, init) +#define DTPM_DECLARE (name, init, setup) DTPM_TABLE_ENTRY(name, init, setup)#define for_each_dtpm_table (__dtpm) \ for (__dtpm = __dtpm_table; \
@@ -60,6 +65,16 @@ static inline struct dtpm *to_dtpm(struct powercap_zone *zone) return container_of(zone, struct dtpm, zone); } +static inline void dtpm_set_data (struct dtpm *dtpm,void *data) +{ +powercap_set_zone_data (&dtpm->zone, data); +} + +static inline void *dtpm_get_data (struct dtpm *dtpm) +{ +return powercap_get_zone_data (&dtpm->zone); +} +int dtpm_update_power (struct dtpm *dtpm);int dtpm_release_zone (struct powercap_zone *pcz);
Signature · 1 line
2.25.1
PATCH 4/5 powercap/drivers/dtpm: Add CPU DT initialization support
In reply to Daniel LezcanoBased on the previous DT changes in the core code, use the 'setup' callback to initialize the CPU DTPM backend.
Code is reorganized to stick to the DTPM table description. No functional changes.
--- drivers/powercap/dtpm_cpu.c | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-)
drivers/powercap/dtpm_cpu.c +29 -6
@@ -21,6 +21,7 @@#include <linux/cpuhotplug.h> #include <linux/dtpm.h> #include <linux/energy_model.h> +#include <linux/of.h> #include <linux/pm_qos.h> #include <linux/slab.h> #include <linux/units.h>
@@ -176,6 +177,17 @@ static int cpuhp_dtpm_cpu_offline(unsigned int cpu) }static int cpuhp_dtpm_cpu_online (unsigned int cpu) +{ +struct dtpm_cpu *dtpm_cpu; + + dtpm_cpu =per_cpu (dtpm_per_cpu, cpu); +if (dtpm_cpu) +return dtpm_update_power (&dtpm_cpu->dtpm); + +return 0 ; +} + +static int __dtpm_cpu_setup (int cpu,struct dtpm *parent) {struct dtpm_cpu *dtpm_cpu;struct cpufreq_policy *policy;
@@ -183,6 +195,10 @@ static int cpuhp_dtpm_cpu_online(unsigned int cpu)char name[CPUFREQ_NAME_LEN ];int ret = -ENOMEM ; + dtpm_cpu =per_cpu (dtpm_per_cpu, cpu); +if (dtpm_cpu) +return 0 ; + policy =cpufreq_cpu_get (cpu);if (!policy)return 0 ;
@@ -191,10 +207,6 @@ static int cpuhp_dtpm_cpu_online(unsigned int cpu)if (!pd)return -EINVAL ; - dtpm_cpu =per_cpu (dtpm_per_cpu, cpu); -if (dtpm_cpu) -return dtpm_update_power (&dtpm_cpu->dtpm); - dtpm_cpu =kzalloc (sizeof (*dtpm_cpu),GFP_KERNEL );if (!dtpm_cpu)return -ENOMEM ;
@@ -207,7 +219,7 @@ static int cpuhp_dtpm_cpu_online(unsigned int cpu)snprintf (name,sizeof (name),"cpu%d-cpufreq" , dtpm_cpu->cpu); - ret =dtpm_register (name, &dtpm_cpu->dtpm,NULL ); + ret =dtpm_register (name, &dtpm_cpu->dtpm, parent);if (ret) goto out_kfree_dtpm_cpu;
@@ -231,6 +243,17 @@ static int cpuhp_dtpm_cpu_online(unsigned int cpu)return ret; } +static int __init dtpm_cpu_setup (struct dtpm *dtpm,struct device_node *np) +{ +int cpu; + + cpu =of_cpu_node_to_id (np); +if (cpu <0 ) +return 0 ; + +return __dtpm_cpu_setup (cpu, dtpm); +} +static int __init dtpm_cpu_init (void ) {int ret;
@@ -269,4 +292,4 @@ static int __init dtpm_cpu_init(void)return 0 ; } -DTPM_DECLARE (dtpm_cpu, dtpm_cpu_init,NULL ); +DTPM_DECLARE (dtpm_cpu, dtpm_cpu_init, dtpm_cpu_setup);
Signature · 1 line
2.25.1
PATCH 5/5 powercap/drivers/dtpm: Add dtpm devfreq with energy model support
In reply to Daniel LezcanoCurrently the dtpm supports the CPUs via cpufreq and the energy model. This change provides the same for the device which supports devfreq.
Each device supporting devfreq and having an energy model will be added to the hierarchy if the corresponding powerzone is described in the DT.
The concept is the same as the cpufreq DTPM support: the QoS is used to aggregate the requests and the energy model gives the value of the instantaneous power consumption ponderated by the load of the device.
--- drivers/powercap/Kconfig | 7 ++ drivers/powercap/Makefile | 1 + drivers/powercap/dtpm_devfreq.c | 201 ++++++++++++++++++++++++++++++++ 3 files changed, 209 insertions(+) create mode 100644 drivers/powercap/dtpm_devfreq.c
drivers/powercap/Kconfig +7 -0
@@ -57,4 +57,11 @@ config DTPM_CPU help This enables support for CPU power limitation based on energy model. + +config DTPM_DEVFREQ + bool "Add device power capping based on the energy model" + depends on DTPM && ENERGY_MODEL + help + This enables support for device power limitation based on + energy model. endif
drivers/powercap/Makefile +1 -0
@@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only obj-$(CONFIG_DTPM) += dtpm.o obj-$(CONFIG_DTPM_CPU) += dtpm_cpu.o +obj-$(CONFIG_DTPM_DEVFREQ) += dtpm_devfreq.o obj-$(CONFIG_POWERCAP) += powercap_sys.o obj-$(CONFIG_INTEL_RAPL_CORE) += intel_rapl_common.o obj-$(CONFIG_INTEL_RAPL) += intel_rapl_msr.o
drivers/powercap/dtpm_devfreq.c new file +201 -0
201 lines not on this page · raw message
Signature · 1 line
2.25.1
kernel test robot
build botRe: [PATCH 5/5] powercap/drivers/dtpm: Add dtpm devfreq with energy model support
I love your patch! Perhaps something to improve:
Hi Daniel,
I love your patch! Perhaps something to improve:
[auto build test WARNING on rafael-pm/linux-next]
[also build test WARNING on robh/for-next rockchip/for-next v5.16-rc2 next-20211125] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Daniel-Lezcano/dt-bindings-Powerzone-new-bindings/20211124-222933 base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next config: powerpc-allyesconfig (https://download.01.org/0day-ci/archive/20211126/202111260918.qEJu6uVF-lkp(a)intel.com/config) compiler: powerpc-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/97f4328cf8894b4f59793034227c5a1df91953ed
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Daniel-Lezcano/dt-bindings-Powerzone-new-bindings/20211124-222933 git checkout 97f4328cf8894b4f59793034227c5a1df91953ed
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=powerpc
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> drivers/powercap/dtpm_devfreq.c:29:22: warning: no previous prototype for 'to_dtpm_devfreq' [-Wmissing-prototypes]
29 | struct dtpm_devfreq *to_dtpm_devfreq(struct dtpm *dtpm)
| ^~~~~~~~~~~~~~~
vim +/to_dtpm_devfreq +29 drivers/powercap/dtpm_devfreq.c
28
> 29 struct dtpm_devfreq *to_dtpm_devfreq(struct dtpm *dtpm)
30 {
31 return container_of(dtpm, struct dtpm_devfreq, dtpm);
32 }
33 ---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Quoted 80 lines · Daniel Lezcano
The proposed bindings are describing a set of powerzones.
A power zone is the logical name for a component which is capable of power capping and where we can measure the power consumption.
A power zone can aggregate several power zones in terms of power measurement and power limitations. That allows to apply power constraint to a group of components and let the system balance the allocated power in order to comply with the constraint.
The ARM System Control and Management Interface (SCMI) can provide a power zone description.
The powerzone semantic is also found on the Intel platform with the RAPL register.
The Linux kernel powercap framework deals with the powerzones:
https://www.kernel.org/doc/html/latest/power/powercap/powercap.html
The powerzone can also represent a group of children powerzones, hence the description can result on a hierarchy. Such hierarchy already exists with the hardware or can be represented an computed from the kernel.
The hierarchical description was initially proposed but not desired given there are other descriptions like the power domain proposing almost the same description.
https://lore.kernel.org/all/CAL_JsqLuLcHj7525tTUmh7pLqe7T2j6UcznyhV7joS8ipyb_VQ@mail.gmail.com/
The description gives the power constraint dependencies to apply on a specific group of logically or physically aggregated devices. They do not represent the physical location or the power domains of the SoC even if the description could be similar.
Cc Arnd Bergmann <[email protected]>Cc Ulf Hansson <[email protected]>Signed-off-by Daniel Lezcano <[email protected]>--- .../devicetree/bindings/power/powerzones.yaml | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/powerzones.yamlDocumentation/devicetree/bindings/power/powerzones.yaml new file +29
-0@@ -0,0 +1,95 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/power/powerzones.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Power zones description + +maintainers: + - Daniel Lezcano <[email protected]> + +description: |+ + + A System on Chip contains a multitude of active components and each + of them is a source of heat. Even if a temperature sensor is not + present, a source of heat can be controlled by acting on the + consumed power via different techniques. + + A powerzone describes a component or a group of components where we + can control the maximum power consumption. For instance, a group of + CPUs via the performance domain, a LCD screen via the brightness, + etc ... + + Different components when they are used together can significantly + increase the overall temperature, so the description needs to + reflect this dependency in order to assign a power budget for a + group of powerzones. + + This description is done via a hierarchy and the DT reflects it. It
Documentation/devicetree/bindings/power/powerzones.yaml line 39
Quoted 10 lines
Documentation/devicetree/bindings/power/powerzones.yaml new file +10
-0+ does not represent the physical location or a topology, eg. on a + big.Little system, the little CPUs may not be represented as they do + not contribute significantly to the heat, however the GPU can be + tied with the big CPUs as they usually have a connection for + multimedia or game workloads. + +properties: + $nodename: + const: powerzones +
Do we really need a top-node like this? Can't that be left as a platform/soc specific thing instead? Along the lines of how the last example below looks like? Maybe we can have both options? I guess Rob will tell us.
Moreover, maybe we should put some constraints on the names of subnodes (provider nodes) with a "patternProperties". Something along the lines of below.
patternProperties:
"^(powerzone)([@-].*)?$":
type: object
description:
Each node represents a powerzone.
Documentation/devicetree/bindings/power/powerzones.yaml line 46
Quoted 7 lines
Documentation/devicetree/bindings/power/powerzones.yaml new file +7
-0+ "#powerzone-cells": + description: + Number of cells in powerzone specifier. Typically 0 for nodes + representing but it can be any number in the future to describe + parameters of the powerzone. + + powerzone:
Maybe "powerzones" instead of "powerzone". Unless we believe that we never need to allow multiple parent-zones for a child-zone.
Documentation/devicetree/bindings/power/powerzones.yaml line 50
Quoted 4 lines
Documentation/devicetree/bindings/power/powerzones.yaml new file +4
-0+ description: + A phandle to a parent powerzone. If no powerzone attribute is set, the + described powerzone is the topmost in the hierarchy. +
We should probably state that the "#powerzone-cells" are required. Like below:
required:
- "#powerzone-cells"
Moreover, we probably need to allow additional properties? At least it looks so from the last example below. Then:
additionalProperties: true
Documentation/devicetree/bindings/power/powerzones.yaml line 56
Quoted 6 lines
Documentation/devicetree/bindings/power/powerzones.yaml new file +6
-0+examples: + - | + powerzones { + + SOC_PZ: soc { + };
This looks odd to me.
Why do we need an empty node? If this is the topmost power-zone, it should still have the #powerzone-cells specifier, I think.
Documentation/devicetree/bindings/power/powerzones.yaml line 58
Quoted 2 lines
Documentation/devicetree/bindings/power/powerzones.yaml new file +2
-0+ + PKG_PZ: pkg {
As I stated above, I would prefer some kind of common pattern of the subnode names. Maybe "pkg-powerzone"?
Quoted 17 lines
Documentation/devicetree/bindings/power/powerzones.yaml new file +17
-0+ #powerzone-cells = <0>; + powerzone = <&SOC_PZ>; + }; + + BIG_PZ: big { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; + }; + + GPU_PZ: gpu { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; + }; + + MULTIMEDIA_PZ: multimedia { + #powerzone-cells = <0>; + powerzone = <&SOC_PZ>;
Documentation/devicetree/bindings/power/powerzones.yaml line 85
Quoted 10 lines
Documentation/devicetree/bindings/power/powerzones.yaml new file +10
-0+ }; + }; + + - | + A57_0: big@0 { + compatible = "arm,cortex-a57"; + reg = <0x0 0x0>; + device_type = "cpu"; + #powerzone-cells = <0>; + powerzone = <&BIG_PZ>;
Just to make sure I understand correctly. The big@0 node is a powerzone provider too? Or did you mean to specify it as a consumer?
Documentation/devicetree/bindings/power/powerzones.yaml line 94
Quoted 9 lines
Documentation/devicetree/bindings/power/powerzones.yaml new file +9
-0+ }; + + A57_1: big@1 { + compatible = "arm,cortex-a57"; + reg = <0x0 0x0>; + device_type = "cpu"; + #powerzone-cells = <0>; + powerzone = <&BIG_PZ>; + };
Kind regards
Uffe
Hi Ulf,
thanks for the review
On 24/11/2021 15:54, Ulf Hansson wrote:
[ ... ]
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/power/powerzones.yaml new file +8
-0+ This description is done via a hierarchy and the DT reflects it. It + does not represent the physical location or a topology, eg. on a + big.Little system, the little CPUs may not be represented as they do + not contribute significantly to the heat, however the GPU can be + tied with the big CPUs as they usually have a connection for + multimedia or game workloads. + +properties:
Quoted 8 lines
Documentation/devicetree/bindings/power/powerzones.yaml line 39
Quoted 3 lines
Documentation/devicetree/bindings/power/powerzones.yaml new file +3
-0+ $nodename: + const: powerzones +Do we really need a top-node like this? Can't that be left as a platform/soc specific thing instead? Along the lines of how the last example below looks like? Maybe we can have both options? I guess Rob will tell us.
Do you mean a compatible string?
Quoted 9 lines
Moreover, maybe we should put some constraints on the names of subnodes (provider nodes) with a "patternProperties". Something along the lines of below.
patternProperties:
"^(powerzone)([@-].*)?$":
type: object
description:
Each node represents a powerzone.
Sure
Quoted 10 lines
Documentation/devicetree/bindings/power/powerzones.yaml line 46
Quoted 7 lines
Documentation/devicetree/bindings/power/powerzones.yaml new file +7
-0+ "#powerzone-cells": + description: + Number of cells in powerzone specifier. Typically 0 for nodes + representing but it can be any number in the future to describe + parameters of the powerzone. + + powerzone:Maybe "powerzones" instead of "powerzone". Unless we believe that we never need to allow multiple parent-zones for a child-zone.
May be that could be needed in the future. No objection to rename it to 'powerzones'.
Quoted 9 lines
Documentation/devicetree/bindings/power/powerzones.yaml line 50
Quoted 4 lines
Documentation/devicetree/bindings/power/powerzones.yaml new file +4
-0+ description: + A phandle to a parent powerzone. If no powerzone attribute is set, the + described powerzone is the topmost in the hierarchy. +We should probably state that the "#powerzone-cells" are required. Like below:
required:
- "#powerzone-cells"
Ok
Quoted 4 lines
Moreover, we probably need to allow additional properties? At least it looks so from the last example below. Then:
additionalProperties: true
I was unsure about adding it. With the actual description what would be the benefit ?
Quoted 10 lines
Documentation/devicetree/bindings/power/powerzones.yaml line 56
Quoted 6 lines
Documentation/devicetree/bindings/power/powerzones.yaml new file +6
-0+examples: + - | + powerzones { + + SOC_PZ: soc { + };This looks odd to me.
Why do we need an empty node? If this is the topmost power-zone,
Yes it is
Quoted 2 lines
it
should still have the #powerzone-cells specifier, I think.
Ok, makes sense
Quoted 5 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ + PKG_PZ: pkg {As I stated above, I would prefer some kind of common pattern of the subnode names. Maybe "pkg-powerzone"?
Ok, may be 'powerzone-pkg' to be consistent with the power-domains pattern?
Quoted 22 lines
Quoted 22 lines
Documentation/devicetree/bindings/power/powerzones.yaml new file +22
-0+ #powerzone-cells = <0>; + powerzone = <&SOC_PZ>; + }; + + BIG_PZ: big { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; + }; + + GPU_PZ: gpu { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; + }; + + MULTIMEDIA_PZ: multimedia { + #powerzone-cells = <0>; + powerzone = <&SOC_PZ>; + }; + }; + + - | + A57_0: big@0 {
Quoted 8 lines
Documentation/devicetree/bindings/power/powerzones.yaml line 85
Quoted 5 lines
Documentation/devicetree/bindings/power/powerzones.yaml new file +5
-0+ compatible = "arm,cortex-a57"; + reg = <0x0 0x0>; + device_type = "cpu"; + #powerzone-cells = <0>; + powerzone = <&BIG_PZ>;Just to make sure I understand correctly. The big@0 node is a powerzone provider too? Or did you mean to specify it as a consumer?
I'm not sure 'provider' or 'consumer' make sense in this context.
big@0 is a powerzone we can act on and its parent is the BIG_PZ powerzone.
However this description is correct but confusing.
Given big@0 and big@1 belong to the big 'cluster' and when we act on the performance state of big@0, big@1 is also changed, the correct description would be:
A57_0: big@0 {
compatible = "arm,cortex-a57";
reg = <0x0 0x0>;
device_type = "cpu";
#powerzone-cells = <0>;
powerzone = <&PKG_PZ>;
};
A57_1: big@1 {
compatible = "arm,cortex-a57";
reg = <0x0 0x0>;
device_type = "cpu";
#powerzone-cells = <0>;
powerzone = <&PKG_PZ>;
};If in the future, there will be a performance domain per core, then the former description above would make sense.
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Quoted 27 lines · Daniel Lezcano
Hi Ulf,
thanks for the review
On 24/11/2021 15:54, Ulf Hansson wrote:
[ ... ]
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/power/powerzones.yaml new file +8
-0+ This description is done via a hierarchy and the DT reflects it. It + does not represent the physical location or a topology, eg. on a + big.Little system, the little CPUs may not be represented as they do + not contribute significantly to the heat, however the GPU can be + tied with the big CPUs as they usually have a connection for + multimedia or game workloads. + +properties:Quoted 8 lines
Documentation/devicetree/bindings/power/powerzones.yaml line 39
Quoted 3 lines
Documentation/devicetree/bindings/power/powerzones.yaml new file +3
-0+ $nodename: + const: powerzones +Do we really need a top-node like this? Can't that be left as a platform/soc specific thing instead? Along the lines of how the last example below looks like? Maybe we can have both options? I guess Rob will tell us.
Quoted 1 line
Do you mean a compatible string?
Yes, but there is no need to specify that part of the powerzone bindings, I think.
Although, let's see what Rob thinks here.
Quoted 39 lines
Quoted 10 lines
Moreover, maybe we should put some constraints on the names of subnodes (provider nodes) with a "patternProperties". Something along the lines of below.
patternProperties:
"^(powerzone)([@-].*)?$":
type: object
description:
Each node represents a powerzone.Sure
Quoted 10 lines
Documentation/devicetree/bindings/power/powerzones.yaml line 46
Quoted 7 lines
Documentation/devicetree/bindings/power/powerzones.yaml new file +7
-0+ "#powerzone-cells": + description: + Number of cells in powerzone specifier. Typically 0 for nodes + representing but it can be any number in the future to describe + parameters of the powerzone. + + powerzone:Maybe "powerzones" instead of "powerzone". Unless we believe that we never need to allow multiple parent-zones for a child-zone.
May be that could be needed in the future. No objection to rename it to 'powerzones'.
Quoted 9 lines
Documentation/devicetree/bindings/power/powerzones.yaml line 50
Quoted 4 lines
Documentation/devicetree/bindings/power/powerzones.yaml new file +4
-0+ description: + A phandle to a parent powerzone. If no powerzone attribute is set, the + described powerzone is the topmost in the hierarchy. +We should probably state that the "#powerzone-cells" are required. Like below:
required:
- "#powerzone-cells"Ok
Quoted 7 lines
Quoted 4 lines
Moreover, we probably need to allow additional properties? At least it looks so from the last example below. Then:
additionalProperties: true
I was unsure about adding it. With the actual description what would be the benefit ?
A powerzone provider node is then allowed to have other properties too. Like a compatible string, for example.
Assuming I also have understood the additionalProperties thingy correctly. Rob?
Quoted 19 lines
Quoted 11 lines
Documentation/devicetree/bindings/power/powerzones.yaml line 56
Quoted 7 lines
Documentation/devicetree/bindings/power/powerzones.yaml new file +6
-0+examples: + - | + powerzones { + + SOC_PZ: soc { + };This looks odd to me.
Why do we need an empty node? If this is the topmost power-zone,
Yes it is
Quoted 2 lines
it
should still have the #powerzone-cells specifier, I think.Ok, makes sense
Quoted 7 lines
Quoted 5 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ + PKG_PZ: pkg {As I stated above, I would prefer some kind of common pattern of the subnode names. Maybe "pkg-powerzone"?
Ok, may be 'powerzone-pkg' to be consistent with the power-domains pattern?
Sure, that seems reasonable.
Quoted 32 lines
Quoted 23 lines
Quoted 23 lines
Documentation/devicetree/bindings/power/powerzones.yaml new file +22
-0+ #powerzone-cells = <0>; + powerzone = <&SOC_PZ>; + }; + + BIG_PZ: big { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; + }; + + GPU_PZ: gpu { + #powerzone-cells = <0>; + powerzone = <&PKG_PZ>; + }; + + MULTIMEDIA_PZ: multimedia { + #powerzone-cells = <0>; + powerzone = <&SOC_PZ>; + }; + }; + + - | + A57_0: big@0 {Quoted 8 lines
Documentation/devicetree/bindings/power/powerzones.yaml line 85
Quoted 5 lines
Documentation/devicetree/bindings/power/powerzones.yaml new file +5
-0+ compatible = "arm,cortex-a57"; + reg = <0x0 0x0>; + device_type = "cpu"; + #powerzone-cells = <0>; + powerzone = <&BIG_PZ>;Just to make sure I understand correctly. The big@0 node is a powerzone provider too? Or did you mean to specify it as a consumer?
Quoted 3 lines
I'm not sure 'provider' or 'consumer' make sense in this context.
big@0 is a powerzone we can act on and its parent is the
BIG_PZpowerzone.
I see.
Then it seems like we shouldn't have the toplevel "powerzones" node, as it looks like a powerzone provider may very well be part of an existing node.
Quoted 23 lines
However this description is correct but confusing.
Given big@0 and big@1 belong to the big 'cluster' and when we act on the performance state of big@0, big@1 is also changed, the correct description would be:
A57_0: big@0 { compatible = "arm,cortex-a57"; reg = <0x0 0x0>; device_type = "cpu"; #powerzone-cells = <0>; powerzone = <&PKG_PZ>; }; A57_1: big@1 { compatible = "arm,cortex-a57"; reg = <0x0 0x0>; device_type = "cpu"; #powerzone-cells = <0>; powerzone = <&PKG_PZ>; };
Quoted 2 lines
If in the future, there will be a performance domain per core, then the former description above would make sense.
Okay, I see. Thanks for clarifying!
Kind regards
Uffe
Rob Herring
maintainerQuoted 36 lines · Daniel Lezcano
The proposed bindings are describing a set of powerzones.
A power zone is the logical name for a component which is capable of power capping and where we can measure the power consumption.
A power zone can aggregate several power zones in terms of power measurement and power limitations. That allows to apply power constraint to a group of components and let the system balance the allocated power in order to comply with the constraint.
The ARM System Control and Management Interface (SCMI) can provide a power zone description.
The powerzone semantic is also found on the Intel platform with the RAPL register.
The Linux kernel powercap framework deals with the powerzones:
https://www.kernel.org/doc/html/latest/power/powercap/powercap.html
The powerzone can also represent a group of children powerzones, hence the description can result on a hierarchy. Such hierarchy already exists with the hardware or can be represented an computed from the kernel.
The hierarchical description was initially proposed but not desired given there are other descriptions like the power domain proposing almost the same description.
https://lore.kernel.org/all/CAL_JsqLuLcHj7525tTUmh7pLqe7T2j6UcznyhV7joS8ipyb_VQ@mail.gmail.com/
The description gives the power constraint dependencies to apply on a specific group of logically or physically aggregated devices. They do not represent the physical location or the power domains of the SoC even if the description could be similar.
Quoted 8 lines
Cc Arnd Bergmann <[email protected]>Cc Ulf Hansson <[email protected]>Signed-off-by Daniel Lezcano <[email protected]>--- .../devicetree/bindings/power/powerzones.yaml | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/powerzones.yaml
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/power/powerzones.yaml: 'additionalProperties' is a required property
hint: A schema without a "$ref" to another schema must define all properties and use "additionalProperties" from schema $id: http://devicetree.org/meta-schemas/base.yaml#
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/power/powerzones.yaml: ignoring, error in schema:
warning: no schema found in file: ./Documentation/devicetree/bindings/power/powerzones.yaml
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/patch/1559118
This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit.