Skip to contentSkip to conversation

Firewall ATF and OP-TEE memory regions in Sitara

PATCH Superseded Suhaas Joshi 2 participants 9 messages Jan 12 – Jan 20 Arm (32-bit)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Firewall ATF and OP-TEE memory regions in Sitara

This series starts by replacing the hard-coded addresses in firewall templates that are defined in k3-binman.dtsi, by Kconfigs. Using Kconfigs would make it easier for someone to move ATF and OP-TEE to another location, since they wouldn't have to fiddle with the firewall configs in the dtsi files.

The rest of the commits in this series add firewall configs to each device's dtsi file.

To test this, I used k3conf read|write <atf and optee address> <val>. These operations were disallowed when the patches of this series were applied, expectedly.

Suhaas Joshi (5):
arm: dts: k3-binman: Use configs for ATF/OPTEE addresses
arm: dts: k3-am625-binman: Configure firewall for ATF/OPTEE
arm: dts: k3-am62p-binman: Configure firewall for ATF/OPTEE
arm: dts: k3-am62a-binman: Configure firewall for ATF/OPTEE
arm: dts: k3-am64x-binman: Configure firewall for ATF/OPTEE

 arch/arm/dts/k3-am625-sk-binman.dtsi | 30 +++++++++++++++++++++++++
 arch/arm/dts/k3-am62a-sk-binman.dtsi | 30 +++++++++++++++++++++++++
 arch/arm/dts/k3-am62p-sk-binman.dtsi | 33 ++++++++++++++++++++++++++++
 arch/arm/dts/k3-am64x-binman.dtsi    | 31 ++++++++++++++++++++++++++
 arch/arm/dts/k3-binman.dtsi          |  8 +++----
 5 files changed, 128 insertions(+), 4 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/5 arm: dts: k3-binman: Use configs for ATF/OPTEE addresses

Instead of hard-coding ATF and OPTEE addresses in firewall configuration templates, use K3_*_LOAD_ADDR. Doing so ensures that if someone moves ATF/OPTEE regions, the change gets picked up by binman without explicitly having to modify dts files.

---
 arch/arm/dts/k3-binman.dtsi | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/dts/k3-binman.dtsi +4 -4
index 761b1730464..0fd93f9536a 100644
@@ -476,8 +476,8 @@
 		permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) |
 						FWPERM_SECURE_PRIV_RWCD |
 						FWPERM_SECURE_USER_RWCD)>;
-		start_address = <0x0 0x70000000>;
-		end_address = <0x0 0x7001ffff>;
+		start_address = <0x0 CONFIG_K3_ATF_LOAD_ADDR>;
+		end_address = <0x0 (CONFIG_K3_ATF_LOAD_ADDR + 0x1ffff)>;
 	};
 	firewall_armv8_optee_fg: template-8 {
 		control = <(FWCTRL_EN | FWCTRL_LOCK |
@@ -485,8 +485,8 @@
 		permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) |
 						FWPERM_SECURE_PRIV_RWCD |
 						FWPERM_SECURE_USER_RWCD)>;
-		start_address = <0x0 0x9e800000>;
-		end_address = <0x0 0x9fffffff>;
+		start_address = <0x0 CONFIG_K3_OPTEE_LOAD_ADDR>;
+		end_address = <0x0 (CONFIG_K3_OPTEE_LOAD_ADDR + 0x17fffff)>;
 	};
 
 	ti_falcon_template: template-9 {
Signature · 1 line
2.34.1
Reviewed-by on v1 1/5
#2 lore raw

Re: [PATCH 1/5] arm: dts: k3-binman: Use configs for ATF/OPTEE addresses

Hi Suhaas

Quoted 26 lines · Suhaas Joshi

Instead of hard-coding ATF and OPTEE addresses in firewall configuration templates, use K3_*_LOAD_ADDR. Doing so ensures that if someone moves ATF/OPTEE regions, the change gets picked up by binman without explicitly having to modify dts files.

---
 arch/arm/dts/k3-binman.dtsi | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/dts/k3-binman.dtsi +2 -2
index 761b1730464..0fd93f9536a 100644
@@ -476,8 +476,8 @@
 		permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) |
 						FWPERM_SECURE_PRIV_RWCD |
 						FWPERM_SECURE_USER_RWCD)>;
-		start_address = <0x0 0x70000000>;
-		end_address = <0x0 0x7001ffff>;
+		start_address = <0x0 CONFIG_K3_ATF_LOAD_ADDR>;
+		end_address = <0x0 (CONFIG_K3_ATF_LOAD_ADDR + 0x1ffff)>;
 	};
 	firewall_armv8_optee_fg: template-8 {
 		control = <(FWCTRL_EN | FWCTRL_LOCK |

arch/arm/dts/k3-binman.dtsi line 492

Quoted 10 lines
arch/arm/dts/k3-binman.dtsi +2 -2
@@ -485,8 +485,8 @@
 		permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) |
 						FWPERM_SECURE_PRIV_RWCD |
 						FWPERM_SECURE_USER_RWCD)>;
-		start_address = <0x0 0x9e800000>;
-		end_address = <0x0 0x9fffffff>;
+		start_address = <0x0 CONFIG_K3_OPTEE_LOAD_ADDR>;
+		end_address = <0x0 (CONFIG_K3_OPTEE_LOAD_ADDR + 0x17fffff)>;
 	};
 
 	ti_falcon_template: template-9 {
Signature · 2 lines
Thanking You
Neha Malcom Francis
#3 lore raw

PATCH 2/5 arm: dts: k3-am625-binman: Configure firewall for ATF/OPTEE

In reply to Suhaas Joshi

Add firewall configurations to protect ATF and OP-TEE memory regions from non-secure reads and writes in AM62x.

---
 arch/arm/dts/k3-am625-sk-binman.dtsi | 30 ++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
arch/arm/dts/k3-am625-sk-binman.dtsi +30 -0
index 42edb35fa7b..a1ac1f52c94 100644
@@ -276,6 +276,36 @@
 		fit {
 			images {
 
+				atf {
+					ti-secure {
+						auth-in-place = <0xa02>;
+
+						firewall-1-0 {
+							insert-template = <&firewall_bg_3>;
+							id = <1>;
+							region = <0>;
+						};
+
+						firewall-1-1 {
+							insert-template = <&firewall_armv8_atf_fg>;
+							id = <1>;
+							region = <1>;
+						};
+					};
+				};
+
+				tee {
+					ti-secure {
+						auth-in-place = <0xa02>;
+
+						firewall-1-2 {
+							insert-template = <&firewall_armv8_optee_fg>;
+							id = <1>;
+							region = <2>;
+						};
+					};
+				};
+
 				tifsstub-hs {
 					description = "TIFSSTUB";
 					type = "firmware";
Signature · 1 line
2.34.1
#4 lore raw

Re: [PATCH 2/5] arm: dts: k3-am625-binman: Configure firewall for ATF/OPTEE

Quoted 13 lines · Suhaas Joshi

Add firewall configurations to protect ATF and OP-TEE memory regions from non-secure reads and writes in AM62x.

---
 arch/arm/dts/k3-am625-sk-binman.dtsi | 30 ++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
arch/arm/dts/k3-am625-sk-binman.dtsi +0 -0
index 42edb35fa7b..a1ac1f52c94 100644

arch/arm/dts/k3-am625-sk-binman.dtsi line 278

Quoted 3 lines
arch/arm/dts/k3-am625-sk-binman.dtsi +0 -0
@@ -276,6 +276,36 @@
 		fit {
 			images {
 

nitpick: no need for empty line here

Quoted 33 lines
arch/arm/dts/k3-am625-sk-binman.dtsi +30 -0
+				atf {
+					ti-secure {
+						auth-in-place = <0xa02>;
+
+						firewall-1-0 {
+							insert-template = <&firewall_bg_3>;
+							id = <1>;
+							region = <0>;
+						};
+
+						firewall-1-1 {
+							insert-template = <&firewall_armv8_atf_fg>;
+							id = <1>;
+							region = <1>;
+						};
+					};
+				};
+
+				tee {
+					ti-secure {
+						auth-in-place = <0xa02>;
+
+						firewall-1-2 {
+							insert-template = <&firewall_armv8_optee_fg>;
+							id = <1>;
+							region = <2>;
+						};
+					};
+				};
+
 				tifsstub-hs {
 					description = "TIFSSTUB";
 					type = "firmware";
Signature · 2 lines
Thanking You
Neha Malcom Francis
#5 lore raw

PATCH 3/5 arm: dts: k3-am62p-binman: Configure firewall for ATF/OPTEE

In reply to Suhaas Joshi

Add firewall configurations to protect ATF and OP-TEE memory regions from non-secure reads and writes in AM62P.

---
 arch/arm/dts/k3-am62p-sk-binman.dtsi | 33 ++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
arch/arm/dts/k3-am62p-sk-binman.dtsi +33 -0
index e1443d6226b..96c06c9ac77 100644
@@ -217,6 +217,39 @@
 
 		fit {
 			images {
+				atf {
+					ti-secure {
+						auth-in-place = <0xa02>;
+
+						firewall-1-0 {
+							insert-template = <&firewall_bg_3>;
+							id = <1>;
+							region = <0>;
+						};
+
+						firewall-1-1 {
+							insert-template = <&firewall_armv8_atf_fg>;
+							id = <1>;
+							region = <1>;
+						};
+
+					};
+				};
+
+				tee {
+					ti-secure {
+						auth-in-place = <0xa02>;
+
+						firewall-1-2 {
+							insert-template = <&firewall_armv8_optee_fg>;
+							id = <1>;
+							region = <2>;
+						};
+
+					};
+				};
+
+
 				tifsstub-hs {
 					description = "TIFSSTUB";
 					type = "firmware";
Signature · 1 line
2.34.1
#6 lore raw

Re: [PATCH 3/5] arm: dts: k3-am62p-binman: Configure firewall for ATF/OPTEE

Quoted 38 lines · Suhaas Joshi

Add firewall configurations to protect ATF and OP-TEE memory regions from non-secure reads and writes in AM62P.

---
 arch/arm/dts/k3-am62p-sk-binman.dtsi | 33 ++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
arch/arm/dts/k3-am62p-sk-binman.dtsi +22 -0
index e1443d6226b..96c06c9ac77 100644
@@ -217,6 +217,39 @@
 
 		fit {
 			images {
+				atf {
+					ti-secure {
+						auth-in-place = <0xa02>;
+
+						firewall-1-0 {
+							insert-template = <&firewall_bg_3>;
+							id = <1>;
+							region = <0>;
+						};
+
+						firewall-1-1 {
+							insert-template = <&firewall_armv8_atf_fg>;
+							id = <1>;
+							region = <1>;
+						};
+
+					};
+				};
+
+				tee {
+					ti-secure {
+						auth-in-place = <0xa02>;

arch/arm/dts/k3-am62p-sk-binman.dtsi line 251

Quoted 10 lines
arch/arm/dts/k3-am62p-sk-binman.dtsi +10 -0
+
+						firewall-1-2 {
+							insert-template = <&firewall_armv8_optee_fg>;
+							id = <1>;
+							region = <2>;
+						};
+
+					};
+				};
+

nitpick again: one extra empty line here

Quoted 4 lines
arch/arm/dts/k3-am62p-sk-binman.dtsi +1 -0
+
 				tifsstub-hs {
 					description = "TIFSSTUB";
 					type = "firmware";
Signature · 2 lines
Thanking You
Neha Malcom Francis
#7 lore raw

PATCH 4/5 arm: dts: k3-am62a-binman: Configure firewall for ATF/OPTEE

In reply to Suhaas Joshi

Add firewall configurations to protect ATF and OP-TEE memory regions from non-secure reads and writes in AM62A.

---
 arch/arm/dts/k3-am62a-sk-binman.dtsi | 30 ++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
arch/arm/dts/k3-am62a-sk-binman.dtsi +30 -0
index cb9a56b8c37..49c90f5855c 100644
@@ -200,6 +200,36 @@
 
 		fit {
 			images {
+				atf {
+					ti-secure {
+						auth-in-place = <0xa02>;
+
+						firewall-1-0 {
+							insert-template = <&firewall_bg_3>;
+							id = <1>;
+							region = <0>;
+						};
+
+						firewall-1-1 {
+							insert-template = <&firewall_armv8_atf_fg>;
+							id = <1>;
+							region = <1>;
+						};
+					};
+				};
+
+				tee {
+					ti-secure {
+						auth-in-place = <0xa02>;
+
+						firewall-1-2 {
+							insert-template = <&firewall_armv8_optee_fg>;
+							id = <1>;
+							region = <2>;
+						};
+					};
+				};
+
 				tifsstub-hs {
 					description = "TIFSSTUB";
 					type = "firmware";
Signature · 1 line
2.34.1
#8 lore raw

PATCH 5/5 arm: dts: k3-am64x-binman: Configure firewall for ATF/OPTEE

In reply to Suhaas Joshi

Add firewall configurations to protect ATF and OP-TEE memory regions from non-secure reads and writes in AM64x.

---
 arch/arm/dts/k3-am64x-binman.dtsi | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
arch/arm/dts/k3-am64x-binman.dtsi +31 -0
index 32e47a3f688..f3c7f2c939d 100644
@@ -139,6 +139,37 @@
 			#address-cells = <1>;
 
 			images {
+				atf {
+					ti-secure {
+						auth-in-place = <0xa02>;
+
+						firewall-24-5 {
+							insert-template = <&firewall_armv8_atf_fg>;
+							id = <24>;
+							region = <5>;
+						};
+					};
+				};
+
+				tee {
+					ti-secure {
+						auth-in-place = <0xa02>;
+
+						firewall-1-0 {
+							insert-template = <&firewall_bg_3>;
+							id = <1>;
+							region = <0>;
+						};
+
+
+						firewall-1-1 {
+							insert-template = <&firewall_armv8_optee_fg>;
+							id = <1>;
+							region = <1>;
+						};
+					};
+				};
+
 				dm {
 					blob-ext {
 						filename = "/dev/null";
Signature · 1 line
2.34.1