Skip to contentSkip to conversation

arm64: dts: ti: k3-am65-main: Disable RNG node

PATCH Superseded Andrew Davis 3 participants 9 messages Jul 6, 2022 – Jul 8, 2022

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

PATCH v2 1/4 arm64: dts: ti: k3-am65-main: Disable RNG node

The hardware random number generator is used by OP-TEE and is access is denied to other users with SoC level bus firewalls. Any access to this device from Linux will result in firewall errors. Disable this node.

---

Changes from v1:
- Added comment in dtsi file

 arch/arm64/boot/dts/ti/k3-am65-main.dtsi | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/ti/k3-am65-main.dtsi +1 -0
index e749343accedd..9de5a8294acd6 100644
@@ -127,6 +127,7 @@ rng: rng@4e10000 {
 			reg = <0x0 0x4e10000 0x0 0x7d>;
 			interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&k3_clks 136 1>;
+			status = "disabled"; /* Used by OP-TEE */
 		};
 	};
 
Signature · 1 line
2.36.1
#1 lore raw

PATCH v2 2/4 arm64: dts: ti: k3-am65-main: Move SA2UL to unused PSI-L thread ID

The first TX and first two RX PSI-L threads for SA2UL are used by SYSFW on High Security(HS) devices. Use the next available threads to prevent resource allocation conflicts.

---
 arch/arm64/boot/dts/ti/k3-am65-main.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/ti/k3-am65-main.dtsi +2 -2
index 9de5a8294acd6..ff86c0181a68b 100644
@@ -117,8 +117,8 @@ crypto: crypto@4e00000 {
 		#size-cells = <2>;
 		ranges = <0x0 0x04e00000 0x00 0x04e00000 0x0 0x30000>;
 
-		dmas = <&main_udmap 0xc000>, <&main_udmap 0x4000>,
-				<&main_udmap 0x4001>;
+		dmas = <&main_udmap 0xc001>, <&main_udmap 0x4002>,
+				<&main_udmap 0x4003>;
 		dma-names = "tx", "rx1", "rx2";
 		dma-coherent;
 
Signature · 1 line
2.36.1
#2 lore raw

PATCH v2 3/4 arm64: dts: ti: k3-am65-main: Do not exclusively claim SA2UL

In reply to Andrew Davis

The SA2UL hardware is also used by SYSFW and OP-TEE. It should be requested using the shared TI-SCI flags instead of the exclusive flags or the request will fail.

---
 arch/arm64/boot/dts/ti/k3-am65-main.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/ti/k3-am65-main.dtsi +1 -1
index ff86c0181a68b..47970086c1d63 100644
@@ -112,7 +112,7 @@ main_uart2: serial@2820000 {
 	crypto: crypto@4e00000 {
 		compatible = "ti,am654-sa2ul";
 		reg = <0x0 0x4e00000 0x0 0x1200>;
-		power-domains = <&k3_pds 136 TI_SCI_PD_EXCLUSIVE>;
+		power-domains = <&k3_pds 136 TI_SCI_PD_SHARED>;
 		#address-cells = <2>;
 		#size-cells = <2>;
 		ranges = <0x0 0x04e00000 0x00 0x04e00000 0x0 0x30000>;
Signature · 1 line
2.36.1
#3 lore raw

PATCH v2 4/4 arm64: dts: ti: k3-j7200-mcu-wakeup: Add SA2UL node

In reply to Andrew Davis

J7200 has an instance of SA2UL in the MCU domain.
Add DT node for the same.

The device is marked TI_SCI_PD_SHARED as parts of this IP are also shared with the security co-processor and OP-TEE.

The RNG node is added but marked disabled as it is firewalled off for exclusive use by OP-TEE. Any access to this device from Linux will result in firewall errors. We add the node for completeness of the hardware description.

---

Changes from v1:
- Added comment in dtsi file
- Added extra context to commit message

 .../boot/dts/ti/k3-j7200-mcu-wakeup.dtsi      | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)
arch/arm64/boot/dts/ti/k3-j7200-mcu-wakeup.dtsi +20 -0
index 1044ec6c4b0d4..a37280200c401 100644
@@ -375,4 +375,24 @@ mcu_r5fss0_core1: r5f@41400000 {
 			ti,loczrama = <1>;
 		};
 	};
+
+	mcu_crypto: crypto@40900000 {
+		compatible = "ti,j721e-sa2ul";
+		reg = <0x00 0x40900000 0x00 0x1200>;
+		power-domains = <&k3_pds 265 TI_SCI_PD_SHARED>;
+		#address-cells = <2>;
+		#size-cells = <2>;
+		ranges = <0x00 0x40900000 0x00 0x40900000 0x00 0x30000>;
+		dmas = <&mcu_udmap 0xf501>, <&mcu_udmap 0x7502>,
+		       <&mcu_udmap 0x7503>;
+		dma-names = "tx", "rx1", "rx2";
+		dma-coherent;
+
+		rng: rng@40910000 {
+			compatible = "inside-secure,safexcel-eip76";
+			reg = <0x00 0x40910000 0x00 0x7d>;
+			interrupts = <GIC_SPI 945 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled"; /* Used by OP-TEE */
+		};
+	};
 };
Signature · 1 line
2.36.1
#4 lore raw
In reply to Andrew Davis

Hi Andrew

On July 6, 2022 thus sayeth Andrew Davis:

Quoted 18 lines

The hardware random number generator is used by OP-TEE and is access is denied to other users with SoC level bus firewalls. Any access to this device from Linux will result in firewall errors. Disable this node.

---

Changes from v1:
- Added comment in dtsi file

 arch/arm64/boot/dts/ti/k3-am65-main.dtsi | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/ti/k3-am65-main.dtsi +0 -0
index e749343accedd..9de5a8294acd6 100644

arch/arm64/boot/dts/ti/k3-am65-main.dtsi rng: rng@4e10000 { · line 130

Quoted 4 lines
arch/arm64/boot/dts/ti/k3-am65-main.dtsi +1 -0
@@ -127,6 +127,7 @@ rng: rng@4e10000 {
 			reg = <0x0 0x4e10000 0x0 0x7d>;
 			interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&k3_clks 136 1>;
+			status = "disabled"; /* Used by OP-TEE */

Just curious about how we should document disabling nodes. I was assuming the reasoning should be described in the bindings?

I would like to start disabling nodes by default in our dtsi files and enabling them in our top dts file, making it easier for others to use our device tree for a more focused purpose than our dev boards. I just didn't know where I should document why I disabled the nodes :)

~Bryan

#5 lore raw
Quoted 29 lines · Bryan Brattlof

Hi Andrew

On July 6, 2022 thus sayeth Andrew Davis:

Quoted 18 lines

The hardware random number generator is used by OP-TEE and is access is denied to other users with SoC level bus firewalls. Any access to this device from Linux will result in firewall errors. Disable this node.

---

Changes from v1:
- Added comment in dtsi file

  arch/arm64/boot/dts/ti/k3-am65-main.dtsi | 1 +
  1 file changed, 1 insertion(+)
arch/arm64/boot/dts/ti/k3-am65-main.dtsi +0 -0
index e749343accedd..9de5a8294acd6 100644

arch/arm64/boot/dts/ti/k3-am65-main.dtsi rng: rng@4e10000 { · line 130

Quoted 4 lines
arch/arm64/boot/dts/ti/k3-am65-main.dtsi +1 -0
@@ -127,6 +127,7 @@ rng: rng@4e10000 {
  			reg = <0x0 0x4e10000 0x0 0x7d>;
  			interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
  			clocks = <&k3_clks 136 1>;
+			status = "disabled"; /* Used by OP-TEE */

Just curious about how we should document disabling nodes. I was assuming the reasoning should be described in the bindings?

Quoted 5 lines

I would like to start disabling nodes by default in our dtsi files and enabling them in our top dts file, making it easier for others to use our device tree for a more focused purpose than our dev boards. I just didn't know where I should document why I disabled the nodes :)

This got push-back last time this was suggested, I'll have to lookup the history. IIRC we landed on the other way around, all things should be described by default, then the specific board can enable/disable what is not used as needed.

I was worried this topic would come up with this patch series and was almost just going to delete the whole RNG node instead of disabling it to avoid that. My reasoning for disabling here anyway is that this device *cannot* be used by *any* board, it is not just a board level configuration decision like disabling I2C nodes by default or similar that was proposed last time we had the "nodes disabled by default" discussion.

Andrew

Quoted 1 line

~Bryan

maintainer
#6 lore raw
Quoted 36 lines · Andrew Davis
Quoted 29 lines · Bryan Brattlof

Hi Andrew

On July 6, 2022 thus sayeth Andrew Davis:

Quoted 18 lines

The hardware random number generator is used by OP-TEE and is access is denied to other users with SoC level bus firewalls. Any access to this device from Linux will result in firewall errors. Disable this node.

---

Changes from v1:
- Added comment in dtsi file

  arch/arm64/boot/dts/ti/k3-am65-main.dtsi | 1 +
  1 file changed, 1 insertion(+)
arch/arm64/boot/dts/ti/k3-am65-main.dtsi +0 -0
index e749343accedd..9de5a8294acd6 100644

arch/arm64/boot/dts/ti/k3-am65-main.dtsi rng: rng@4e10000 { · line 130

Quoted 4 lines
arch/arm64/boot/dts/ti/k3-am65-main.dtsi +1 -0
@@ -127,6 +127,7 @@ rng: rng@4e10000 {
  			reg = <0x0 0x4e10000 0x0 0x7d>;
  			interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
  			clocks = <&k3_clks 136 1>;
+			status = "disabled"; /* Used by OP-TEE */

Just curious about how we should document disabling nodes. I was assuming the reasoning should be described in the bindings?

Quoted 5 lines

I would like to start disabling nodes by default in our dtsi files and enabling them in our top dts file, making it easier for others to use our device tree for a more focused purpose than our dev boards. I just didn't know where I should document why I disabled the nodes :)

Quoted 4 lines

This got push-back last time this was suggested, I'll have to lookup the history. IIRC we landed on the other way around, all things should be described by default, then the specific board can enable/disable what is not used as needed.

See thread https://lore.kernel.org/linux-arm-kernel/[email protected]/

Quoted 7 lines

I was worried this topic would come up with this patch series and was almost just going to delete the whole RNG node instead of disabling it to avoid that. My reasoning for disabling here anyway is that this device *cannot* be used by *any* board, it is not just a board level configuration decision like disabling I2C nodes by default or similar that was proposed last time we had the "nodes disabled by default" discussion.

Hmm.. If that is the case, then why even have it in dts - is that because of cases where OPTEE is'nt the TEE and users may want to directly use it? OR is it because OPTEE can potentially use device tree itself and discover the rng location from dt?

Signature · 3 lines
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
#7 lore raw
Quoted 52 lines · Nishanth Menon
Quoted 36 lines · Andrew Davis
Quoted 29 lines · Bryan Brattlof

Hi Andrew

On July 6, 2022 thus sayeth Andrew Davis:

Quoted 18 lines

The hardware random number generator is used by OP-TEE and is access is denied to other users with SoC level bus firewalls. Any access to this device from Linux will result in firewall errors. Disable this node.

---

Changes from v1:
- Added comment in dtsi file

   arch/arm64/boot/dts/ti/k3-am65-main.dtsi | 1 +
   1 file changed, 1 insertion(+)
arch/arm64/boot/dts/ti/k3-am65-main.dtsi +0 -0
index e749343accedd..9de5a8294acd6 100644

arch/arm64/boot/dts/ti/k3-am65-main.dtsi rng: rng@4e10000 { · line 130

Quoted 4 lines
arch/arm64/boot/dts/ti/k3-am65-main.dtsi +1 -0
@@ -127,6 +127,7 @@ rng: rng@4e10000 {
   			reg = <0x0 0x4e10000 0x0 0x7d>;
   			interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
   			clocks = <&k3_clks 136 1>;
+			status = "disabled"; /* Used by OP-TEE */

Just curious about how we should document disabling nodes. I was assuming the reasoning should be described in the bindings?

Quoted 5 lines

I would like to start disabling nodes by default in our dtsi files and enabling them in our top dts file, making it easier for others to use our device tree for a more focused purpose than our dev boards. I just didn't know where I should document why I disabled the nodes :)

Quoted 4 lines

This got push-back last time this was suggested, I'll have to lookup the history. IIRC we landed on the other way around, all things should be described by default, then the specific board can enable/disable what is not used as needed.

See thread https://lore.kernel.org/linux-arm-kernel/[email protected]/

Quoted 7 lines

I was worried this topic would come up with this patch series and was almost just going to delete the whole RNG node instead of disabling it to avoid that. My reasoning for disabling here anyway is that this device *cannot* be used by *any* board, it is not just a board level configuration decision like disabling I2C nodes by default or similar that was proposed last time we had the "nodes disabled by default" discussion.

Quoted 5 lines

Hmm.. If that is the case, then why even have it in dts - is that because of cases where OPTEE is'nt the TEE and users may want to directly use it? OR is it because OPTEE can potentially use device tree itself and discover the rng location from dt?

Hadn't thought about the second case, but it could also be valid if we started using DT in our OPTEE. The intention was for the first case, this node has valid hardware description, didn't feel right to delete it due to it being unusable by Linux.

Andrew

maintainer
#8 lore raw
Quoted 59 lines · Andrew Davis
Quoted 52 lines · Nishanth Menon
Quoted 36 lines · Andrew Davis
Quoted 29 lines · Bryan Brattlof

Hi Andrew

On July 6, 2022 thus sayeth Andrew Davis:

Quoted 18 lines

The hardware random number generator is used by OP-TEE and is access is denied to other users with SoC level bus firewalls. Any access to this device from Linux will result in firewall errors. Disable this node.

---

Changes from v1:
- Added comment in dtsi file

   arch/arm64/boot/dts/ti/k3-am65-main.dtsi | 1 +
   1 file changed, 1 insertion(+)
arch/arm64/boot/dts/ti/k3-am65-main.dtsi +0 -0
index e749343accedd..9de5a8294acd6 100644

arch/arm64/boot/dts/ti/k3-am65-main.dtsi rng: rng@4e10000 { · line 130

Quoted 4 lines
arch/arm64/boot/dts/ti/k3-am65-main.dtsi +1 -0
@@ -127,6 +127,7 @@ rng: rng@4e10000 {
   			reg = <0x0 0x4e10000 0x0 0x7d>;
   			interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
   			clocks = <&k3_clks 136 1>;
+			status = "disabled"; /* Used by OP-TEE */

Just curious about how we should document disabling nodes. I was assuming the reasoning should be described in the bindings?

Quoted 5 lines

I would like to start disabling nodes by default in our dtsi files and enabling them in our top dts file, making it easier for others to use our device tree for a more focused purpose than our dev boards. I just didn't know where I should document why I disabled the nodes :)

Quoted 4 lines

This got push-back last time this was suggested, I'll have to lookup the history. IIRC we landed on the other way around, all things should be described by default, then the specific board can enable/disable what is not used as needed.

See thread https://lore.kernel.org/linux-arm-kernel/[email protected]/

Quoted 7 lines

I was worried this topic would come up with this patch series and was almost just going to delete the whole RNG node instead of disabling it to avoid that. My reasoning for disabling here anyway is that this device *cannot* be used by *any* board, it is not just a board level configuration decision like disabling I2C nodes by default or similar that was proposed last time we had the "nodes disabled by default" discussion.

Quoted 5 lines

Hmm.. If that is the case, then why even have it in dts - is that because of cases where OPTEE is'nt the TEE and users may want to directly use it? OR is it because OPTEE can potentially use device tree itself and discover the rng location from dt?

Quoted 4 lines

Hadn't thought about the second case, but it could also be valid if we started using DT in our OPTEE. The intention was for the first case, this node has valid hardware description, didn't feel right to delete it due to it being unusable by Linux.

Fair enough, it is a bit late for me to let this series cook in list and then apply and wait for linux-next stability before I tag for next kernel, I suggest improving the commit message with rationale in the next rev.

Signature · 3 lines
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D