Devicetree
 help / color / mirror / Atom feed
* [PATCH 0/9] RK3588: Enable the PHP SMMU
@ 2026-11-13 16:38 Arun Iyengar via B4 Relay
  2026-11-13 16:38 ` [PATCH 1/9] dt-bindings: net: rockchip-dwmac: Allow iommus Arun Iyengar via B4 Relay
                   ` (8 more replies)
  0 siblings, 9 replies; 20+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-11-13 16:38 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, David Wu, Damien Le Moal, Niklas Cassel, Serge Semin,
	netdev, devicetree, linux-arm-kernel, linux-rockchip,
	linux-kernel, linux-ide, Pranjal Shrivastava, Will Deacon,
	Robin Murphy, iommu, Shawn Lin, Sebastian Reichel, Arun Iyengar

The RK3588 PHP SMMU (MMU600_PHP) is disabled because nothing programs
the StreamIDs of its masters (GMAC0/1, SATA0-2, USB3OTG_2) in the PHP
GRF. Program them, attach the masters and enable the SMMU.

Shawn Lin asked whether mmu600_php should be enabled too; Heiko asked
for the same handling as the PCIe SMMU [3].

Patch 7 needs [1]. Please hold the last patch until [2] is merged:
PD_PHP is off in deep suspend and the SMMU resumes in bypass (GBPA read
as 0).

Tested on an Orange Pi 5 (RK3588S), 7.3-based with [2] (my Tested-by
is [4]):
- SATA0 root, GMAC1 and a USB3 disk translated: 1 GiB sha256-checked
  on each; three reboots; no SMMU events or bus errors;
- deep suspend 3/3 with all three translated; s2idle 3/3 with USB3OTG_2
  and GMAC1. TF-A v2.15 kept the StreamIDs; patch 6 restored six zeroed
  for the test (pm_test=core).
Not tested: GMAC0, SATA1/2, the series without [2], the reset (no
driver uses it).

Developed with Claude (Anthropic), which wrote the code and the commit
messages. I reviewed every change.

[1] https://lore.kernel.org/r/20261113-smmu-v3-pcie-pd-v3-0-39eb4f919529@gmail.com
[2] https://lore.kernel.org/r/20260929034510.2023173-1-praan@google.com
[3] https://lore.kernel.org/r/9_7qTfdNSViwtNUGq9D13w@sntech.de
[4] https://lore.kernel.org/r/179455903885.2418534.14656921897583011972@gmail.com

Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
Arun Iyengar (9):
      dt-bindings: net: rockchip-dwmac: Allow iommus
      dt-bindings: ata: rockchip,dwc-ahci: Allow iommus
      dt-bindings: soc: rockchip: grf: Allow a clock for the RK3588 PHP GRF
      soc: rockchip: grf: Assign the StreamIDs of the RK3588 PHP SMMU masters
      arm64: dts: rockchip: Add the PHP GRF clock on RK3588
      soc: rockchip: grf: Restore the RK3588 PHP StreamIDs after system suspend
      arm64: dts: rockchip: Add the clock and reset of the RK3588 PHP SMMU
      arm64: dts: rockchip: Attach the masters of the RK3588 PHP SMMU
      arm64: dts: rockchip: Enable the RK3588 PHP SMMU

 .../devicetree/bindings/ata/rockchip,dwc-ahci.yaml |   3 +
 .../devicetree/bindings/net/rockchip-dwmac.yaml    |   3 +
 .../devicetree/bindings/soc/rockchip/grf.yaml      |  12 ++-
 arch/arm64/boot/dts/rockchip/rk3588-base.dtsi      |   8 +-
 arch/arm64/boot/dts/rockchip/rk3588-extra.dtsi     |   2 +
 drivers/soc/rockchip/grf.c                         | 103 +++++++++++++++++++++
 6 files changed, 128 insertions(+), 3 deletions(-)
---
base-commit: c3baae5f1a15645cddadcb2b9abddef5df291f59
change-id: 20261113-mmu600-php-0367fe7f1609
prerequisite-message-id: <20261113-smmu-v3-pcie-pd-v3-0-39eb4f919529@gmail.com>
prerequisite-patch-id: 51134fb38514fa92f20d3831e7905b02c7fbaae6
prerequisite-patch-id: c59ab0be12ec964dc1698dfa3e0d5bfae82d0c54
prerequisite-patch-id: 845e9980a7e0de45c746b7d8b6fd439033e08fdd

Best regards,
--  
Arun Iyengar <aiyengar1990@gmail.com>



^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 1/9] dt-bindings: net: rockchip-dwmac: Allow iommus
  2026-11-13 16:38 [PATCH 0/9] RK3588: Enable the PHP SMMU Arun Iyengar via B4 Relay
@ 2026-11-13 16:38 ` Arun Iyengar via B4 Relay
  2026-11-17 17:35   ` netdev-bot+sashiko
  2026-11-13 16:38 ` [PATCH 2/9] dt-bindings: ata: rockchip,dwc-ahci: " Arun Iyengar via B4 Relay
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 20+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-11-13 16:38 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, David Wu, Damien Le Moal, Niklas Cassel, Serge Semin,
	netdev, devicetree, linux-arm-kernel, linux-rockchip,
	linux-kernel, linux-ide, Pranjal Shrivastava, Will Deacon,
	Robin Murphy, iommu, Shawn Lin, Sebastian Reichel, Arun Iyengar

From: Arun Iyengar <aiyengar1990@gmail.com>

The RK3588 GMACs are behind the PHP SMMU. Allow iommus.

Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
 Documentation/devicetree/bindings/net/rockchip-dwmac.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/rockchip-dwmac.yaml b/Documentation/devicetree/bindings/net/rockchip-dwmac.yaml
index e8dda1961ab3..2a0cd56fb4fe 100644
--- a/Documentation/devicetree/bindings/net/rockchip-dwmac.yaml
+++ b/Documentation/devicetree/bindings/net/rockchip-dwmac.yaml
@@ -87,6 +87,9 @@ properties:
 
   dma-coherent: true
 
+  iommus:
+    maxItems: 1
+
   clock_in_out:
     description:
       For RGMII, it must be "input", means main clock(125MHz)

-- 
2.55.0



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 2/9] dt-bindings: ata: rockchip,dwc-ahci: Allow iommus
  2026-11-13 16:38 [PATCH 0/9] RK3588: Enable the PHP SMMU Arun Iyengar via B4 Relay
  2026-11-13 16:38 ` [PATCH 1/9] dt-bindings: net: rockchip-dwmac: Allow iommus Arun Iyengar via B4 Relay
@ 2026-11-13 16:38 ` Arun Iyengar via B4 Relay
  2026-11-17 17:35   ` netdev-bot+sashiko
  2026-11-13 16:38 ` [PATCH 3/9] dt-bindings: soc: rockchip: grf: Allow a clock for the RK3588 PHP GRF Arun Iyengar via B4 Relay
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 20+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-11-13 16:38 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, David Wu, Damien Le Moal, Niklas Cassel, Serge Semin,
	netdev, devicetree, linux-arm-kernel, linux-rockchip,
	linux-kernel, linux-ide, Pranjal Shrivastava, Will Deacon,
	Robin Murphy, iommu, Shawn Lin, Sebastian Reichel, Arun Iyengar

From: Arun Iyengar <aiyengar1990@gmail.com>

The RK3588 SATA controllers are behind the PHP SMMU. Allow iommus, as
snps,dwc-ahci does.

Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
 Documentation/devicetree/bindings/ata/rockchip,dwc-ahci.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/ata/rockchip,dwc-ahci.yaml b/Documentation/devicetree/bindings/ata/rockchip,dwc-ahci.yaml
index b5ecaabfe2e2..e33e8b5591ee 100644
--- a/Documentation/devicetree/bindings/ata/rockchip,dwc-ahci.yaml
+++ b/Documentation/devicetree/bindings/ata/rockchip,dwc-ahci.yaml
@@ -34,6 +34,9 @@ properties:
           - rockchip,rk3588-dwc-ahci
       - const: snps,dwc-ahci
 
+  iommus:
+    maxItems: 1
+
   ports-implemented:
     const: 1
 

-- 
2.55.0



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 3/9] dt-bindings: soc: rockchip: grf: Allow a clock for the RK3588 PHP GRF
  2026-11-13 16:38 [PATCH 0/9] RK3588: Enable the PHP SMMU Arun Iyengar via B4 Relay
  2026-11-13 16:38 ` [PATCH 1/9] dt-bindings: net: rockchip-dwmac: Allow iommus Arun Iyengar via B4 Relay
  2026-11-13 16:38 ` [PATCH 2/9] dt-bindings: ata: rockchip,dwc-ahci: " Arun Iyengar via B4 Relay
@ 2026-11-13 16:38 ` Arun Iyengar via B4 Relay
  2026-11-17 17:35   ` netdev-bot+sashiko
  2026-11-13 16:38 ` [PATCH 4/9] soc: rockchip: grf: Assign the StreamIDs of the RK3588 PHP SMMU masters Arun Iyengar via B4 Relay
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 20+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-11-13 16:38 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, David Wu, Damien Le Moal, Niklas Cassel, Serge Semin,
	netdev, devicetree, linux-arm-kernel, linux-rockchip,
	linux-kernel, linux-ide, Pranjal Shrivastava, Will Deacon,
	Robin Murphy, iommu, Shawn Lin, Sebastian Reichel, Arun Iyengar

From: Arun Iyengar <aiyengar1990@gmail.com>

The RK3588 PHP GRF is clocked from pclk_php_root, which is gated when
no PHP peripheral holds it. Allow the clock, so the syscon regmap
enables it.

Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
 Documentation/devicetree/bindings/soc/rockchip/grf.yaml | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/soc/rockchip/grf.yaml b/Documentation/devicetree/bindings/soc/rockchip/grf.yaml
index e94c83d7c138..2525eb51f13b 100644
--- a/Documentation/devicetree/bindings/soc/rockchip/grf.yaml
+++ b/Documentation/devicetree/bindings/soc/rockchip/grf.yaml
@@ -321,8 +321,16 @@ allOf:
         - clocks
 
     else:
-      properties:
-        clocks: false
+      if:
+        not:
+          properties:
+            compatible:
+              contains:
+                const: rockchip,rk3588-php-grf
+
+      then:
+        properties:
+          clocks: false
 
 examples:
   - |

-- 
2.55.0



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 4/9] soc: rockchip: grf: Assign the StreamIDs of the RK3588 PHP SMMU masters
  2026-11-13 16:38 [PATCH 0/9] RK3588: Enable the PHP SMMU Arun Iyengar via B4 Relay
                   ` (2 preceding siblings ...)
  2026-11-13 16:38 ` [PATCH 3/9] dt-bindings: soc: rockchip: grf: Allow a clock for the RK3588 PHP GRF Arun Iyengar via B4 Relay
@ 2026-11-13 16:38 ` Arun Iyengar via B4 Relay
  2026-11-13 16:38 ` [PATCH 5/9] arm64: dts: rockchip: Add the PHP GRF clock on RK3588 Arun Iyengar via B4 Relay
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 20+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-11-13 16:38 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, David Wu, Damien Le Moal, Niklas Cassel, Serge Semin,
	netdev, devicetree, linux-arm-kernel, linux-rockchip,
	linux-kernel, linux-ide, Pranjal Shrivastava, Will Deacon,
	Robin Murphy, iommu, Shawn Lin, Sebastian Reichel, Arun Iyengar

From: Arun Iyengar <aiyengar1990@gmail.com>

The StreamIDs of the six masters behind the RK3588 PHP SMMU come from
PHP GRF registers that reset to 0 and are never programmed, so the SMMU
can not tell the masters apart.

Assign StreamIDs 1-6 on both AXI channels. 0 stays unused, so a master
that loses its ID is aborted instead of using another device's tables.

Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
 drivers/soc/rockchip/grf.c | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/drivers/soc/rockchip/grf.c b/drivers/soc/rockchip/grf.c
index b459607c118a..3f0f82a2119f 100644
--- a/drivers/soc/rockchip/grf.c
+++ b/drivers/soc/rockchip/grf.c
@@ -168,6 +168,40 @@ static const struct rockchip_grf_info rk3588_sysgrf __initconst = {
 	.num_values = ARRAY_SIZE(rk3588_defaults),
 };
 
+/* PHP SMMU StreamIDs: bits 15:0, no write-enable mask */
+#define RK3588_PHP_GRF_GMAC0_SID_AW	0x0074
+#define RK3588_PHP_GRF_GMAC1_SID_AW	0x007c
+#define RK3588_PHP_GRF_SATA0_SID_AW	0x0084
+#define RK3588_PHP_GRF_SATA1_SID_AW	0x008c
+#define RK3588_PHP_GRF_SATA2_SID_AW	0x0094
+#define RK3588_PHP_GRF_GMAC0_SID_AR	0x009c
+#define RK3588_PHP_GRF_GMAC1_SID_AR	0x00a4
+#define RK3588_PHP_GRF_SATA0_SID_AR	0x00ac
+#define RK3588_PHP_GRF_SATA1_SID_AR	0x00b4
+#define RK3588_PHP_GRF_SATA2_SID_AR	0x00bc
+#define RK3588_PHP_GRF_USB3OTG2_SID_AR	0x00c4
+#define RK3588_PHP_GRF_USB3OTG2_SID_AW	0x00cc
+
+static const struct rockchip_grf_value rk3588_defaults_php_grf[] __initconst = {
+	{ "gmac0 write streamid", RK3588_PHP_GRF_GMAC0_SID_AW, 1 },
+	{ "gmac0 read streamid", RK3588_PHP_GRF_GMAC0_SID_AR, 1 },
+	{ "gmac1 write streamid", RK3588_PHP_GRF_GMAC1_SID_AW, 2 },
+	{ "gmac1 read streamid", RK3588_PHP_GRF_GMAC1_SID_AR, 2 },
+	{ "sata0 write streamid", RK3588_PHP_GRF_SATA0_SID_AW, 3 },
+	{ "sata0 read streamid", RK3588_PHP_GRF_SATA0_SID_AR, 3 },
+	{ "sata1 write streamid", RK3588_PHP_GRF_SATA1_SID_AW, 4 },
+	{ "sata1 read streamid", RK3588_PHP_GRF_SATA1_SID_AR, 4 },
+	{ "sata2 write streamid", RK3588_PHP_GRF_SATA2_SID_AW, 5 },
+	{ "sata2 read streamid", RK3588_PHP_GRF_SATA2_SID_AR, 5 },
+	{ "usb3otg2 write streamid", RK3588_PHP_GRF_USB3OTG2_SID_AW, 6 },
+	{ "usb3otg2 read streamid", RK3588_PHP_GRF_USB3OTG2_SID_AR, 6 },
+};
+
+static const struct rockchip_grf_info rk3588_phpgrf __initconst = {
+	.values = rk3588_defaults_php_grf,
+	.num_values = ARRAY_SIZE(rk3588_defaults_php_grf),
+};
+
 static const struct of_device_id rockchip_grf_dt_match[] __initconst = {
 	{
 		.compatible = "rockchip,rk3036-grf",
@@ -202,6 +236,9 @@ static const struct of_device_id rockchip_grf_dt_match[] __initconst = {
 	}, {
 		.compatible = "rockchip,rk3576-ioc-grf",
 		.data = (void *)&rk3576_iocgrf,
+	}, {
+		.compatible = "rockchip,rk3588-php-grf",
+		.data = (void *)&rk3588_phpgrf,
 	}, {
 		.compatible = "rockchip,rk3588-sys-grf",
 		.data = (void *)&rk3588_sysgrf,

-- 
2.55.0



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 5/9] arm64: dts: rockchip: Add the PHP GRF clock on RK3588
  2026-11-13 16:38 [PATCH 0/9] RK3588: Enable the PHP SMMU Arun Iyengar via B4 Relay
                   ` (3 preceding siblings ...)
  2026-11-13 16:38 ` [PATCH 4/9] soc: rockchip: grf: Assign the StreamIDs of the RK3588 PHP SMMU masters Arun Iyengar via B4 Relay
@ 2026-11-13 16:38 ` Arun Iyengar via B4 Relay
  2026-11-17 17:35   ` netdev-bot+sashiko
  2026-11-13 16:38 ` [PATCH 6/9] soc: rockchip: grf: Restore the RK3588 PHP StreamIDs after system suspend Arun Iyengar via B4 Relay
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 20+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-11-13 16:38 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, David Wu, Damien Le Moal, Niklas Cassel, Serge Semin,
	netdev, devicetree, linux-arm-kernel, linux-rockchip,
	linux-kernel, linux-ide, Pranjal Shrivastava, Will Deacon,
	Robin Murphy, iommu, Shawn Lin, Sebastian Reichel, Arun Iyengar

From: Arun Iyengar <aiyengar1990@gmail.com>

Once the PHP peripherals suspend, pclk_php_root is gated and a PHP GRF
access hangs; the syscore resume op of the next patch hung deep suspend
this way. Add the clock, so the syscon regmap enables it.

Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
 arch/arm64/boot/dts/rockchip/rk3588-base.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
index d0f364547ae5..8807ce6193bf 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
@@ -619,6 +619,7 @@ usb_grf: syscon@fd5ac000 {
 	php_grf: syscon@fd5b0000 {
 		compatible = "rockchip,rk3588-php-grf", "syscon";
 		reg = <0x0 0xfd5b0000 0x0 0x1000>;
+		clocks = <&cru PCLK_PHP_ROOT>;
 	};
 
 	csidphy0_grf: syscon@fd5b4000 {

-- 
2.55.0



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 6/9] soc: rockchip: grf: Restore the RK3588 PHP StreamIDs after system suspend
  2026-11-13 16:38 [PATCH 0/9] RK3588: Enable the PHP SMMU Arun Iyengar via B4 Relay
                   ` (4 preceding siblings ...)
  2026-11-13 16:38 ` [PATCH 5/9] arm64: dts: rockchip: Add the PHP GRF clock on RK3588 Arun Iyengar via B4 Relay
@ 2026-11-13 16:38 ` Arun Iyengar via B4 Relay
  2026-11-17 17:35   ` netdev-bot+sashiko
  2026-11-13 16:38 ` [PATCH 7/9] arm64: dts: rockchip: Add the clock and reset of the RK3588 PHP SMMU Arun Iyengar via B4 Relay
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 20+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-11-13 16:38 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, David Wu, Damien Le Moal, Niklas Cassel, Serge Semin,
	netdev, devicetree, linux-arm-kernel, linux-rockchip,
	linux-kernel, linux-ide, Pranjal Shrivastava, Will Deacon,
	Robin Murphy, iommu, Shawn Lin, Sebastian Reichel, Arun Iyengar

From: Arun Iyengar <aiyengar1990@gmail.com>

The PHP GRF is in PD_PHP, which firmware may power off in system
suspend. The SMMU aborts a master whose StreamID was lost.

Write the StreamIDs again from a syscore resume op, before devices
resume. Register it only when the node has a clock, as the access hangs
without it.

Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
 drivers/soc/rockchip/grf.c | 70 ++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 68 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/rockchip/grf.c b/drivers/soc/rockchip/grf.c
index 3f0f82a2119f..8f318ebc14e9 100644
--- a/drivers/soc/rockchip/grf.c
+++ b/drivers/soc/rockchip/grf.c
@@ -11,6 +11,8 @@
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
+#include <linux/slab.h>
+#include <linux/syscore_ops.h>
 
 
 struct rockchip_grf_value {
@@ -22,6 +24,14 @@ struct rockchip_grf_value {
 struct rockchip_grf_info {
 	const struct rockchip_grf_value *values;
 	int num_values;
+	/* Rewrite the values on resume; such tables must not be __initconst */
+	bool restore_on_resume;
+};
+
+struct rockchip_grf_restore {
+	struct syscore syscore;
+	struct regmap *grf;
+	const struct rockchip_grf_info *info;
 };
 
 #define RK3036_GRF_SOC_CON0		0x140
@@ -182,7 +192,7 @@ static const struct rockchip_grf_info rk3588_sysgrf __initconst = {
 #define RK3588_PHP_GRF_USB3OTG2_SID_AR	0x00c4
 #define RK3588_PHP_GRF_USB3OTG2_SID_AW	0x00cc
 
-static const struct rockchip_grf_value rk3588_defaults_php_grf[] __initconst = {
+static const struct rockchip_grf_value rk3588_defaults_php_grf[] = {
 	{ "gmac0 write streamid", RK3588_PHP_GRF_GMAC0_SID_AW, 1 },
 	{ "gmac0 read streamid", RK3588_PHP_GRF_GMAC0_SID_AR, 1 },
 	{ "gmac1 write streamid", RK3588_PHP_GRF_GMAC1_SID_AW, 2 },
@@ -197,9 +207,10 @@ static const struct rockchip_grf_value rk3588_defaults_php_grf[] __initconst = {
 	{ "usb3otg2 read streamid", RK3588_PHP_GRF_USB3OTG2_SID_AR, 6 },
 };
 
-static const struct rockchip_grf_info rk3588_phpgrf __initconst = {
+static const struct rockchip_grf_info rk3588_phpgrf = {
 	.values = rk3588_defaults_php_grf,
 	.num_values = ARRAY_SIZE(rk3588_defaults_php_grf),
+	.restore_on_resume = true,
 };
 
 static const struct of_device_id rockchip_grf_dt_match[] __initconst = {
@@ -246,6 +257,59 @@ static const struct of_device_id rockchip_grf_dt_match[] __initconst = {
 	{ /* sentinel */ },
 };
 
+/* Syscore op: runs before the SMMU and its masters resume */
+static void rockchip_grf_resume(void *data)
+{
+	struct rockchip_grf_restore *restore = data;
+	const struct rockchip_grf_info *info = restore->info;
+	unsigned int cur;
+	int i, lost = 0;
+
+	for (i = 0; i < info->num_values; i++) {
+		const struct rockchip_grf_value *val = &info->values[i];
+
+		if (!regmap_read(restore->grf, val->reg, &cur) && cur == val->val)
+			continue;
+
+		lost++;
+		if (regmap_write(restore->grf, val->reg, val->val))
+			pr_err("%s: restoring %s in %#6x failed\n", __func__,
+			       val->desc, val->reg);
+	}
+
+	if (lost)
+		pr_info("%s: restored %d of %d values lost in suspend\n",
+			__func__, lost, info->num_values);
+}
+
+static const struct syscore_ops rockchip_grf_syscore_ops = {
+	.resume = rockchip_grf_resume,
+};
+
+static void __init rockchip_grf_register_restore(struct device_node *np,
+						 struct regmap *grf,
+						 const struct rockchip_grf_info *info)
+{
+	struct rockchip_grf_restore *restore;
+
+	if (!IS_ENABLED(CONFIG_PM_SLEEP) || !info->restore_on_resume)
+		return;
+
+	/* Without its bus clock the GRF is not accessible in syscore resume */
+	if (!of_property_present(np, "clocks"))
+		return;
+
+	restore = kzalloc_obj(*restore);
+	if (!restore)
+		return;
+
+	restore->grf = grf;
+	restore->info = info;
+	restore->syscore.ops = &rockchip_grf_syscore_ops;
+	restore->syscore.data = restore;
+	register_syscore(&restore->syscore);
+}
+
 static int __init rockchip_grf_init(void)
 {
 	const struct rockchip_grf_info *grf_info;
@@ -282,6 +346,8 @@ static int __init rockchip_grf_init(void)
 				pr_err("%s: write to %#6x failed with %d\n",
 					__func__, val->reg, ret);
 		}
+
+		rockchip_grf_register_restore(np, grf, grf_info);
 	}
 
 	return 0;

-- 
2.55.0



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 7/9] arm64: dts: rockchip: Add the clock and reset of the RK3588 PHP SMMU
  2026-11-13 16:38 [PATCH 0/9] RK3588: Enable the PHP SMMU Arun Iyengar via B4 Relay
                   ` (5 preceding siblings ...)
  2026-11-13 16:38 ` [PATCH 6/9] soc: rockchip: grf: Restore the RK3588 PHP StreamIDs after system suspend Arun Iyengar via B4 Relay
@ 2026-11-13 16:38 ` Arun Iyengar via B4 Relay
  2026-11-17 17:35   ` netdev-bot+sashiko
  2026-11-13 16:38 ` [PATCH 8/9] arm64: dts: rockchip: Attach the masters " Arun Iyengar via B4 Relay
  2026-11-13 16:38 ` [PATCH 9/9] arm64: dts: rockchip: Enable " Arun Iyengar via B4 Relay
  8 siblings, 1 reply; 20+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-11-13 16:38 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, David Wu, Damien Le Moal, Niklas Cassel, Serge Semin,
	netdev, devicetree, linux-arm-kernel, linux-rockchip,
	linux-kernel, linux-ide, Pranjal Shrivastava, Will Deacon,
	Robin Murphy, iommu, Shawn Lin, Sebastian Reichel, Arun Iyengar

From: Arun Iyengar <aiyengar1990@gmail.com>

Describe ACLK_MMU_PHP, so the SMMU keeps its clock while its masters
are idle, and SRST_A_MMU_PHP, as for the PCIe SMMU.

Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
 arch/arm64/boot/dts/rockchip/rk3588-base.dtsi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
index 8807ce6193bf..3bf8d0e4ff33 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
@@ -570,6 +570,8 @@ mmu600_php: iommu@fcb00000 {
 			     <GIC_SPI 386 IRQ_TYPE_EDGE_RISING 0>,
 			     <GIC_SPI 379 IRQ_TYPE_EDGE_RISING 0>;
 		interrupt-names = "eventq", "gerror", "priq", "cmdq-sync";
+		clocks = <&cru ACLK_MMU_PHP>;
+		resets = <&cru SRST_A_MMU_PHP>;
 		#iommu-cells = <1>;
 		status = "disabled";
 	};

-- 
2.55.0



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 8/9] arm64: dts: rockchip: Attach the masters of the RK3588 PHP SMMU
  2026-11-13 16:38 [PATCH 0/9] RK3588: Enable the PHP SMMU Arun Iyengar via B4 Relay
                   ` (6 preceding siblings ...)
  2026-11-13 16:38 ` [PATCH 7/9] arm64: dts: rockchip: Add the clock and reset of the RK3588 PHP SMMU Arun Iyengar via B4 Relay
@ 2026-11-13 16:38 ` Arun Iyengar via B4 Relay
  2026-11-17 17:35   ` netdev-bot+sashiko
  2026-11-13 16:38 ` [PATCH 9/9] arm64: dts: rockchip: Enable " Arun Iyengar via B4 Relay
  8 siblings, 1 reply; 20+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-11-13 16:38 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, David Wu, Damien Le Moal, Niklas Cassel, Serge Semin,
	netdev, devicetree, linux-arm-kernel, linux-rockchip,
	linux-kernel, linux-ide, Pranjal Shrivastava, Will Deacon,
	Robin Murphy, iommu, Shawn Lin, Sebastian Reichel, Arun Iyengar

From: Arun Iyengar <aiyengar1990@gmail.com>

GMAC0/1, SATA0-2 and USB3OTG_2 are behind MMU600_PHP with StreamIDs
1-6. No effect until the SMMU is enabled.

Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
 arch/arm64/boot/dts/rockchip/rk3588-base.dtsi  | 4 ++++
 arch/arm64/boot/dts/rockchip/rk3588-extra.dtsi | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
index 3bf8d0e4ff33..cb0a39f63788 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
@@ -534,6 +534,7 @@ usb_host2_xhci: usb@fcd00000 {
 		compatible = "rockchip,rk3588-dwc3", "snps,dwc3";
 		reg = <0x0 0xfcd00000 0x0 0x400000>;
 		interrupts = <GIC_SPI 222 IRQ_TYPE_LEVEL_HIGH 0>;
+		iommus = <&mmu600_php 6>;
 		clocks = <&cru REF_CLK_USB3OTG2>, <&cru SUSPEND_CLK_USB3OTG2>,
 			 <&cru ACLK_USB3OTG2>, <&cru CLK_UTMI_OTG2>,
 			 <&cru CLK_PIPEPHY2_PIPE_U3_G>;
@@ -2310,6 +2311,7 @@ gmac1: ethernet@fe1c0000 {
 		interrupts = <GIC_SPI 234 IRQ_TYPE_LEVEL_HIGH 0>,
 			     <GIC_SPI 233 IRQ_TYPE_LEVEL_HIGH 0>;
 		interrupt-names = "macirq", "eth_wake_irq";
+		iommus = <&mmu600_php 2>;
 		clocks = <&cru CLK_GMAC_125M>, <&cru CLK_GMAC_50M>,
 			 <&cru PCLK_GMAC1>, <&cru ACLK_GMAC1>,
 			 <&cru CLK_GMAC1_PTP_REF>;
@@ -2357,6 +2359,7 @@ sata0: sata@fe210000 {
 		compatible = "rockchip,rk3588-dwc-ahci", "snps,dwc-ahci";
 		reg = <0 0xfe210000 0 0x1000>;
 		interrupts = <GIC_SPI 273 IRQ_TYPE_LEVEL_HIGH 0>;
+		iommus = <&mmu600_php 3>;
 		clocks = <&cru ACLK_SATA0>, <&cru CLK_PMALIVE0>,
 			 <&cru CLK_RXOOB0>, <&cru CLK_PIPEPHY0_REF>,
 			 <&cru CLK_PIPEPHY0_PIPE_ASIC_G>;
@@ -2380,6 +2383,7 @@ sata2: sata@fe230000 {
 		compatible = "rockchip,rk3588-dwc-ahci", "snps,dwc-ahci";
 		reg = <0 0xfe230000 0 0x1000>;
 		interrupts = <GIC_SPI 275 IRQ_TYPE_LEVEL_HIGH 0>;
+		iommus = <&mmu600_php 5>;
 		clocks = <&cru ACLK_SATA2>, <&cru CLK_PMALIVE2>,
 			 <&cru CLK_RXOOB2>, <&cru CLK_PIPEPHY2_REF>,
 			 <&cru CLK_PIPEPHY2_PIPE_ASIC_G>;
diff --git a/arch/arm64/boot/dts/rockchip/rk3588-extra.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-extra.dtsi
index 2bcf30d8a338..425770a8ff61 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588-extra.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3588-extra.dtsi
@@ -538,6 +538,7 @@ gmac0: ethernet@fe1b0000 {
 		interrupts = <GIC_SPI 227 IRQ_TYPE_LEVEL_HIGH 0>,
 			     <GIC_SPI 226 IRQ_TYPE_LEVEL_HIGH 0>;
 		interrupt-names = "macirq", "eth_wake_irq";
+		iommus = <&mmu600_php 1>;
 		clocks = <&cru CLK_GMAC_125M>, <&cru CLK_GMAC_50M>,
 			 <&cru PCLK_GMAC0>, <&cru ACLK_GMAC0>,
 			 <&cru CLK_GMAC0_PTP_REF>;
@@ -585,6 +586,7 @@ sata1: sata@fe220000 {
 		compatible = "rockchip,rk3588-dwc-ahci", "snps,dwc-ahci";
 		reg = <0 0xfe220000 0 0x1000>;
 		interrupts = <GIC_SPI 274 IRQ_TYPE_LEVEL_HIGH 0>;
+		iommus = <&mmu600_php 4>;
 		clocks = <&cru ACLK_SATA1>, <&cru CLK_PMALIVE1>,
 			 <&cru CLK_RXOOB1>, <&cru CLK_PIPEPHY1_REF>,
 			 <&cru CLK_PIPEPHY1_PIPE_ASIC_G>;

-- 
2.55.0



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 9/9] arm64: dts: rockchip: Enable the RK3588 PHP SMMU
  2026-11-13 16:38 [PATCH 0/9] RK3588: Enable the PHP SMMU Arun Iyengar via B4 Relay
                   ` (7 preceding siblings ...)
  2026-11-13 16:38 ` [PATCH 8/9] arm64: dts: rockchip: Attach the masters " Arun Iyengar via B4 Relay
@ 2026-11-13 16:38 ` Arun Iyengar via B4 Relay
  2026-11-14 16:39   ` sashiko-bot
  2026-11-17 17:35   ` netdev-bot+sashiko
  8 siblings, 2 replies; 20+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-11-13 16:38 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, David Wu, Damien Le Moal, Niklas Cassel, Serge Semin,
	netdev, devicetree, linux-arm-kernel, linux-rockchip,
	linux-kernel, linux-ide, Pranjal Shrivastava, Will Deacon,
	Robin Murphy, iommu, Shawn Lin, Sebastian Reichel, Arun Iyengar

From: Arun Iyengar <aiyengar1990@gmail.com>

Its masters now have StreamIDs and iommus, and the SMMU has its clock.

PD_PHP is powered off in deep suspend and the SMMU resumes from reset
in bypass, so this needs arm-smmu-v3 system sleep support [1].

Link: https://lore.kernel.org/r/20260929034510.2023173-1-praan@google.com [1]
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
 arch/arm64/boot/dts/rockchip/rk3588-base.dtsi | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
index cb0a39f63788..0c3d59a39182 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
@@ -574,7 +574,6 @@ mmu600_php: iommu@fcb00000 {
 		clocks = <&cru ACLK_MMU_PHP>;
 		resets = <&cru SRST_A_MMU_PHP>;
 		#iommu-cells = <1>;
-		status = "disabled";
 	};
 
 	pmu1grf: syscon@fd58a000 {

-- 
2.55.0



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH 9/9] arm64: dts: rockchip: Enable the RK3588 PHP SMMU
  2026-11-13 16:38 ` [PATCH 9/9] arm64: dts: rockchip: Enable " Arun Iyengar via B4 Relay
@ 2026-11-14 16:39   ` sashiko-bot
  2026-11-15  7:59     ` Arun Iyengar
  2026-11-17 17:35   ` netdev-bot+sashiko
  1 sibling, 1 reply; 20+ messages in thread
From: sashiko-bot @ 2026-11-14 16:39 UTC (permalink / raw)
  To: Arun Iyengar; +Cc: devicetree, linux-ide, robh, conor+dt, dlemoal, cassel

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] arm64: dts: rockchip: mmu600_php enabled without arm-smmu-v3
  sleep PM support
--

commit 3839dbc025f5f6bf3346a2b85f6dda76ed471a93
Author: Arun Iyengar <aiyengar1990@gmail.com>

arm64: dts: rockchip: Enable the RK3588 PHP SMMU

This commit enables the mmu600_php IOMMU node on RK3588 SoCs by removing
its disabled status.

Link: https://lore.kernel.org/r/20260929034510.2023173-1-praan@google.com [1]

> diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
> index 2b6e14e7e1a3c..ed54d888caba2 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
> +++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
> @@ -576,7 +576,6 @@ mmu600_php: iommu@fcb00000 {
>  		clocks = <&cru ACLK_MMU_PHP>;
>  		resets = <&cru SRST_A_MMU_PHP>;
>  		#iommu-cells = <1>;
> -		status = "disabled";
>  	};

[Severity: High]
Does enabling mmu600_php break deep system suspend and resume while
arm_smmu_driver lacks .driver.pm sleep callbacks?

When PD_PHP is powered off during deep suspend, mmu600_php loses its
register state and resumes from reset in bypass mode with its command
queue disabled, while attached PHP masters (such as PCIe, SATA, GMAC, and
USB) remain bound to translated IOMMU DMA domains.  On resume, DMA from
those devices uses virtual IOVAs directly as physical addresses on the
bus, corrupting memory, and subsequent command queue operations stall
until CMD_SYNC times out.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261113-mmu600-php-v1-0-231196049a3b@gmail.com?part=9

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 9/9] arm64: dts: rockchip: Enable the RK3588 PHP SMMU
  2026-11-14 16:39   ` sashiko-bot
@ 2026-11-15  7:59     ` Arun Iyengar
  0 siblings, 0 replies; 20+ messages in thread
From: Arun Iyengar @ 2026-11-15  7:59 UTC (permalink / raw)
  To: sashiko-reviews; +Cc: devicetree, linux-ide, robh, conor+dt, dlemoal, cassel

> Does enabling mmu600_php break deep system suspend and resume while
> arm_smmu_driver lacks .driver.pm sleep callbacks?

Yes. That is why the cover letter asks to hold this patch until [1],
which adds the sleep ops, is merged. With [1], deep suspend passed 3/3.
v2 will repeat the dependency.

[1] https://lore.kernel.org/r/20260929034510.2023173-1-praan@google.com

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/9] dt-bindings: net: rockchip-dwmac: Allow iommus
  2026-11-13 16:38 ` [PATCH 1/9] dt-bindings: net: rockchip-dwmac: Allow iommus Arun Iyengar via B4 Relay
@ 2026-11-17 17:35   ` netdev-bot+sashiko
  0 siblings, 0 replies; 20+ messages in thread
From: netdev-bot+sashiko @ 2026-11-17 17:35 UTC (permalink / raw)
  To: aiyengar1990
  Cc: robh, krzk+dt, conor+dt, heiko, andrew+netdev, davem, edumazet,
	kuba, pabeni, david.wu, dlemoal, cassel, fancer.lancer, netdev,
	devicetree, linux-arm-kernel, linux-rockchip, linux-kernel,
	linux-ide, praan, will, robin.murphy, iommu, shawn.lin,
	sebastian.reichel

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] This patch ("dt-bindings: net: rockchip-dwmac: Allow iommus")
  adds `iommus: maxItems: 1` to the top-level `properties:` map of…

--

dt-bindings: net: rockchip-dwmac: Allow iommus

This commit adds an iommus property, limited to one entry, to the
Rockchip DWMAC binding. The commit message says the RK3588 GMACs sit
behind the PHP SMMU.

> diff --git a/Documentation/devicetree/bindings/net/rockchip-dwmac.yaml b/Documentation/devicetree/bindings/net/rockchip-dwmac.yaml
> index e8dda1961ab31..2a0cd56fb4fe9 100644
> --- a/Documentation/devicetree/bindings/net/rockchip-dwmac.yaml
> +++ b/Documentation/devicetree/bindings/net/rockchip-dwmac.yaml
> @@ -87,6 +87,9 @@ properties:
>  
>    dma-coherent: true
>  
> +  iommus:
> +    maxItems: 1
> +

[Severity: Low]
The commit message only gives a reason for RK3588, but iommus is added to
the top-level properties without any compatible-based condition. Was it
intended to allow iommus on every Rockchip GMAC compatible (px30, rk3128,
rk3228, rk3288, rk3308, rk3328, rk3366, rk3368, rk3399, rk3506, rk3528,
rk3568, rk3576, rv1108, rv1126)?

In the in-tree DTS, the only SMMU a GMAC could reference appears to be
mmu600_php in rk3588-base.dtsi:

arch/arm64/boot/dts/rockchip/rk3588-base.dtsi:
	mmu600_php: iommu@fcb00000 {

The same binding already restricts the PHP-specific rockchip,php-grf
property to the SoCs that have it:

  - if:
      properties:
        compatible:
          contains:
            enum:
              - rockchip,rk3576-gmac
              - rockchip,rk3588-gmac
    then:
      required:
        - rockchip,php-grf
    else:
      properties:
        rockchip,php-grf: false

As written, a GMAC node for a non-RK3588 SoC that carries an iommus
phandle (for example, one copied from an RK3588 node) would pass
dtbs_check without a warning.

Could iommus be scoped in a similar conditional, with iommus: false for
the compatibles other than rockchip,rk3588-gmac? If allowing it on all
variants is intentional, could the commit message say so?

>    clock_in_out:
>      description:
>        For RGMII, it must be "input", means main clock(125MHz)

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261113-mmu600-php-v1-0-231196049a3b%40gmail.com

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 2/9] dt-bindings: ata: rockchip,dwc-ahci: Allow iommus
  2026-11-13 16:38 ` [PATCH 2/9] dt-bindings: ata: rockchip,dwc-ahci: " Arun Iyengar via B4 Relay
@ 2026-11-17 17:35   ` netdev-bot+sashiko
  0 siblings, 0 replies; 20+ messages in thread
From: netdev-bot+sashiko @ 2026-11-17 17:35 UTC (permalink / raw)
  To: aiyengar1990
  Cc: robh, krzk+dt, conor+dt, heiko, andrew+netdev, davem, edumazet,
	kuba, pabeni, david.wu, dlemoal, cassel, fancer.lancer, netdev,
	devicetree, linux-arm-kernel, linux-rockchip, linux-kernel,
	linux-ide, praan, will, robin.murphy, iommu, shawn.lin,
	sebastian.reichel

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The patch adds `iommus: maxItems: 1` at the top level of
  `Documentation/devicetree/bindings/ata/rockchip,dwc-ahci.yaml` (lines…

--

dt-bindings: ata: rockchip,dwc-ahci: Allow iommus

This adds an iommus property, limited to one item, to the Rockchip DWC
AHCI binding. The commit message says the RK3588 SATA controllers sit
behind the PHP SMMU.

> diff --git a/Documentation/devicetree/bindings/ata/rockchip,dwc-ahci.yaml b/Documentation/devicetree/bindings/ata/rockchip,dwc-ahci.yaml
> index b5ecaabfe2e25..e33e8b5591ee5 100644
> --- a/Documentation/devicetree/bindings/ata/rockchip,dwc-ahci.yaml
> +++ b/Documentation/devicetree/bindings/ata/rockchip,dwc-ahci.yaml
> @@ -34,6 +34,9 @@ properties:
>            - rockchip,rk3588-dwc-ahci
>        - const: snps,dwc-ahci
>  
> +  iommus:
> +    maxItems: 1
> +

[Severity: Low]
Should iommus be limited to rockchip,rk3588-dwc-ahci?

As added, the property is unconditional. That makes it valid for all
three compatibles in the select block: rockchip,rk3568-dwc-ahci,
rockchip,rk3576-dwc-ahci and rockchip,rk3588-dwc-ahci.

The commit message only gives a hardware reason for RK3588:

  The RK3588 SATA controllers are behind the PHP SMMU.

The in-tree SoC descriptions match that. mmu600_php: iommu@fcb00000
(arm,smmu-v3) exists only in rk3588-base.dtsi. In rk356x-base.dtsi and
rk3576.dtsi, the only IOMMUs are for media blocks (vdpu, vepu, vicap,
vop, vdec), and none of them sit in front of the SATA nodes.

The binding already has a separate allOf entry for the older SoCs:

  - if:
      properties:
        compatible:
          contains:
            enum:
              - rockchip,rk3568-dwc-ahci
              - rockchip,rk3576-dwc-ahci
    then:
      properties:
        clocks:
          maxItems: 3

With this patch, dtbs_check would no longer flag an iommus property
added by mistake to an RK3568 or RK3576 SATA node.

One option is to add iommus: false to the rk3568/rk3576 then: branch.
Another is to allow iommus only in the rk3588 branch.

snps,dwc-ahci.yaml, which the commit message cites, does allow iommus
unconditionally. This binding is per-SoC, though, and already has
per-compatible constraints.

>    ports-implemented:
>      const: 1
>

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261113-mmu600-php-v1-0-231196049a3b%40gmail.com

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 3/9] dt-bindings: soc: rockchip: grf: Allow a clock for the RK3588 PHP GRF
  2026-11-13 16:38 ` [PATCH 3/9] dt-bindings: soc: rockchip: grf: Allow a clock for the RK3588 PHP GRF Arun Iyengar via B4 Relay
@ 2026-11-17 17:35   ` netdev-bot+sashiko
  0 siblings, 0 replies; 20+ messages in thread
From: netdev-bot+sashiko @ 2026-11-17 17:35 UTC (permalink / raw)
  To: aiyengar1990
  Cc: robh, krzk+dt, conor+dt, heiko, andrew+netdev, davem, edumazet,
	kuba, pabeni, david.wu, dlemoal, cassel, fancer.lancer, netdev,
	devicetree, linux-arm-kernel, linux-rockchip, linux-kernel,
	linux-ide, praan, will, robin.murphy, iommu, shawn.lin,
	sebastian.reichel

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The RK3588 PHP GRF clock is allowed but not required.

Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but there is a
  pre-existing use-after-free in the error unwind of…

--

dt-bindings: soc: rockchip: grf: Allow a clock for the RK3588 PHP GRF

This patch changes the clocks conditional in the Rockchip GRF binding.
The rockchip,rk3588-php-grf compatible is now exempt from "clocks: false",
so the node can describe pclk_php_root and the syscon regmap can enable it.

> diff --git a/Documentation/devicetree/bindings/soc/rockchip/grf.yaml b/Documentation/devicetree/bindings/soc/rockchip/grf.yaml
> index e94c83d7c1383..2525eb51f13b0 100644
> --- a/Documentation/devicetree/bindings/soc/rockchip/grf.yaml
> +++ b/Documentation/devicetree/bindings/soc/rockchip/grf.yaml
> @@ -321,8 +321,16 @@ allOf:
>          - clocks
>  
>      else:
> -      properties:
> -        clocks: false
> +      if:
> +        not:
> +          properties:
> +            compatible:
> +              contains:
> +                const: rockchip,rk3588-php-grf
> +
> +      then:
> +        properties:
> +          clocks: false

[Severity: Low]
Should rockchip,rk3588-php-grf go into the enum in the if: branch above,
so that clocks is required and not just allowed?

The commit message says the PHP GRF is clocked from pclk_php_root, which
gets gated. The later patch "arm64: dts: rockchip: Add the PHP GRF clock on
RK3588" says PHP GRF accesses hang without it.

This block already handles GRFs that need a clock. rockchip,rk3588-vo-grf
and rockchip,rk3576-dcphy-grf are listed in the enum, which both allows and
requires clocks.

As written, a php_grf node without clocks still passes dtbs_check. At
runtime, of_syscon_register() treats a missing clock as optional:

drivers/mfd/syscon.c:of_syscon_register() {
    ...
		clk = of_clk_get(np, 0);
		if (IS_ERR(clk)) {
			ret = PTR_ERR(clk);
			/* clock is optional */
			if (ret != -ENOENT)
				goto err_clk;
    ...
}

On such a DT the regmap would never enable pclk_php_root. The StreamID
restore added later in the series ("soc: rockchip: grf: Restore the RK3588
PHP StreamIDs after system suspend") would also be skipped without any
warning.

If the clock is meant to stay optional for older DTBs, could the commit
message say so? The binding also doesn't say which clock is expected. There
is no items list or description naming pclk_php_root.

[Severity: High]
This is a pre-existing issue and was not introduced by this patch. With
this series, php_grf goes through the clock-attached path in
of_syscon_register(). Is there a use-after-free of the struct clk in that
function's error unwind?

regmap_mmio_attach_clk() stores the clk in the regmap context before it
prepares it:

drivers/base/regmap/regmap-mmio.c:regmap_mmio_attach_clk() {
	ctx->clk = clk;
	ctx->attached_clk = true;

	return clk_prepare(ctx->clk);
}

Two failures reach err_attach_clk: clk_prepare() failing, or
of_reset_control_get_optional_exclusive() returning an error. For example,
the reset lookup returns -EPROBE_DEFER if the reset controller hasn't
probed yet. The unwind is:

err_attach_clk:
	if (!IS_ERR(clk))
		clk_put(clk);
err_clk:
	regmap_exit(regmap);

clk_put() frees the struct clk through __clk_put()->free_clk(). After that,
regmap_exit()->regmap_mmio_free_context() still uses the stored pointer:

	if (!IS_ERR(ctx->clk)) {
		clk_unprepare(ctx->clk);
		...

clk_unprepare() then reads clk->core from the freed object. If
clk_prepare() was the step that failed, it also unprepares a clock that was
never prepared.

Would it fix this to detach the clock from the regmap, or to call
regmap_exit(), before clk_put()?

The php_grf node has no resets, so for php_grf only a clk_prepare() failure
can reach this path. Any syscon node with both clocks and resets is
affected. Syscon registration is retried on every lookup, so the path can
run repeatedly. The unwind comes from a00406b71c5f ("mfd: syscon: Add
optional clock support") and 7d1e3bd94828 ("mfd: syscon: Allow reset
control for syscon devices").

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261113-mmu600-php-v1-0-231196049a3b%40gmail.com

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 5/9] arm64: dts: rockchip: Add the PHP GRF clock on RK3588
  2026-11-13 16:38 ` [PATCH 5/9] arm64: dts: rockchip: Add the PHP GRF clock on RK3588 Arun Iyengar via B4 Relay
@ 2026-11-17 17:35   ` netdev-bot+sashiko
  0 siblings, 0 replies; 20+ messages in thread
From: netdev-bot+sashiko @ 2026-11-17 17:35 UTC (permalink / raw)
  To: aiyengar1990
  Cc: robh, krzk+dt, conor+dt, heiko, andrew+netdev, davem, edumazet,
	kuba, pabeni, david.wu, dlemoal, cassel, fancer.lancer, netdev,
	devicetree, linux-arm-kernel, linux-rockchip, linux-kernel,
	linux-ide, praan, will, robin.murphy, iommu, shawn.lin,
	sebastian.reichel

Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] Adding `clocks = <&cru PCLK_PHP_ROOT>` to php_grf creates a DT
  dependency cycle: the cru node has `rockchip,grf = <&php_grf>`…
- [Low] Once the clock is attached, regmap-mmio wraps every PHP GRF
  access in clk_enable()/clk_disable() (regmap_mmio_write lines 157/165,…

--

arm64: dts: rockchip: Add the PHP GRF clock on RK3588

This adds a PCLK_PHP_ROOT clock reference to the php_grf syscon node on
RK3588, so that the syscon regmap enables pclk_php_root around PHP GRF
accesses. The motivation is a deep suspend hang in the syscore resume op
added by the next patch, which ran after the PHP peripherals had gated
pclk_php_root.

> diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
> index d0f364547ae55..8807ce6193bfc 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
> +++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
> @@ -619,6 +619,7 @@ usb_grf: syscon@fd5ac000 {
>  	php_grf: syscon@fd5b0000 {
>  		compatible = "rockchip,rk3588-php-grf", "syscon";
>  		reg = <0x0 0xfd5b0000 0x0 0x1000>;
> +		clocks = <&cru PCLK_PHP_ROOT>;

[Severity: Medium]
Does this create a dependency cycle with the cru node? The cru node in
this same file already has:

	rockchip,grf = <&php_grf>;

and php_grf now references a clock that cru provides.

On RK3588 the CRU looks up its GRF from the CLK_OF_DECLARE_DRIVER hook,
before its own clock provider is registered:

of_clk_init()
  rk3588_clk_early_init()
    rockchip_clk_init_early()
      rockchip_clk_init_base()
        syscon_regmap_lookup_by_phandle(ctx->cru_node, "rockchip,grf")
          of_syscon_register(php_grf, check_res=true)
            of_clk_get(np, 0)   <- now returns -EPROBE_DEFER
    ...
    rockchip_clk_of_add_provider(np, ctx)   <- provider only added here

of_syscon_register() only treats -ENOENT as a missing clock:

drivers/mfd/syscon.c:of_syscon_register() {
    ...
		clk = of_clk_get(np, 0);
		if (IS_ERR(clk)) {
			ret = PTR_ERR(clk);
			/* clock is optional */
			if (ret != -ENOENT)
				goto err_clk;
    ...
}

So the regmap is torn down and nothing is cached. clk_rk3588_probe()
reuses early_ctx and never retries the lookup. Would ctx->grf then stay
ERR_PTR(-EPROBE_DEFER) for good? Before this patch it was a valid php_grf
regmap.

Nothing on RK3588 seems to dereference ctx->grf today. The pll_rk3588 ops
don't use it, and the GATE_GRF branches use grf_type_sys from
aux_grf_table. However, rockchip_clk_register_branches() falls back to it
for grf mux/gate/mmc branches that have no matching aux GRF:

	struct regmap *grf = ctx->grf;

A future branch like that would silently get an error pointer.

There is also a second interaction. Before this patch, the CRU's early
lookup was the first to create and cache the php_grf regmap, and it did so
without a clock. Every later syscon_node_to_regmap() user got that
clockless regmap: rockchip_grf_init(), dwmac-rk via rockchip,php-grf, and
naneng-combphy via rockchip,pipe-grf.

With this patch, the clock only gets attached because the CRU lookup
fails. That failure moves the first successful creation to
rockchip_grf_init() at postcore_initcall, when PCLK_PHP_ROOT is already
available.

If the CRU lookup were moved after provider registration, or some earlier
caller created the regmap without the clock, a clockless regmap would be
cached again. The restore op in the following patch "soc: rockchip: grf:
Restore the RK3588 PHP StreamIDs after system suspend" only checks
of_property_present(np, "clocks"). It doesn't check whether the cached
regmap actually carries the clock. Wouldn't deep suspend hang again in
that case?

Should the commit message describe this ordering dependency and the
effect on ctx->grf?

[Severity: Low]
With the clock attached, regmap-mmio wraps each PHP GRF access in
clk_enable()/clk_disable(). Does this change when pclk_php_root is gated
in hardware?

rockchip_grf_init() runs at postcore_initcall. After the earlier patch
"soc: rockchip: grf: Assign the StreamIDs of the RK3588 PHP SMMU masters",
it writes 12 StreamID registers through this regmap. At that point no PHP
consumer holds pclk_php_root, and the clock is a plain gate with flags 0:

	COMPOSITE_NODIV(PCLK_PHP_ROOT, "pclk_php_root", mux_150m_50m_24m_p, 0,

So each write takes enable_count from 0 to 1 and back to 0:

rockchip_grf_init()
  regmap_write()
    regmap_mmio_write()
      clk_enable()
      ...
      clk_disable()
        clk_core_disable()
          core->ops->disable()
          clk_core_disable(core->parent)

Before this patch, the clock kept its bootloader state until
clk_disable_unused at late_initcall_sync. With clk_ignore_unused it was
never touched. Now it is gated at postcore_initcall, along with any parent
whose count also drops to zero, and this happens even with
clk_ignore_unused.

Could a PHP-domain register access in that window now hang? The same
question applies to an access under clk_ignore_unused that relied on the
bootloader leaving the clock on.

The commit message says the regmap enables the clock. It doesn't mention
that the regmap also gates it this early.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261113-mmu600-php-v1-0-231196049a3b%40gmail.com

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 6/9] soc: rockchip: grf: Restore the RK3588 PHP StreamIDs after system suspend
  2026-11-13 16:38 ` [PATCH 6/9] soc: rockchip: grf: Restore the RK3588 PHP StreamIDs after system suspend Arun Iyengar via B4 Relay
@ 2026-11-17 17:35   ` netdev-bot+sashiko
  0 siblings, 0 replies; 20+ messages in thread
From: netdev-bot+sashiko @ 2026-11-17 17:35 UTC (permalink / raw)
  To: aiyengar1990
  Cc: robh, krzk+dt, conor+dt, heiko, andrew+netdev, davem, edumazet,
	kuba, pabeni, david.wu, dlemoal, cassel, fancer.lancer, netdev,
	devicetree, linux-arm-kernel, linux-rockchip, linux-kernel,
	linux-ide, praan, will, robin.murphy, iommu, shawn.lin,
	sebastian.reichel

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The concern: the commit message says that 'The SMMU aborts a
  master whose StreamID was lost', but at this commit mmu600_php is…

--

soc: rockchip: grf: Restore the RK3588 PHP StreamIDs after system suspend

This commit keeps the RK3588 PHP GRF StreamID table after init. It also
registers a syscore resume op that rewrites any StreamIDs lost when PD_PHP
is powered off during system suspend. The op is only registered when the
GRF node has a clocks property.

> The PHP GRF is in PD_PHP, which firmware may power off in system
> suspend. The SMMU aborts a master whose StreamID was lost.

[Severity: Low]
Is this description accurate for the tree at this commit?

In arch/arm64/boot/dts/rockchip/rk3588-base.dtsi the mmu600_php node is
still disabled at this point:

    mmu600_php: ...
        ...
        status = "disabled";

None of usb3otg2, gmac0/1 or sata0-2 point at it with an iommus property
yet. That means the SMMU abort described above can't happen in-tree with
this patch alone, and rockchip_grf_resume() has no visible effect yet.

Two later patches in the series fix that:

  "arm64: dts: rockchip: Attach the masters of the RK3588 PHP SMMU"
  adds iommus = <&mmu600_php N> to the six masters.

  "arm64: dts: rockchip: Enable the RK3588 PHP SMMU" removes the
  status = "disabled" line.

So by the end of the series the restore does take effect.

Could the commit message say that this patch prepares for those later DTS
changes? Or could the patch be moved after them in the series?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261113-mmu600-php-v1-0-231196049a3b%40gmail.com

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 7/9] arm64: dts: rockchip: Add the clock and reset of the RK3588 PHP SMMU
  2026-11-13 16:38 ` [PATCH 7/9] arm64: dts: rockchip: Add the clock and reset of the RK3588 PHP SMMU Arun Iyengar via B4 Relay
@ 2026-11-17 17:35   ` netdev-bot+sashiko
  0 siblings, 0 replies; 20+ messages in thread
From: netdev-bot+sashiko @ 2026-11-17 17:35 UTC (permalink / raw)
  To: aiyengar1990
  Cc: robh, krzk+dt, conor+dt, heiko, andrew+netdev, davem, edumazet,
	kuba, pabeni, david.wu, dlemoal, cassel, fancer.lancer, netdev,
	devicetree, linux-arm-kernel, linux-rockchip, linux-kernel,
	linux-ide, praan, will, robin.murphy, iommu, shawn.lin,
	sebastian.reichel

Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.

Critical: 0 · High: 1 · Medium: 2 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [High] The patch does not do what its commit message says.
- [Medium] The patch adds `clocks` and `resets` to the mmu600_php node
  (compatible = "arm,smmu-v3"), but…
- [Medium] The commit message says the clock and reset are described "as
  for the PCIe SMMU", but the PCIe SMMU node has neither.

--

arm64: dts: rockchip: Add the clock and reset of the RK3588 PHP SMMU

This commit adds a clocks property (ACLK_MMU_PHP) and a resets property
(SRST_A_MMU_PHP) to the mmu600_php node in rk3588-base.dtsi. The stated
goal is to keep the SMMU clocked while its masters are idle.

> Describe ACLK_MMU_PHP, so the SMMU keeps its clock while its masters
> are idle, and SRST_A_MMU_PHP, as for the PCIe SMMU.

[Severity: Medium]
Is the "as for the PCIe SMMU" reference accurate? The mmu600_pcie node in
rk3588-base.dtsi has no clocks or resets:

	mmu600_pcie: iommu@fc900000 {
		compatible = "arm,smmu-v3";
		reg = <0x0 0xfc900000 0x0 0x200000>;
		interrupts = <GIC_SPI 369 IRQ_TYPE_EDGE_RISING 0>,
		...
		interrupt-names = "eventq", "gerror", "priq", "cmdq-sync";
		#iommu-cells = <1>;
	};

No rockchip DTS uses ACLK_MMU_PCIE or SRST_A_MMU_PCIE. The only MMU_PCIE
or MMU_PHP references are the two lines this patch adds.

mmu600_pcie is enabled by default, and its clock sits in the same place in
clk-rk3588.c. aclk_mmu_pcie is the parent of the aclk_pcie_*_mstr clocks:

	GATE(ACLK_MMU_PCIE, "aclk_mmu_pcie", "aclk_pcie_bridge", 0,
			RK3588_CLKGATE_CON(34), 7, GFLAGS),

Is a matching change for mmu600_pcie missing, or should the commit message
be reworded? If the reasoning is right, why does the PCIe SMMU not need
the same change?

> diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
> index 8807ce6193bfc..3bf8d0e4ff332 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
> +++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
> @@ -570,6 +570,8 @@ mmu600_php: iommu@fcb00000 {
>  			     <GIC_SPI 386 IRQ_TYPE_EDGE_RISING 0>,
>  			     <GIC_SPI 379 IRQ_TYPE_EDGE_RISING 0>;
>  		interrupt-names = "eventq", "gerror", "priq", "cmdq-sync";
> +		clocks = <&cru ACLK_MMU_PHP>;
> +		resets = <&cru SRST_A_MMU_PHP>;

[Severity: High]
Does anything use these properties? mmu600_php binds to the generic
arm-smmu-v3 driver. arm_smmu_device_probe() never gets or enables a clock
and never touches a reset line.

There are no clk, reset_control or pm_runtime calls under
drivers/iommu/arm/arm-smmu-v3/, even at the end of the series. The
platform bus does not enable DT clocks by itself. The node also has no
power-domains that could add a pm_clk.

The gate is registered with flags 0 in clk-rk3588.c:

	GATE(ACLK_MMU_PHP, "aclk_mmu_php", "aclk_php_root", 0,
			RK3588_CLKGATE_CON(34), 8, GFLAGS),

So its enable count still comes only from its children: ACLK_GMAC0/1,
ACLK_SATA0/1/2 and ACLK_USB3OTG2. When the last of those masters disables
its aclk, the gate closes just as it did before this patch. If no master
ever enables it, clk_disable_unused() can close it at late_initcall.
Nothing drives SRST_A_MMU_PHP either.

The later patch "arm64: dts: rockchip: Enable the RK3588 PHP SMMU" removes
status = "disabled". After the series, the SMMU probes on every RK3588
board without the clock hold the commit message describes.

Later SMMU activity can then run with aclk_mmu_php gated, for example
cmdq, CFGI or TLBI commands on attach and detach, or event and gerror
handling. What a gated clock does to the SMMU at that point depends on the
Rockchip clock topology.

Does the SMMU driver need to own the clock and reset instead? That could
be devm_clk_bulk_get_all_enabled() plus reset handling in
arm_smmu_device_probe(), or a Rockchip impl hook behind a SoC-specific
compatible.

[Severity: Medium]
Will these properties pass dtbs_check? The binding
Documentation/devicetree/bindings/iommu/arm,smmu-v3.yaml lists neither
clocks nor resets, and it ends with:

additionalProperties: false

dtbs_check also validates disabled nodes. So every DTB that includes
rk3588-base.dtsi would flag 'clocks' and 'resets' as unexpected. No patch
in the series changes the iommu binding.

Would this need a SoC-specific compatible with conditional clocks and
resets in the binding, like the existing nvidia,tegra264-smmu entry, along
with driver support?

>  		#iommu-cells = <1>;
>  		status = "disabled";
>  	};

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261113-mmu600-php-v1-0-231196049a3b%40gmail.com

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 8/9] arm64: dts: rockchip: Attach the masters of the RK3588 PHP SMMU
  2026-11-13 16:38 ` [PATCH 8/9] arm64: dts: rockchip: Attach the masters " Arun Iyengar via B4 Relay
@ 2026-11-17 17:35   ` netdev-bot+sashiko
  0 siblings, 0 replies; 20+ messages in thread
From: netdev-bot+sashiko @ 2026-11-17 17:35 UTC (permalink / raw)
  To: aiyengar1990
  Cc: robh, krzk+dt, conor+dt, heiko, andrew+netdev, davem, edumazet,
	kuba, pabeni, david.wu, dlemoal, cassel, fancer.lancer, netdev,
	devicetree, linux-arm-kernel, linux-rockchip, linux-kernel,
	linux-ide, praan, will, robin.murphy, iommu, shawn.lin,
	sebastian.reichel

Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.

Critical: 0 · High: 1 · Medium: 1 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [High] Once mmu600_php is enabled, this patch makes all DMA from
  GMAC0/1, SATA0-2 and USB3OTG_2 depend on SMMU state: CR0.SMMUEN, the…
- [Medium] This patch points GMAC0/1, SATA0-2 and USB3OTG_2 at the
  mmu600_php node.
- [Low] The commit message describes StreamIDs 1-6 as a property of the
  hardware: "GMAC0/1, SATA0-2 and USB3OTG_2 are behind MMU600_PHP with…

--

arm64: dts: rockchip: Attach the masters of the RK3588 PHP SMMU

This patch adds iommus properties to GMAC0/1, SATA0-2 and USB3OTG_2 on
RK3588. They point at the PHP SMMU (mmu600_php) with StreamIDs 1 to 6.
The SMMU node is still disabled at this point in the series.

> GMAC0/1, SATA0-2 and USB3OTG_2 are behind MMU600_PHP with StreamIDs
> 1-6. No effect until the SMMU is enabled.

[Severity: Low]

Are StreamIDs 1-6 a property of the hardware? An earlier patch in this
series, "soc: rockchip: grf: Assign the StreamIDs of the RK3588 PHP SMMU
masters", says the PHP GRF StreamID registers "reset to 0 and are never
programmed".

The values only become true because rockchip_grf_init() writes them, and
rockchip_grf_resume() writes them again after suspend:

drivers/soc/rockchip/grf.c:
static const struct rockchip_grf_value rk3588_defaults_php_grf[] = {
	{ "gmac0 write streamid", RK3588_PHP_GRF_GMAC0_SID_AW, 1 },
	...
	{ "usb3otg2 read streamid", RK3588_PHP_GRF_USB3OTG2_SID_AR, 6 },
};

So the iommus specifiers in this patch encode a choice made by a Linux
driver, not fixed hardware.

Some software could use this DT with the SMMU enabled but without that
GRF programming. Examples are a stable backport that takes only the DTS
patches, U-Boot passing this DT through, or another OS. In that case
every master would emit SID 0. By the series' own design SID 0 is
unused, so DMA from all six masters would be aborted.

In-tree Linux sees no runtime effect here. The GRF patch comes earlier
in the series and mmu600_php is still disabled.

Could the commit message say this, and name the GRF patch as a hard
prerequisite?

> diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
> index 3bf8d0e4ff332..cb0a39f637887 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
> +++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
> @@ -534,6 +534,7 @@ usb_host2_xhci: usb@fcd00000 {
>  		compatible = "rockchip,rk3588-dwc3", "snps,dwc3";
>  		reg = <0x0 0xfcd00000 0x0 0x400000>;
>  		interrupts = <GIC_SPI 222 IRQ_TYPE_LEVEL_HIGH 0>;
> +		iommus = <&mmu600_php 6>;

[Severity: Medium]

These iommus entries make the masters depend on mmu600_php, which in
this tree has:

	mmu600_php: iommu@fcb00000 {
		compatible = "arm,smmu-v3";
		...
		clocks = <&cru ACLK_MMU_PHP>;
		resets = <&cru SRST_A_MMU_PHP>;
		#iommu-cells = <1>;
		status = "disabled";
	};

Does anything accept or use these two properties?

Documentation/devicetree/bindings/iommu/arm,smmu-v3.yaml defines no
clocks or resets and ends with additionalProperties: false. The series
does not change that binding. Would dtbs_check then reject mmu600_php on
every RK3588 DTB?

The arm-smmu-v3 driver also has no clk_* or reset_control_* calls
anywhere under drivers/iommu/arm/arm-smmu-v3/. So the SMMU never holds
this clock.

The series says the clock is there "so the SMMU keeps its clock while
its masters are idle". The final commit "arm64: dts: rockchip: Enable
the RK3588 PHP SMMU" relies on "the SMMU has its clock". In
drivers/clk/rockchip/clk-rk3588.c it is a plain gate without
CLK_IS_CRITICAL:

	GATE(ACLK_MMU_PHP, "aclk_mmu_php", "aclk_php_root", 0,
			RK3588_CLKGATE_CON(34), 8, GFLAGS),

Its only enablers are its children: ACLK_GMAC0/1, ACLK_SATA0/1/2 and
ACLK_USB3OTG2.

Can clk_disable_unused, or the masters going idle, gate this clock while
the SMMU is live? Some examples:

  - arm_smmu_attach_dev() runs before a modular master driver enables
    its clocks
  - all masters are runtime suspended
  - a board enables none of these masters

The series implies that ACLK_MMU_PHP clocks the SMMU register interface.
If so, could command queue accesses, CMD_SYNC polling or the IRQ
handlers hang the bus or time out? That would look like the PHP GRF hang
described in "Add the PHP GRF clock on RK3588".

>  		clocks = <&cru REF_CLK_USB3OTG2>, <&cru SUSPEND_CLK_USB3OTG2>,
>  			 <&cru ACLK_USB3OTG2>, <&cru CLK_UTMI_OTG2>,
>  			 <&cru CLK_PIPEPHY2_PIPE_U3_G>;
> @@ -2310,6 +2311,7 @@ gmac1: ethernet@fe1c0000 {
>  		interrupts = <GIC_SPI 234 IRQ_TYPE_LEVEL_HIGH 0>,
>  			     <GIC_SPI 233 IRQ_TYPE_LEVEL_HIGH 0>;
>  		interrupt-names = "macirq", "eth_wake_irq";
> +		iommus = <&mmu600_php 2>;

[Severity: High]

Once mmu600_php is enabled, all DMA from GMAC0/1, SATA0-2 and USB3OTG_2
depends on SMMU state:

  - CR0.SMMUEN
  - the stream table and queue base registers
  - the STEs for SIDs 1-6

What restores that state after deep suspend?

arm_smmu_driver in drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c has no
.pm ops:

	.probe	= arm_smmu_device_probe,
	.remove = arm_smmu_device_remove,
	.shutdown = arm_smmu_device_shutdown,

So arm_smmu_device_reset() only runs at probe.

The final commit of the series, "arm64: dts: rockchip: Enable the RK3588
PHP SMMU", says:

  "PD_PHP is powered off in deep suspend and the SMMU resumes from reset
  in bypass, so this needs arm-smmu-v3 system sleep support [1]"

That support is not in this tree. Even so, that commit removes
status = "disabled" from mmu600_php for every RK3588 board.

Take a board with an active PHP master and run
echo mem > /sys/power/state. After resume, only the PHP GRF StreamIDs
are restored, by rockchip_grf_resume(). The GMAC descriptor rings, AHCI
command lists and xHCI rings still hold IOVAs.

Wouldn't their DMA go out untranslated, with the IOVAs used as physical
addresses?

This patch alone does nothing while the SMMU is disabled. But it creates
the dependency, and the problem is still present at the end of the
series. Should the enable commit wait until arm-smmu-v3 system sleep
support has landed?

>  		clocks = <&cru CLK_GMAC_125M>, <&cru CLK_GMAC_50M>,
>  			 <&cru PCLK_GMAC1>, <&cru ACLK_GMAC1>,
>  			 <&cru CLK_GMAC1_PTP_REF>;

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261113-mmu600-php-v1-0-231196049a3b%40gmail.com

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 9/9] arm64: dts: rockchip: Enable the RK3588 PHP SMMU
  2026-11-13 16:38 ` [PATCH 9/9] arm64: dts: rockchip: Enable " Arun Iyengar via B4 Relay
  2026-11-14 16:39   ` sashiko-bot
@ 2026-11-17 17:35   ` netdev-bot+sashiko
  1 sibling, 0 replies; 20+ messages in thread
From: netdev-bot+sashiko @ 2026-11-17 17:35 UTC (permalink / raw)
  To: aiyengar1990
  Cc: robh, krzk+dt, conor+dt, heiko, andrew+netdev, davem, edumazet,
	kuba, pabeni, david.wu, dlemoal, cassel, fancer.lancer, netdev,
	devicetree, linux-arm-kernel, linux-rockchip, linux-kernel,
	linux-ide, praan, will, robin.murphy, iommu, shawn.lin,
	sebastian.reichel

Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.

Critical: 1 · High: 1 · Medium: 0 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Critical] This patch enables mmu600_php on every RK3588 board, but the
  kernel cannot restore the SMMU after deep suspend.
- [High] This patch's commit message says "the SMMU has its clock", and
  the earlier series commit "arm64: dts: rockchip: Add the clock and…
- [Low] The mmu600_php node that this patch enables has `clocks = <&cru
  ACLK_MMU_PHP>;` and `resets = <&cru SRST_A_MMU_PHP>;`…

--

arm64: dts: rockchip: Enable the RK3588 PHP SMMU

This commit removes status = "disabled" from the mmu600_php node in
rk3588-base.dtsi. That enables the arm-smmu-v3 instance in front of the
PHP masters (GMAC, SATA, USB3 host2) on all RK3588 boards. The commit
message notes that PD_PHP loses power in deep suspend and that arm-smmu-v3
system sleep support is needed.

Link: https://lore.kernel.org/r/20260929034510.2023173-1-praan@google.com

> diff --git a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
> index cb0a39f637887..0c3d59a391826 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
> +++ b/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi
> @@ -574,7 +574,6 @@ mmu600_php: iommu@fcb00000 {
>  		clocks = <&cru ACLK_MMU_PHP>;
>  		resets = <&cru SRST_A_MMU_PHP>;

[Severity: High]

The commit message says "the SMMU has its clock". Does anything actually
enable ACLK_MMU_PHP for the SMMU?

The arm-smmu-v3 driver has no clk_get()/clk_prepare_enable(), reset_control
or pm_runtime handling. The node has no power-domains, so genpd pm_clk
does not apply. The platform core does not enable DT clocks by itself
either.

In drivers/clk/rockchip/clk-rk3588.c the clock is a plain gate with no
flags:

	GATE(ACLK_MMU_PHP, "aclk_mmu_php", "aclk_php_root", 0,
			RK3588_CLKGATE_CON(34), 8, GFLAGS),

Its only enable references come from its children ACLK_GMAC0/1,
ACLK_SATA0/1/2 and ACLK_USB3OTG2. Two things can turn it off:

- clk_disable_unused at late_initcall_sync, when no master is bound
  (modular drivers, or a board that enables only some PHP masters).
- The last master disabling its ACLK on runtime suspend or remove.

The SMMU driver still touches the hardware after that. It issues CMDQ
TLBI/CFGI plus CMD_SYNC on unmap and on flush-queue timeouts, it runs the
eventq/gerror handlers, and at reboot it runs:

arm_smmu_device_shutdown()
    arm_smmu_disable_action()

That usually happens after the consumer masters have already shut down.

Could this cause CMD_SYNC timeouts or a stalled bus access? The "Add the
PHP GRF clock on RK3588" commit in this series describes a similar hang
for pclk_php_root.

The earlier commit "arm64: dts: rockchip: Add the clock and reset of the
RK3588 PHP SMMU" says the clock was added "so the SMMU keeps its clock
while its masters are idle". Does that need clock handling in the driver
(plus a binding update), or the gate marked as critical or
ignore-unused, rather than only the DT property?

[Severity: Low]

Will this node pass dtbs_check now that it is enabled? The binding in
Documentation/devicetree/bindings/iommu/arm,smmu-v3.yaml does not define
clocks, resets or power-domains, and it has:

additionalProperties: false

No patch in the series updates this binding, although the dwmac, ahci and
grf bindings are updated.

Also, the "Add the clock and reset..." commit says the reset is added "as
for the PCIe SMMU". The sibling mmu600_pcie node, which uses the same
compatible, has neither clocks nor resets.

>  		#iommu-cells = <1>;
> -		status = "disabled";

[Severity: Critical]

The commit message says:

  PD_PHP is powered off in deep suspend and the SMMU resumes from reset
  in bypass, so this needs arm-smmu-v3 system sleep support [1].

Is that support in the tree this patch applies to? No earlier patch in
the series seems to add it.

In drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c, arm_smmu_driver has no
.pm:

static struct platform_driver arm_smmu_driver = {
	.driver	= { ... },
	.probe	= arm_smmu_device_probe,
	.remove = arm_smmu_device_remove,
	.shutdown = arm_smmu_device_shutdown,
};

The only code that programs the stream table, the queues and SMMUEN is
arm_smmu_device_reset(), and only arm_smmu_device_probe() calls it. The
syscore op added to drivers/soc/rockchip/grf.c earlier in the series
restores only the PHP GRF StreamID registers.

With this node enabled, the PHP masters get IOMMU DMA domains and their
drivers program IOVAs. Those masters are usb_host2_xhci, gmac1, sata0 and
sata2, plus gmac0 and sata1 from rk3588-extra.dtsi.

After a deep suspend cycle, does the SMMU stay in its reset bypass state
while stmmac, ahci and xhci keep using descriptor rings and buffers at
their old IOVAs?

If so, the IOVAs would be treated as physical addresses. On gmac RX the
frame contents come from the network and would be written to whatever RAM
or MMIO sits at that address. TX and SATA/USB reads could leak arbitrary
memory.

PD_PHP is also defined only in drivers/pmdomain/rockchip/pm-domains.c and
the dt-bindings header. No DTS references it, and mmu600_php has no
power-domains property, so genpd cannot order an SMMU save and restore
either.

Before this patch the node was disabled and these masters used direct
DMA, so suspend did not hit this problem. Should enabling this node wait
until the arm-smmu-v3 sleep support in [1] is merged?

>  	};

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261113-mmu600-php-v1-0-231196049a3b%40gmail.com

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2026-11-17 17:35 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-13 16:38 [PATCH 0/9] RK3588: Enable the PHP SMMU Arun Iyengar via B4 Relay
2026-11-13 16:38 ` [PATCH 1/9] dt-bindings: net: rockchip-dwmac: Allow iommus Arun Iyengar via B4 Relay
2026-11-17 17:35   ` netdev-bot+sashiko
2026-11-13 16:38 ` [PATCH 2/9] dt-bindings: ata: rockchip,dwc-ahci: " Arun Iyengar via B4 Relay
2026-11-17 17:35   ` netdev-bot+sashiko
2026-11-13 16:38 ` [PATCH 3/9] dt-bindings: soc: rockchip: grf: Allow a clock for the RK3588 PHP GRF Arun Iyengar via B4 Relay
2026-11-17 17:35   ` netdev-bot+sashiko
2026-11-13 16:38 ` [PATCH 4/9] soc: rockchip: grf: Assign the StreamIDs of the RK3588 PHP SMMU masters Arun Iyengar via B4 Relay
2026-11-13 16:38 ` [PATCH 5/9] arm64: dts: rockchip: Add the PHP GRF clock on RK3588 Arun Iyengar via B4 Relay
2026-11-17 17:35   ` netdev-bot+sashiko
2026-11-13 16:38 ` [PATCH 6/9] soc: rockchip: grf: Restore the RK3588 PHP StreamIDs after system suspend Arun Iyengar via B4 Relay
2026-11-17 17:35   ` netdev-bot+sashiko
2026-11-13 16:38 ` [PATCH 7/9] arm64: dts: rockchip: Add the clock and reset of the RK3588 PHP SMMU Arun Iyengar via B4 Relay
2026-11-17 17:35   ` netdev-bot+sashiko
2026-11-13 16:38 ` [PATCH 8/9] arm64: dts: rockchip: Attach the masters " Arun Iyengar via B4 Relay
2026-11-17 17:35   ` netdev-bot+sashiko
2026-11-13 16:38 ` [PATCH 9/9] arm64: dts: rockchip: Enable " Arun Iyengar via B4 Relay
2026-11-14 16:39   ` sashiko-bot
2026-11-15  7:59     ` Arun Iyengar
2026-11-17 17:35   ` netdev-bot+sashiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox