Skip to contentSkip to conversation

arm64: dts: st: add STM32MP2 power domains

PATCH New Patrick Delaunay 2 participants 12 messages Dec 3

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v3 cover arm64: dts: st: add STM32MP2 power domains

Hello,

Version 3 of [1], updated after kernel test robot issue [2] and sashiko issue [3].

This series adds PSCI power-domain topology and models the STM32MP2 D1 functional dependency for STM32MP25, STM32MP23 and STM32MP21.

Some peripherals in the D2 domain, powered by VDD_CORE, are assigned by RIFSC to CPU1. Their RCC clocks are available only while the Cortex-A35 cluster, powered by VDD_CPU, is active.

The D1 domain describes this SoC restriction (see the PWR table "Functionalities depending on system operating mode") in DT rather than requiring individual drivers to know about it. This domain is placed below the PSCI cluster domain so that active devices prevent the cluster from entering an incompatible idle state.

D1 does not control a separate power switch and does not model the wakeup path. Wakeup routing is handled separately through EXTI1 and the retention power domain (PSCI domain with GENPD_FLAG_ACTIVE_WAKEUP).

The series adds the DT binding, the generic power-domain provider driver, the MAINTAINERS entry and the device-tree changes for the three STM32MP2 families.

Regards,
Patrick

[1] arm64: dts: st: add STM32MP2 power domains
https://patchwork.kernel.org/project/linux-arm-kernel/list/?series=1224766
https://lore.kernel.org/all/[email protected]/

[2] [auto build test ERROR on 9437ee8b6cf607e883b36e44bd755968daaebd48]
https://lore.kernel.org/oe-kbuild-all/[email protected]/

[3] Sashiko: Linux
https://sashiko.dev/#/patchset/20261127181958.113639-1-patrick.delaunay%40foss.st.com

Changes in v3:
- update Kconfig dependencies to solve an issue reported by kernel test robot and sashiko
- in the added domain: remove GENPD_FLAG_PM_CLK, devm_pm_runtime_enable and add call of pm_genpd_remove_device and replace pm_genpd_add_subdomain by of_genpd_add_subdomain

Changes in v2:
- update commit message
- update binding description
- move additionalProperties after required
- rename "power-domain-d1" to generic name "power-controller"
- remove "generic" in binding title

Patrick Delaunay (7):
dt-bindings: power: st: add STM32MP PM domain
pmdomain: st: add STM32MP power domain
MAINTAINERS: add entry for ST STM32 power domain driver
arm64: dts: st: add D1 domain for STM32MP25 family
arm64: dts: st: fix power-domain labels DT coding style in STM32MP25
arm64: dts: st: add D1 domain for STM32MP23 family
arm64: dts: st: add power domains for STM32MP21 family

 .../bindings/power/st,stm32mp-pm-domain.yaml  |  48 +++++++
 MAINTAINERS                                   |   7 +
 arch/arm64/boot/dts/st/stm32mp211.dtsi        |  37 +++++
 arch/arm64/boot/dts/st/stm32mp231.dtsi        |  54 ++++---
 arch/arm64/boot/dts/st/stm32mp233.dtsi        |   1 +
 arch/arm64/boot/dts/st/stm32mp235.dtsi        |   2 +-
 arch/arm64/boot/dts/st/stm32mp251.dtsi        | 126 ++++++++++-------
 arch/arm64/boot/dts/st/stm32mp253.dtsi        |   9 +-
 arch/arm64/boot/dts/st/stm32mp255.dtsi        |   2 +-
 drivers/pmdomain/st/Kconfig                   |  16 +++
 drivers/pmdomain/st/Makefile                  |   1 +
 drivers/pmdomain/st/stm32mp-pm-domain.c       | 132 ++++++++++++++++++
 12 files changed, 361 insertions(+), 74 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/power/st,stm32mp-pm-domain.yaml
 create mode 100644 drivers/pmdomain/st/stm32mp-pm-domain.c

---
base-commit: 9437ee8b6cf607e883b36e44bd755968daaebd48
branch: stm32mp_d1_domain

Signature · 1 line
2.43.0
#1 lore raw

PATCH v3 1/7 dt-bindings: power: st: add STM32MP PM domain

Document the STM32MP D1 functional-dependency power domain.

Some peripherals assigned to CPU1 rely on RCC clocks that are available only while the Cortex-A35 cluster is active. Model this dependency as a child of the PSCI cluster domain, which represents the PWR CPU domain powered from VDD_CPU.

The D1 domain does not control a separate power switch. Device wakeup routing is handled separately through EXTI1 and the retention power domain.

---

(no changes since v2)

Changes in v2:
- update commit message
- update binding description
- move additionalProperties after required
- rename "power-domain-d1" to generic name "power-controller"
- remove "generic" in binding title

 .../bindings/power/st,stm32mp-pm-domain.yaml  | 48 +++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/st,stm32mp-pm-domain.yaml
Documentation/devicetree/bindings/power/st,stm32mp-pm-domain.yaml new file +48 -0
new file mode 100644
index 000000000000..b4118e1e5a38
@@ -0,0 +1,48 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/st,stm32mp-pm-domain.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: STM32MP power domain
+
+maintainers:
+  - Patrick Delaunay <[email protected]>
+
+allOf:
+  - $ref: /schemas/power/power-domain.yaml#
+
+description: |
+  The STM32MP SoCs contain a D1 domain for PWR and RCC, which defines the
+  devices assigned by RIFSC to CPU1, the Cortex A cluster powered by VDD_CPU.
+  the devices in this domain are functional and clocked by RCC only when the
+  cluster domain is active, not in Idle state. The devices in this domain are
+  not powered by VDD_CPU and are wake-up capable in Stop1 low power modes.
+
+  This power domain node represents this dependency (see PWR table
+  "Functionalities depending on system operating mode").
+
+properties:
+  compatible:
+    const: st,stm32mp-pm-domain
+
+  '#power-domain-cells':
+    const: 0
+
+  power-domains:
+    maxItems: 1
+
+required:
+  - compatible
+  - '#power-domain-cells'
+  - power-domains
+
+additionalProperties: false
+
+examples:
+  - |
+    power-controller {
+      compatible = "st,stm32mp-pm-domain";
+      #power-domain-cells = <0>;
+      power-domains = <&cluster_pd>;
+    };
Signature · 1 line
2.43.0
#2 lore raw

Re: [PATCH v3 1/7] dt-bindings: power: st: add STM32MP PM domain

Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] dt-bindings: power: st: resource-less virtual power-controller node in DT - [Low] dt-bindings…

Thank you for your contribution! Sashiko AI review found 2 potential issues to consider:
- [Medium] dt-bindings: power: st: resource-less virtual power-controller node in DT
- [Low] dt-bindings: power: st: generic family compatible st,stm32mp-pm-domain
--

commit 972218ae1b021da75a049c0fa22e93c28248970a
Author: Patrick Delaunay <[email protected]>

dt-bindings: power: st: add STM32MP PM domain

This commit adds a Device Tree binding schema for the STM32MP D1 power domain, modeling the RCC clock dependency of CPU1 peripherals on the PSCI cluster power domain.

Quoted 6 lines
Documentation/devicetree/bindings/power/st,stm32mp-pm-domain.yaml new file +0 -0
new file mode 100644
index 0000000000000..b4118e1e5a38f
@@ -0,0 +1,48 @@

[ ... ]

Documentation/devicetree/bindings/power/st,stm32mp-pm-domain.yaml line 27

Quoted 13 lines
Documentation/devicetree/bindings/power/st,stm32mp-pm-domain.yaml new file +13 -0
+description: |
+  The STM32MP SoCs contain a D1 domain for PWR and RCC, which defines the
+  devices assigned by RIFSC to CPU1, the Cortex A cluster powered by VDD_CPU.
+  the devices in this domain are functional and clocked by RCC only when the
+  cluster domain is active, not in Idle state. The devices in this domain are
+  not powered by VDD_CPU and are wake-up capable in Stop1 low power modes.
+
+  This power domain node represents this dependency (see PWR table
+  "Functionalities depending on system operating mode").
+
+properties:
+  compatible:
+    const: st,stm32mp-pm-domain

[Severity: Low]
Should this binding use a SoC-specific compatible string instead of the generic family name st,stm32mp-pm-domain?

Documentation/devicetree/bindings/writing-bindings.rst prohibits device-family names in compatible strings and requires SoC-specific ones (like st,stm32mp25-rcc and st,stm32mp25-rifsc), so future SoC differences can be distinguished in the DT ABI.

The description also attributes STM32MP2-specific hardware (RIFSC, D1, VDD_CPU) to all STM32MP SoCs, whereas STM32MP13x and STM32MP15x use Cortex-A7 and ETZPC. If kept, using a SoC-specific compatible such as st,stm32mp25-pm-domain and scoping the text to STM32MP2x avoids both issues.

Quoted 11 lines
Documentation/devicetree/bindings/power/st,stm32mp-pm-domain.yaml new file +11 -0
+
+  '#power-domain-cells':
+    const: 0
+
+  power-domains:
+    maxItems: 1
+
+required:
+  - compatible
+  - '#power-domain-cells'
+  - power-domains

Documentation/devicetree/bindings/power/st,stm32mp-pm-domain.yaml line 48

Quoted 10 lines
Documentation/devicetree/bindings/power/st,stm32mp-pm-domain.yaml new file +10 -0
+
+additionalProperties: false
+
+examples:
+  - |
+    power-controller {
+      compatible = "st,stm32mp-pm-domain";
+      #power-domain-cells = <0>;
+      power-domains = <&cluster_pd>;
+    };

[Severity: Medium]
As reported by Krzysztof Kozlowski on v1 [1], does this binding introduce a resource-less virtual power-controller node in DT solely to work around Linux genpd wakeup handling?

The node has no hardware resources (no reg, clocks, resets, or supplies) and controls no power switch; it only wraps cluster_pd to avoid GENPD_FLAG_ACTIVE_WAKEUP set by psci_pd_init(). This commits a virtual node into the permanent DT ABI, contrary to writing-bindings.rst.

Could the existing RCC node provide this power domain if the dependency belongs to RCC, or could out-of-band wakeup signaling via device_out_band_wakeup() in genpd_finish_suspend() handle EXTI1 wakeup on cluster_pd directly?

[1] https://lore.kernel.org/r/20261123-pretty-strict-caracara-bfcaac@quoll

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#3 lore raw

PATCH v3 2/7 pmdomain: st: add STM32MP power domain

In reply to Patrick Delaunay

Register the STM32MP D1 functional-dependency domain as a generic power domain below the PSCI cluster domain.

Devices attached to D1 require the cluster to remain active while they need their RCC clocks. D1 has no hardware power-switch operations and does not propagate active-wakeup constraints; wakeup routing is handled separately by EXTI1 and the retention domain.

---

Changes in v3:
- update Kconfig dependencies to solve an issue reported by kernel test robot and sashiko
- in the added domain: remove GENPD_FLAG_PM_CLK, devm_pm_runtime_enable and add call of pm_genpd_remove_device and replace pm_genpd_add_subdomain by of_genpd_add_subdomain

Changes in v2:
- update commit message

 drivers/pmdomain/st/Kconfig             |  16 +++
 drivers/pmdomain/st/Makefile            |   1 +
 drivers/pmdomain/st/stm32mp-pm-domain.c | 132 ++++++++++++++++++++++++
 3 files changed, 149 insertions(+)
 create mode 100644 drivers/pmdomain/st/stm32mp-pm-domain.c
drivers/pmdomain/st/Kconfig +16 -0
index a77a70211f61..c677aaee2b8e 100644
@@ -1,4 +1,20 @@
 # SPDX-License-Identifier: GPL-2.0-only
+
+config STM32MP_PM_DOMAIN
+	tristate "STM32MP PM domain"
+	depends on ARCH_STM32 || COMPILE_TEST
+	depends on PM && OF
+	select PM_GENERIC_DOMAINS
+	select PM_GENERIC_DOMAINS_OF
+	default y
+	help
+	  Enable support for the STM32MP Power Management (PM) domain driver.
+	  This driver implements a generic PM domain for STM32MP SoCs, allowing
+	  the kernel to manage power domains for various hardware blocks using
+	  the generic power management framework. It is typically used to
+	  control the power state of devices and peripherals on STM32MP
+	  platforms. If unsure, say Y.
+
 config UX500_PM_DOMAIN
 	bool "ST-Ericsson ux500 Power Domain"
 	depends on ARCH_U8500 || COMPILE_TEST
drivers/pmdomain/st/Makefile +1 -0
index 6d8b617eb834..0e8131b7fe9d 100644
@@ -1,2 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0-only
+obj-$(CONFIG_STM32MP_PM_DOMAIN)		+= stm32mp-pm-domain.o
 obj-$(CONFIG_UX500_PM_DOMAIN)		+= ste-ux500-pm-domain.o
drivers/pmdomain/st/stm32mp-pm-domain.c new file +132 -0

132 lines not on this page · raw message

Signature · 1 line
2.43.0
#4 lore raw

PATCH v3 3/7 MAINTAINERS: add entry for ST STM32 power domain driver

In reply to Patrick Delaunay

Add a MAINTAINERS entry for the STM32MP power domain driver.

---

(no changes since v1)

 MAINTAINERS | 7 +++++++
 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
index c72a281a8167..5a47f33e5267 100644
@@ -26609,6 +26609,13 @@ F:	drivers/pinctrl/stm32/
 F:	include/dt-bindings/pinctrl/stm32-pinfunc.h
 X:	drivers/pinctrl/stm32/pinctrl-stm32-hdp.c
 
+ST STM32 POWER DOMAIN DRIVER
+M:	Patrick Delaunay <[email protected]>
+L:	[email protected] (moderated for non-subscribers)
+S:	Maintained
+F:	Documentation/devicetree/bindings/power/st,stm32mp-pm-domain.yaml
+F:	drivers/pmdomain/st/stm32mp-pm-domain.c
+
 ST STM32 SPI DRIVER
 M:	Alain Volmat <[email protected]>
 L:	[email protected]
Signature · 1 line
2.43.0
#5 lore raw

PATCH v3 4/7 arm64: dts: st: add D1 domain for STM32MP25 family

In reply to Patrick Delaunay

Add the D1 functional-dependency domain to the STM32MP25 device tree.

Assign peripherals that require the Cortex-A35 cluster clocks to D1, a child of the PSCI cluster domain. Keep the wakeup path separate from D1; the domain models peripheral functionality, not wakeup routing.

---

(no changes since v2)

Changes in v2:
- replace "power-domain-d1" by "power-controller"
- update commit message

 arch/arm64/boot/dts/st/stm32mp251.dtsi | 110 +++++++++++++++----------
 arch/arm64/boot/dts/st/stm32mp253.dtsi |   3 +-
 arch/arm64/boot/dts/st/stm32mp255.dtsi |   2 +-
 3 files changed, 69 insertions(+), 46 deletions(-)
arch/arm64/boot/dts/st/stm32mp251.dtsi +66 -44
index bf1542818be2..49bc5ca9cf71 100644
@@ -152,6 +152,12 @@ v2m0: v2m@48090000 {
 		};
 	};
 
+	d1_pd: power-controller {
+		compatible = "st,stm32mp-pm-domain";
+		#power-domain-cells = <0>;
+		power-domains = <&CLUSTER_PD>;
+	};
+
 	psci {
 		compatible = "arm,psci-1.0";
 		method = "smc";
@@ -209,6 +215,7 @@ hpdma: dma-controller@40400000 {
 				     <GIC_SPI 47 IRQ_TYPE_LEVEL_HIGH>,
 				     <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&scmi_clk CK_SCMI_HPDMA1>;
+			power-domains = <&RET_PD>;
 			#dma-cells = <3>;
 		};
 
@@ -232,6 +239,7 @@ hpdma2: dma-controller@40410000 {
 				     <GIC_SPI 63 IRQ_TYPE_LEVEL_HIGH>,
 				     <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&scmi_clk CK_SCMI_HPDMA2>;
+			power-domains = <&RET_PD>;
 			#dma-cells = <3>;
 		};
 
@@ -255,6 +263,7 @@ hpdma3: dma-controller@40420000 {
 				     <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>,
 				     <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&scmi_clk CK_SCMI_HPDMA3>;
+			power-domains = <&RET_PD>;
 			#dma-cells = <3>;
 		};
 
@@ -273,7 +282,7 @@ ommanager: ommanager@40500000 {
 				 <&scmi_reset RST_SCMI_OSPI2>;
 			reset-names = "omm", "ospi1", "ospi2";
 			access-controllers = <&rifsc 111>;
-			power-domains = <&CLUSTER_PD>;
+			power-domains = <&d1_pd>;
 			#address-cells = <2>;
 			#size-cells = <1>;
 			st,syscfg-amcr = <&syscfg 0x2c00 0x7>;
@@ -290,7 +299,7 @@ ospi1: spi@0 {
 				resets = <&scmi_reset RST_SCMI_OSPI1>,
 					 <&scmi_reset RST_SCMI_OSPI1DLL>;
 				access-controllers = <&rifsc 74>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				st,syscfg-dlyb = <&syscfg 0x1000>;
 				status = "disabled";
 			};
@@ -306,7 +315,7 @@ ospi2: spi@1 {
 				resets = <&scmi_reset RST_SCMI_OSPI2>,
 					 <&scmi_reset RST_SCMI_OSPI2DLL>;
 				access-controllers = <&rifsc 75>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				st,syscfg-dlyb = <&syscfg 0x1400>;
 				status = "disabled";
 			};
@@ -330,7 +339,7 @@ timers2: timer@40000000 {
 				#address-cells = <1>;
 				#size-cells = <0>;
 				access-controllers = <&rifsc 1>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 
 				counter {
@@ -361,7 +370,7 @@ timers3: timer@40010000 {
 				#address-cells = <1>;
 				#size-cells = <0>;
 				access-controllers = <&rifsc 2>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 
 				counter {
@@ -392,7 +401,7 @@ timers4: timer@40020000 {
 				#address-cells = <1>;
 				#size-cells = <0>;
 				access-controllers = <&rifsc 3>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 
 				counter {
@@ -423,7 +432,7 @@ timers5: timer@40030000 {
 				#address-cells = <1>;
 				#size-cells = <0>;
 				access-controllers = <&rifsc 4>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 
 				counter {
@@ -454,7 +463,7 @@ timers6: timer@40040000 {
 				#address-cells = <1>;
 				#size-cells = <0>;
 				access-controllers = <&rifsc 5>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 
 				counter {
@@ -479,7 +488,7 @@ timers7: timer@40050000 {
 				#address-cells = <1>;
 				#size-cells = <0>;
 				access-controllers = <&rifsc 6>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 
 				counter {
@@ -504,7 +513,7 @@ timers12: timer@40060000 {
 				#address-cells = <1>;
 				#size-cells = <0>;
 				access-controllers = <&rifsc 10>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 
 				counter {
@@ -535,7 +544,7 @@ timers13: timer@40070000 {
 				#address-cells = <1>;
 				#size-cells = <0>;
 				access-controllers = <&rifsc 11>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 
 				counter {
@@ -566,7 +575,7 @@ timers14: timer@40080000 {
 				#address-cells = <1>;
 				#size-cells = <0>;
 				access-controllers = <&rifsc 12>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 
 				counter {
@@ -686,7 +695,7 @@ spi2: spi@400b0000 {
 				       <&hpdma 52 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 23>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -717,7 +726,7 @@ spi3: spi@400c0000 {
 				       <&hpdma 54 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 24>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -744,6 +753,7 @@ usart2: serial@400e0000 {
 				       <&hpdma 12 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 32>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -756,6 +766,7 @@ usart3: serial@400f0000 {
 				       <&hpdma 14 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 33>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -768,6 +779,7 @@ uart4: serial@40100000 {
 				       <&hpdma 16 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 34>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -780,6 +792,7 @@ uart5: serial@40110000 {
 				       <&hpdma 18 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 35>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -796,7 +809,7 @@ i2c1: i2c@40120000 {
 				       <&hpdma 28 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 41>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				i2c-analog-filter;
 				wakeup-source;
 				status = "disabled";
@@ -815,7 +828,7 @@ i2c2: i2c@40130000 {
 				       <&hpdma 31 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 42>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				i2c-analog-filter;
 				wakeup-source;
 				status = "disabled";
@@ -834,7 +847,7 @@ i2c3: i2c@40140000 {
 				       <&hpdma 34 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 43>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				i2c-analog-filter;
 				wakeup-source;
 				status = "disabled";
@@ -853,7 +866,7 @@ i2c4: i2c@40150000 {
 				       <&hpdma 37 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 44>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				i2c-analog-filter;
 				wakeup-source;
 				status = "disabled";
@@ -872,7 +885,7 @@ i2c5: i2c@40160000 {
 				       <&hpdma 40 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 45>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				i2c-analog-filter;
 				wakeup-source;
 				status = "disabled";
@@ -891,7 +904,7 @@ i2c6: i2c@40170000 {
 				       <&hpdma 43 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 46>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				i2c-analog-filter;
 				wakeup-source;
 				status = "disabled";
@@ -910,7 +923,7 @@ i2c7: i2c@40180000 {
 				       <&hpdma 46 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 47>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				i2c-analog-filter;
 				wakeup-source;
 				status = "disabled";
@@ -926,7 +939,7 @@ timers10: timer@401c0000 {
 				#address-cells = <1>;
 				#size-cells = <0>;
 				access-controllers = <&rifsc 8>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 
 				counter {
@@ -957,7 +970,7 @@ timers11: timer@401d0000 {
 				#address-cells = <1>;
 				#size-cells = <0>;
 				access-controllers = <&rifsc 9>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 
 				counter {
@@ -991,7 +1004,7 @@ timers1: timer@40200000 {
 				#address-cells = <1>;
 				#size-cells = <0>;
 				access-controllers = <&rifsc 0>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 
 				counter {
@@ -1025,7 +1038,7 @@ timers8: timer@40210000 {
 				#address-cells = <1>;
 				#size-cells = <0>;
 				access-controllers = <&rifsc 7>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 
 				counter {
@@ -1055,6 +1068,7 @@ usart6: serial@40220000 {
 				       <&hpdma 20 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 36>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -1085,7 +1099,7 @@ spi1: spi@40230000 {
 				       <&hpdma 50 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 22>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -1101,7 +1115,7 @@ spi4: spi@40240000 {
 				       <&hpdma 56 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 25>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -1115,7 +1129,7 @@ timers15: timer@40250000 {
 				#address-cells = <1>;
 				#size-cells = <0>;
 				access-controllers = <&rifsc 13>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 
 				counter {
@@ -1146,7 +1160,7 @@ timers16: timer@40260000 {
 				#address-cells = <1>;
 				#size-cells = <0>;
 				access-controllers = <&rifsc 14>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 
 				counter {
@@ -1177,7 +1191,7 @@ timers17: timer@40270000 {
 				#address-cells = <1>;
 				#size-cells = <0>;
 				access-controllers = <&rifsc 15>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 
 				counter {
@@ -1210,7 +1224,7 @@ spi5: spi@40280000 {
 				       <&hpdma 58 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 26>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -1325,6 +1339,7 @@ uart9: serial@402c0000 {
 				       <&hpdma 26 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 39>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -1341,7 +1356,7 @@ timers20: timer@40320000 {
 				#address-cells = <1>;
 				#size-cells = <0>;
 				access-controllers = <&rifsc 16>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 
 				counter {
@@ -1371,6 +1386,7 @@ usart1: serial@40330000 {
 				       <&hpdma 10 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 31>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -1420,7 +1436,7 @@ spi6: spi@40350000 {
 				       <&hpdma 60 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 27>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -1436,7 +1452,7 @@ spi7: spi@40360000 {
 				       <&hpdma 62 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 28>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -1449,6 +1465,7 @@ uart7: serial@40370000 {
 				       <&hpdma 22 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 37>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -1461,6 +1478,7 @@ uart8: serial@40380000 {
 				       <&hpdma 24 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 38>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -1474,7 +1492,7 @@ dcmi: dcmi@404a0000 {
 				dmas = <&hpdma 137 0x60 0x00003012>;
 				dma-names = "tx";
 				access-controllers = <&rifsc 88>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -1500,7 +1518,7 @@ spi8: spi@46020000 {
 				       <&hpdma 172 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 29>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -1517,7 +1535,7 @@ i2c8: i2c@46040000 {
 				       <&hpdma 169 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 48>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				i2c-analog-filter;
 				wakeup-source;
 				status = "disabled";
@@ -1649,7 +1667,7 @@ csi: csi@48020000 {
 					 <&rcc CK_KER_CSIPHY>;
 				clock-names = "pclk", "txesc", "csi2phy";
 				access-controllers = <&rifsc 86>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -1661,7 +1679,7 @@ dcmipp: dcmipp@48030000 {
 				clocks = <&rcc CK_BUS_DCMIPP>, <&rcc CK_KER_CSI>;
 				clock-names = "kclk", "mclk";
 				access-controllers = <&rifsc 87>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -1674,7 +1692,7 @@ combophy: phy@480c0000 {
 				resets = <&rcc USB3PCIEPHY_R>;
 				reset-names = "phy";
 				access-controllers = <&rifsc 67>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				wakeup-source;
 				interrupts-extended = <&exti1 45 IRQ_TYPE_EDGE_FALLING>;
 				status = "disabled";
@@ -1692,7 +1710,7 @@ sdmmc1: mmc@48220000 {
 				cap-mmc-highspeed;
 				max-frequency = <120000000>;
 				access-controllers = <&rifsc 76>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -1708,7 +1726,7 @@ sdmmc2: mmc@48230000 {
 				cap-mmc-highspeed;
 				max-frequency = <166000000>;
 				access-controllers = <&rifsc 77>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -1724,6 +1742,7 @@ sdmmc3: mmc@48240000 {
 				cap-mmc-highspeed;
 				max-frequency = <166000000>;
 				access-controllers = <&rifsc 78>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -1753,6 +1772,7 @@ ethernet1: ethernet@482c0000 {
 				snps,tso;
 				st,syscon = <&syscfg 0x3000>;
 				access-controllers = <&rifsc 60>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 
 				mtl_rx_setup_1: rx-queues-config {
@@ -1784,6 +1804,7 @@ usbh_ohci: usb@482e0000 {
 				interrupts = <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>;
 				phys = <&usb2_phy1>;
 				phy-names = "usb";
+				power-domains = <&d1_pd>;
 				resets = <&rcc USBH_R>;
 				status = "disabled";
 			};
@@ -1797,6 +1818,7 @@ usbh_ehci: usb@482f0000 {
 				interrupts = <GIC_SPI 139 IRQ_TYPE_LEVEL_HIGH>;
 				phys = <&usb2_phy1>;
 				phy-names = "usb";
+				power-domains = <&d1_pd>;
 				resets = <&rcc USBH_R>;
 				status = "disabled";
 			};
@@ -1828,7 +1850,7 @@ pcie_ep: pcie-ep@48400000 {
 				resets = <&rcc PCIE_R>;
 				phys = <&combophy PHY_TYPE_PCIE>;
 				access-controllers = <&rifsc 68>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -1854,7 +1876,7 @@ pcie_rc: pcie@48400000 {
 				resets = <&rcc PCIE_R>;
 				msi-parent = <&v2m0>;
 				access-controllers = <&rifsc 68>;
-				power-domains = <&CLUSTER_PD>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 
 				pcie@0,0 {
arch/arm64/boot/dts/st/stm32mp253.dtsi +2 -1
index 19b3e55a4414..8562f13e5284 100644
@@ -56,7 +56,7 @@ m_can1: can@402d0000 {
 		resets = <&rcc FDCAN_R>;
 		bosch,mram-cfg = <0x0 0 0 32 0 0 2 2>;
 		access-controllers = <&rifsc 56>;
-		power-domains = <&CLUSTER_PD>;
+		power-domains = <&d1_pd>;
 		status = "disabled";
 	};
 
@@ -86,6 +86,7 @@ ethernet2: ethernet@482d0000 {
 		snps,tso;
 		st,syscon = <&syscfg 0x3400>;
 		access-controllers = <&rifsc 61>;
+		power-domains = <&d1_pd>;
 		status = "disabled";
 
 		mtl_rx_setup_2: rx-queues-config {
arch/arm64/boot/dts/st/stm32mp255.dtsi +1 -1
index 7a598f53a2a0..003024eb2fc7 100644
@@ -20,7 +20,7 @@ lvds: lvds@48060000 {
 		clock-names = "pclk", "ref";
 		resets = <&rcc LVDS_R>;
 		access-controllers = <&rifsc 84>;
-		power-domains = <&CLUSTER_PD>;
+		power-domains = <&d1_pd>;
 		status = "disabled";
 	};
 
Signature · 1 line
2.43.0
#6 lore raw

Re: [PATCH v3 4/7] arm64: dts: st: add D1 domain for STM32MP25 family

Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [Medium] pmdomain: st: OF node reference leak in stm32mp_pm_domain_probe() - [Medium] pmdomain: st: UAF on…

Thank you for your contribution! Sashiko AI review found 3 potential issues to consider:
- [Medium] pmdomain: st: OF node reference leak in stm32mp_pm_domain_probe()
- [Medium] pmdomain: st: UAF on d1_pd unbind when pm_genpd_remove() returns -EBUSY
- [Low] arm64: dts: st: undocumented RET_PD power-domains assignment on hpdma1-3
--

commit 4d68b237fb4210955e34085639d48ea0038b974b
Author: Patrick Delaunay <[email protected]>

arm64: dts: st: add D1 domain for STM32MP25 family

This commit adds the d1_pd power-controller node to the STM32MP25 device tree, assigns STM32MP25 peripherals to it, and assigns the HPDMA controllers to RET_PD.

Quoted 7 lines
arch/arm64/boot/dts/st/stm32mp251.dtsi +0 -0
index bf1542818be25..49bc5ca9cf710 100644
@@ -152,6 +152,12 @@ v2m0: v2m@48090000 {
 		};
 	};

arch/arm64/boot/dts/st/stm32mp251.dtsi v2m0: v2m@48090000 { · line 163

Quoted 10 lines
arch/arm64/boot/dts/st/stm32mp251.dtsi +6 -0
 
+	d1_pd: power-controller {
+		compatible = "st,stm32mp-pm-domain";
+		#power-domain-cells = <0>;
+		power-domains = <&CLUSTER_PD>;
+	};
+
 	psci {
 		compatible = "arm,psci-1.0";
 		method = "smc";

[Severity: Medium]
Does activating st,stm32mp-pm-domain leak an OF node reference on CLUSTER_PD in stm32mp_pm_domain_probe()?

In drivers/pmdomain/st/stm32mp-pm-domain.c, stm32mp_pm_domain_probe() takes a reference on link->domain.np via of_parse_phandle_with_args(). Later error returns (such as -EPROBE_DEFER from of_genpd_add_subdomain()) and stm32mp_pm_domain_genpd_remove_subdomain() never call of_node_put().

Registering a devm action to release link->domain.np right after of_parse_phandle_with_args() would cover both probe deferral and teardown.

[ ... ]

arch/arm64/boot/dts/st/stm32mp251.dtsi hpdma: dma-controller@40400000 { · line 220

Quoted 7 lines
arch/arm64/boot/dts/st/stm32mp251.dtsi +1 -0
@@ -209,6 +215,7 @@ hpdma: dma-controller@40400000 {
 				     <GIC_SPI 47 IRQ_TYPE_LEVEL_HIGH>,
 				     <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&scmi_clk CK_SCMI_HPDMA1>;
+			power-domains = <&RET_PD>;
 			#dma-cells = <3>;
 		};

[Severity: Low]
Should the RET_PD assignment on hpdma, hpdma2, and hpdma3 be split into its own commit or documented in the commit message?

The changelog only describes adding d1_pd and assigning peripherals to D1. Because hpdma, hpdma2, and hpdma3 are enabled by default and stm32-dma3 holds runtime PM references while channels are allocated, attaching them to RET_PD affects when RET_PD can power off during idle.

[ ... ]

arch/arm64/boot/dts/st/stm32mp251.dtsi ommanager: ommanager@40500000 { · line 288

Quoted 9 lines
arch/arm64/boot/dts/st/stm32mp251.dtsi +1 -1
@@ -273,7 +282,7 @@ ommanager: ommanager@40500000 {
 				 <&scmi_reset RST_SCMI_OSPI2>;
 			reset-names = "omm", "ospi1", "ospi2";
 			access-controllers = <&rifsc 111>;
-			power-domains = <&CLUSTER_PD>;
+			power-domains = <&d1_pd>;
 			#address-cells = <2>;
 			#size-cells = <1>;
 			st,syscfg-amcr = <&syscfg 0x2c00 0x7>;

[Severity: Medium]
Can unbinding or unloading the stm32mp_pm_domain driver trigger a use-after-free of pd now that STM32MP25 peripherals attach to d1_pd?

stm32mp_pm_domain_driver uses module_platform_driver() without setting suppress_bind_attrs = true, and its devm teardown action stm32mp_pm_domain_genpd_remove() discards the return value of pm_genpd_remove().

If d1_pd is unbound while consumers remain attached (for example under fw_devlink=off, where device links do not unbind consumers first), genpd_remove() returns -EBUSY and leaves pd in gpd_list. Devres then frees pd, causing a use-after-free on the next genpd traversal or detach.

Setting suppress_bind_attrs = true and making the driver built-in would avoid freeing a still-registered generic_pm_domain.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
#7 lore raw

PATCH v3 5/7 arm64: dts: st: fix power-domain labels DT coding style in STM32MP25

In reply to Patrick Delaunay

Update STM32MP25 power domain labels to comply with the Device Tree coding style requirement that labels use only lowercase letters, digits and underscore.

---

(no changes since v1)

 arch/arm64/boot/dts/st/stm32mp251.dtsi | 24 ++++++++++++------------
 arch/arm64/boot/dts/st/stm32mp253.dtsi |  6 +++---
 2 files changed, 15 insertions(+), 15 deletions(-)
arch/arm64/boot/dts/st/stm32mp251.dtsi +12 -12
index 49bc5ca9cf71..b5869313f2cd 100644
@@ -22,7 +22,7 @@ cpu0: cpu@0 {
 			device_type = "cpu";
 			reg = <0>;
 			enable-method = "psci";
-			power-domains = <&CPU_PD0>;
+			power-domains = <&cpu0_pd>;
 			power-domain-names = "psci";
 		};
 
@@ -155,25 +155,25 @@ v2m0: v2m@48090000 {
 	d1_pd: power-controller {
 		compatible = "st,stm32mp-pm-domain";
 		#power-domain-cells = <0>;
-		power-domains = <&CLUSTER_PD>;
+		power-domains = <&cluster_pd>;
 	};
 
 	psci {
 		compatible = "arm,psci-1.0";
 		method = "smc";
 
-		CPU_PD0: power-domain-cpu0 {
+		cpu0_pd: power-domain-cpu0 {
 			#power-domain-cells = <0>;
 			domain-idle-states = <&cpu_sleep>;
-			power-domains = <&CLUSTER_PD>;
+			power-domains = <&cluster_pd>;
 		};
 
-		CLUSTER_PD: power-domain-cluster {
+		cluster_pd: power-domain-cluster {
 			#power-domain-cells = <0>;
-			power-domains = <&RET_PD>;
+			power-domains = <&ret_pd>;
 		};
 
-		RET_PD: power-domain-retention {
+		ret_pd: power-domain-retention {
 			#power-domain-cells = <0>;
 		};
 	};
@@ -215,7 +215,7 @@ hpdma: dma-controller@40400000 {
 				     <GIC_SPI 47 IRQ_TYPE_LEVEL_HIGH>,
 				     <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&scmi_clk CK_SCMI_HPDMA1>;
-			power-domains = <&RET_PD>;
+			power-domains = <&ret_pd>;
 			#dma-cells = <3>;
 		};
 
@@ -239,7 +239,7 @@ hpdma2: dma-controller@40410000 {
 				     <GIC_SPI 63 IRQ_TYPE_LEVEL_HIGH>,
 				     <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&scmi_clk CK_SCMI_HPDMA2>;
-			power-domains = <&RET_PD>;
+			power-domains = <&ret_pd>;
 			#dma-cells = <3>;
 		};
 
@@ -263,7 +263,7 @@ hpdma3: dma-controller@40420000 {
 				     <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>,
 				     <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&scmi_clk CK_SCMI_HPDMA3>;
-			power-domains = <&RET_PD>;
+			power-domains = <&ret_pd>;
 			#dma-cells = <3>;
 		};
 
@@ -605,7 +605,7 @@ lptimer1: timer@40090000 {
 				#address-cells = <1>;
 				#size-cells = <0>;
 				access-controllers = <&rifsc 17>;
-				power-domains = <&RET_PD>;
+				power-domains = <&ret_pd>;
 				wakeup-source;
 				status = "disabled";
 
@@ -641,7 +641,7 @@ lptimer2: timer@400a0000 {
 				#address-cells = <1>;
 				#size-cells = <0>;
 				access-controllers = <&rifsc 18>;
-				power-domains = <&RET_PD>;
+				power-domains = <&ret_pd>;
 				wakeup-source;
 				status = "disabled";
 
arch/arm64/boot/dts/st/stm32mp253.dtsi +3 -3
index 8562f13e5284..7df1031b7e91 100644
@@ -12,7 +12,7 @@ cpu1: cpu@1 {
 			device_type = "cpu";
 			reg = <1>;
 			enable-method = "psci";
-			power-domains = <&CPU_PD1>;
+			power-domains = <&cpu1_pd>;
 			power-domain-names = "psci";
 		};
 	};
@@ -24,10 +24,10 @@ arm-pmu {
 	};
 
 	psci {
-		CPU_PD1: power-domain-cpu1 {
+		cpu1_pd: power-domain-cpu1 {
 			#power-domain-cells = <0>;
 			domain-idle-states = <&cpu_sleep>;
-			power-domains = <&CLUSTER_PD>;
+			power-domains = <&cluster_pd>;
 		};
 	};
 
Signature · 1 line
2.43.0
#8 lore raw

PATCH v3 6/7 arm64: dts: st: add D1 domain for STM32MP23 family

In reply to Patrick Delaunay

Assign peripherals that require the Cortex-A35 cluster clocks to D1, a child of the PSCI cluster domain. Keep the wakeup path separate from D1; the domain models peripheral functionality, not wakeup routing.

---

(no changes since v2)

Changes in v2:
- replace "power-domain-d1" by "power-controller"
- update commit message

 arch/arm64/boot/dts/st/stm32mp231.dtsi | 54 ++++++++++++++++++--------
 arch/arm64/boot/dts/st/stm32mp233.dtsi |  1 +
 arch/arm64/boot/dts/st/stm32mp235.dtsi |  2 +-
 3 files changed, 40 insertions(+), 17 deletions(-)
arch/arm64/boot/dts/st/stm32mp231.dtsi +38 -16
index deeda0a252ce..d8295caa8301 100644
@@ -130,6 +130,12 @@ scmi_vdda18adc: regulator@7 {
 		};
 	};
 
+	d1_pd: power-controller {
+		compatible = "st,stm32mp-pm-domain";
+		#power-domain-cells = <0>;
+		power-domains = <&cluster_pd>;
+	};
+
 	psci {
 		compatible = "arm,psci-1.0";
 		method = "smc";
@@ -187,6 +193,7 @@ hpdma: dma-controller@40400000 {
 				     <GIC_SPI 47 IRQ_TYPE_LEVEL_HIGH>,
 				     <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&scmi_clk CK_SCMI_HPDMA1>;
+			power-domains = <&ret_pd>;
 			#dma-cells = <3>;
 		};
 
@@ -210,6 +217,7 @@ hpdma2: dma-controller@40410000 {
 				     <GIC_SPI 63 IRQ_TYPE_LEVEL_HIGH>,
 				     <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&scmi_clk CK_SCMI_HPDMA2>;
+			power-domains = <&ret_pd>;
 			#dma-cells = <3>;
 		};
 
@@ -233,6 +241,7 @@ hpdma3: dma-controller@40420000 {
 				     <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>,
 				     <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&scmi_clk CK_SCMI_HPDMA3>;
+			power-domains = <&ret_pd>;
 			#dma-cells = <3>;
 		};
 
@@ -251,7 +260,7 @@ ommanager: ommanager@40500000 {
 				 <&scmi_reset RST_SCMI_OSPI2>;
 			reset-names = "omm", "ospi1", "ospi2";
 			access-controllers = <&rifsc 111>;
-			power-domains = <&cluster_pd>;
+			power-domains = <&d1_pd>;
 			#address-cells = <2>;
 			#size-cells = <1>;
 			st,syscfg-amcr = <&syscfg 0x2c00 0x7>;
@@ -268,7 +277,7 @@ ospi1: spi@0 {
 				resets = <&scmi_reset RST_SCMI_OSPI1>,
 					 <&scmi_reset RST_SCMI_OSPI1DLL>;
 				access-controllers = <&rifsc 74>;
-				power-domains = <&cluster_pd>;
+				power-domains = <&d1_pd>;
 				st,syscfg-dlyb = <&syscfg 0x1000>;
 				status = "disabled";
 			};
@@ -284,7 +293,7 @@ ospi2: spi@1 {
 				resets = <&scmi_reset RST_SCMI_OSPI2>,
 					 <&scmi_reset RST_SCMI_OSPI2DLL>;
 				access-controllers = <&rifsc 75>;
-				power-domains = <&cluster_pd>;
+				power-domains = <&d1_pd>;
 				st,syscfg-dlyb = <&syscfg 0x1400>;
 				status = "disabled";
 			};
@@ -325,7 +334,7 @@ spi2: spi@400b0000 {
 				       <&hpdma 52 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 23>;
-				power-domains = <&cluster_pd>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -356,7 +365,7 @@ spi3: spi@400c0000 {
 				       <&hpdma 54 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 24>;
-				power-domains = <&cluster_pd>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -383,6 +392,7 @@ usart2: serial@400e0000 {
 				       <&hpdma 12 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 32>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -395,6 +405,7 @@ usart3: serial@400f0000 {
 				       <&hpdma 14 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 33>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -407,6 +418,7 @@ uart4: serial@40100000 {
 				       <&hpdma 16 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 34>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -419,6 +431,7 @@ uart5: serial@40110000 {
 				       <&hpdma 18 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 35>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -435,7 +448,7 @@ i2c1: i2c@40120000 {
 				       <&hpdma 28 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 41>;
-				power-domains = <&cluster_pd>;
+				power-domains = <&d1_pd>;
 				i2c-analog-filter;
 				wakeup-source;
 				status = "disabled";
@@ -454,7 +467,7 @@ i2c2: i2c@40130000 {
 				       <&hpdma 31 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 42>;
-				power-domains = <&cluster_pd>;
+				power-domains = <&d1_pd>;
 				i2c-analog-filter;
 				wakeup-source;
 				status = "disabled";
@@ -473,7 +486,7 @@ i2c7: i2c@40180000 {
 				       <&hpdma 46 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 47>;
-				power-domains = <&cluster_pd>;
+				power-domains = <&d1_pd>;
 				i2c-analog-filter;
 				wakeup-source;
 				status = "disabled";
@@ -488,6 +501,7 @@ usart6: serial@40220000 {
 				       <&hpdma 20 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 36>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -518,7 +532,7 @@ spi1: spi@40230000 {
 				       <&hpdma 50 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 22>;
-				power-domains = <&cluster_pd>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -534,7 +548,7 @@ spi4: spi@40240000 {
 				       <&hpdma 56 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 25>;
-				power-domains = <&cluster_pd>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -550,7 +564,7 @@ spi5: spi@40280000 {
 				       <&hpdma 58 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 26>;
-				power-domains = <&cluster_pd>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -665,6 +679,7 @@ usart1: serial@40330000 {
 				       <&hpdma 10 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 31>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -711,6 +726,7 @@ uart7: serial@40370000 {
 				       <&hpdma 22 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 37>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -724,7 +740,7 @@ dcmi: dcmi@404a0000 {
 				dmas = <&hpdma 137 0x60 0x00003012>;
 				dma-names = "tx";
 				access-controllers = <&rifsc 88>;
-				power-domains = <&cluster_pd>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -750,6 +766,7 @@ spi8: spi@46020000 {
 				       <&hpdma 172 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 29>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -766,7 +783,7 @@ i2c8: i2c@46040000 {
 				       <&hpdma 169 0x20 0x3021>;
 				dma-names = "rx", "tx";
 				access-controllers = <&rifsc 48>;
-				power-domains = <&cluster_pd>;
+				power-domains = <&d1_pd>;
 				i2c-analog-filter;
 				wakeup-source;
 				status = "disabled";
@@ -781,7 +798,7 @@ csi: csi@48020000 {
 					 <&rcc CK_KER_CSIPHY>;
 				clock-names = "pclk", "txesc", "csi2phy";
 				access-controllers = <&rifsc 86>;
-				power-domains = <&cluster_pd>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -793,7 +810,7 @@ dcmipp: dcmipp@48030000 {
 				clocks = <&rcc CK_BUS_DCMIPP>, <&rcc CK_KER_CSI>;
 				clock-names = "kclk", "mclk";
 				access-controllers = <&rifsc 87>;
-				power-domains = <&cluster_pd>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -809,7 +826,7 @@ sdmmc1: mmc@48220000 {
 				cap-mmc-highspeed;
 				max-frequency = <120000000>;
 				access-controllers = <&rifsc 76>;
-				power-domains = <&cluster_pd>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -825,6 +842,7 @@ sdmmc2: mmc@48230000 {
 				cap-mmc-highspeed;
 				max-frequency = <166000000>;
 				access-controllers = <&rifsc 77>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -840,6 +858,7 @@ sdmmc3: mmc@48240000 {
 				cap-mmc-highspeed;
 				max-frequency = <166000000>;
 				access-controllers = <&rifsc 78>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 
@@ -869,6 +888,7 @@ ethernet1: ethernet@482c0000 {
 				snps,tso;
 				st,syscon = <&syscfg 0x3000>;
 				access-controllers = <&rifsc 60>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 
 				mtl_rx_setup_1: rx-queues-config {
@@ -900,6 +920,7 @@ usbh_ohci: usb@482e0000 {
 				interrupts = <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>;
 				phys = <&usb2_phy1>;
 				phy-names = "usb";
+				power-domains = <&d1_pd>;
 				resets = <&rcc USBH_R>;
 				status = "disabled";
 			};
@@ -913,6 +934,7 @@ usbh_ehci: usb@482f0000 {
 				interrupts = <GIC_SPI 139 IRQ_TYPE_LEVEL_HIGH>;
 				phys = <&usb2_phy1>;
 				phy-names = "usb";
+				power-domains = <&d1_pd>;
 				resets = <&rcc USBH_R>;
 				status = "disabled";
 			};
arch/arm64/boot/dts/st/stm32mp233.dtsi +1 -0
index cebefd99906f..3fa91f7f2762 100644
@@ -70,6 +70,7 @@ ethernet2: ethernet@482d0000 {
 		snps,tso;
 		st,syscon = <&syscfg 0x3400>;
 		access-controllers = <&rifsc 61>;
+		power-domains = <&d1_pd>;
 		status = "disabled";
 
 		mtl_rx_setup_2: rx-queues-config {
arch/arm64/boot/dts/st/stm32mp235.dtsi +1 -1
index 7a87c344a4fe..561b12ba74eb 100644
@@ -20,7 +20,7 @@ lvds: lvds@48060000 {
 		clock-names = "pclk", "ref";
 		resets = <&rcc LVDS_R>;
 		access-controllers = <&rifsc 84>;
-		power-domains = <&cluster_pd>;
+		power-domains = <&d1_pd>;
 		status = "disabled";
 	};
 
Signature · 1 line
2.43.0
#9 lore raw

Re: [PATCH v3 6/7] arm64: dts: st: add D1 domain for STM32MP23 family

Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] pmdomain: st: leak of link->domain.np refcount in stm32mp_pm_domain_probe() - [Low] arm64: dts…

Thank you for your contribution! Sashiko AI review found 2 potential issues to consider:
- [Medium] pmdomain: st: leak of link->domain.np refcount in stm32mp_pm_domain_probe()
- [Low] arm64: dts: st: commit message omits hpdma assignment to ret_pd --

commit 39f9eab845e68b59820b35f05e3932b2b6ece627
Author: Patrick Delaunay <[email protected]>

Quoted 7 lines

arm64: dts: st: add D1 domain for STM32MP23 family

Assign peripherals that require the Cortex-A35 cluster clocks to D1, a child of the PSCI cluster domain. Keep the wakeup path separate from D1; the domain models peripheral functionality, not wakeup routing.

[Severity: Low]
Should the commit message also mention that hpdma, hpdma2, and hpdma3 in arch/arm64/boot/dts/st/stm32mp231.dtsi are assigned to ret_pd, and why they belong to the retention domain rather than d1_pd?

Quoted 7 lines
arch/arm64/boot/dts/st/stm32mp231.dtsi +0 -0
index deeda0a252ce8..d8295caa83012 100644
@@ -130,6 +130,12 @@ scmi_vdda18adc: regulator@7 {
 		};
 	};

arch/arm64/boot/dts/st/stm32mp231.dtsi scmi_vdda18adc: regulator@7 { · line 141

Quoted 10 lines
arch/arm64/boot/dts/st/stm32mp231.dtsi +6 -0
 
+	d1_pd: power-controller {
+		compatible = "st,stm32mp-pm-domain";
+		#power-domain-cells = <0>;
+		power-domains = <&cluster_pd>;
+	};
+
 	psci {
 		compatible = "arm,psci-1.0";
 		method = "smc";

[Severity: Medium]
Does instantiating d1_pd expose a device_node reference count leak on cluster_pd in stm32mp_pm_domain_probe()?

In drivers/pmdomain/st/stm32mp-pm-domain.c (commit "pmdomain: st: add STM32MP power domain"), stm32mp_pm_domain_probe() calls of_parse_phandle_with_args() into link->domain, taking a reference on link->domain.np.

Neither of_genpd_add_subdomain() nor of_genpd_remove_subdomain() drops that reference, and the driver never calls of_node_put(link->domain.np) on probe error or deferral paths, nor in stm32mp_pm_domain_genpd_remove_subdomain().

Registering a devm action to call of_node_put(link->domain.np) right after of_parse_phandle_with_args() would cover both probe failures and teardown.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=6
#10 lore raw

PATCH v3 7/7 arm64: dts: st: add power domains for STM32MP21 family

In reply to Patrick Delaunay

Add PSCI CPU, cluster and retention power domains for STM32MP21.

Define the CPU idle state and connect the CPU and cluster domains to the PSCI hierarchy. Add the D1 functional-dependency domain and assign the affected peripheral to it.

---

(no changes since v2)

Changes in v2:
- replace "power-domain-d1" by "power-controller"
- update commit message

 arch/arm64/boot/dts/st/stm32mp211.dtsi | 37 ++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
arch/arm64/boot/dts/st/stm32mp211.dtsi +37 -0
index 4bfd58b26b51..4da0ac7771b5 100644
@@ -18,6 +18,21 @@ cpu0: cpu@0 {
 			reg = <0>;
 			device_type = "cpu";
 			enable-method = "psci";
+			power-domains = <&cpu0_pd>;
+			power-domain-names = "psci";
+		};
+
+		idle-states {
+			entry-method = "psci";
+
+			cpu_sleep: cpu-sleep {
+				compatible = "arm,idle-state";
+				arm,psci-suspend-param = <0x00000002>;
+				local-timer-stop;
+				entry-latency-us = <150>;
+				exit-latency-us = <200>;
+				min-residency-us = <1000>;
+			};
 		};
 	};
 
@@ -70,9 +85,30 @@ scmi_reset: protocol@16 {
 		};
 	};
 
+	d1_pd: power-controller {
+		compatible = "st,stm32mp-pm-domain";
+		#power-domain-cells = <0>;
+		power-domains = <&cluster_pd>;
+	};
+
 	psci {
 		compatible = "arm,psci-1.0";
 		method = "smc";
+
+		cpu0_pd: power-domain-cpu0 {
+			#power-domain-cells = <0>;
+			domain-idle-states = <&cpu_sleep>;
+			power-domains = <&cluster_pd>;
+		};
+
+		cluster_pd: power-domain-cluster {
+			#power-domain-cells = <0>;
+			power-domains = <&ret_pd>;
+		};
+
+		ret_pd: power-domain-retention {
+			#power-domain-cells = <0>;
+		};
 	};
 
 	timer {
@@ -108,6 +144,7 @@ usart2: serial@400e0000 {
 				interrupts = <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>;
 				clocks = <&ck_flexgen_08>;
 				access-controllers = <&rifsc 32>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 		};
Signature · 1 line
2.43.0
#11 lore raw

Re: [PATCH v3 7/7] arm64: dts: st: add power domains for STM32MP21 family

Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [High] arm64: dts: st: unguarded usart2 dependency on d1_pd and PSCI cluster_pd - [Medium] pmdomain: st…

Thank you for your contribution! Sashiko AI review found 2 potential issues to consider:
- [High] arm64: dts: st: unguarded usart2 dependency on d1_pd and PSCI cluster_pd
- [Medium] pmdomain: st: leak OF node ref in stm32mp_pm_domain_probe() --

commit 63312350be1210656670a702d73004820c600569
Author: Patrick Delaunay <[email protected]>

arm64: dts: st: add power domains for STM32MP21 family

This commit adds PSCI CPU, cluster, and retention power domains along with the CPU idle state and D1 power domain for STM32MP21, and assigns usart2 to the D1 domain.

Quoted 4 lines
arch/arm64/boot/dts/st/stm32mp211.dtsi +0 -0
index 4bfd58b26b51b..4da0ac7771b56 100644

[ ... ]

arch/arm64/boot/dts/st/stm32mp211.dtsi scmi_reset: protocol@16 { · line 92

Quoted 9 lines
arch/arm64/boot/dts/st/stm32mp211.dtsi +5 -0
@@ -70,9 +85,30 @@ scmi_reset: protocol@16 {
 		};
 	};
 
+	d1_pd: power-controller {
+		compatible = "st,stm32mp-pm-domain";
+		#power-domain-cells = <0>;
+		power-domains = <&cluster_pd>;
+	};

[Severity: Medium]
Does binding d1_pd to st,stm32mp-pm-domain leak a device_node reference on cluster_pd?

In commit "pmdomain: st: add STM32MP power domain", stm32mp_pm_domain_probe() acquires a reference on link->domain.np via of_parse_phandle_with_args(), and neither of_genpd_add_subdomain() nor of_genpd_remove_subdomain() drops it.

Every error return after that call (including -EPROBE_DEFER from of_genpd_add_subdomain()) and stm32mp_pm_domain_genpd_remove_subdomain() on removal leave the reference leaked.

Registering a devm action to call of_node_put(link->domain.np) right after of_parse_phandle_with_args() would cover both paths.

[ ... ]

arch/arm64/boot/dts/st/stm32mp211.dtsi usart2: serial@400e0000 { · line 150

Quoted 8 lines
arch/arm64/boot/dts/st/stm32mp211.dtsi +1 -0
@@ -108,6 +144,7 @@ usart2: serial@400e0000 {
 				interrupts = <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>;
 				clocks = <&ck_flexgen_08>;
 				access-controllers = <&rifsc 32>;
+				power-domains = <&d1_pd>;
 				status = "disabled";
 			};
 		};

[Severity: High]
Can assigning usart2 to d1_pd break the serial console on valid kernel configurations or older kernels?

d1_pd depends on cluster_pd, whose provider (cpuidle-psci-domain.c) is only built when CONFIG_ARM_PSCI_CPUIDLE_DOMAIN is enabled, while CONFIG_STM32MP_PM_DOMAIN defaults to y on ARCH_STM32 and selects PM_GENERIC_DOMAINS_OF without requiring CPU_IDLE or ARM_PSCI_CPUIDLE.

With CONFIG_PM=y and CONFIG_CPU_IDLE=n or CONFIG_ARM_PSCI_CPUIDLE=n, platform_probe() -> dev_pm_domain_attach() cannot resolve cluster_pd, so d1_pd never registers. usart2 (stdout-path in stm32mp215f-dk.dts) then fails to probe with -ENODEV or -ETIMEDOUT once deferred probing ends.

The same permanent usart2 probe failure happens when CONFIG_STM32MP_PM_DOMAIN=n with PM_GENERIC_DOMAINS_OF=y, or when booting this DTB on an older kernel without the st,stm32mp-pm-domain driver.

Setting CONFIG_STM32MP_PM_DOMAIN=m with built-in CONFIG_SERIAL_STM32_CONSOLE=y also defers console probing until userspace loads the module, or fails permanently after driver_deferred_probe_timeout.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=7