Skip to contentSkip to conversation

arm-bsp/trusted-firmware-a: Reserve OP-TEE memory from NWd on N1SDP

PATCH Applied [email protected] 2 participants 4 messages Jul 26, 2023 – Jul 27, 2023

lore
Share & tools
lore
#0 lore raw

cover arm-bsp/trusted-firmware-a: Reserve OP-TEE memory from NWd on N1SDP

From: Adam Johnston <[email protected]>

The physical memory which is used to run OP-TEE on the N1SDP is known to the secure world via TOS_FW_CONFIG, but it may not be known to the normal world.

As a precaution, explicitly reserve this memory via NT_FW_CONFIG to prevent the normal world from using it. This is not required on most platforms as the Trusted OS is run from secure RAM.

Adam Johnston (1):
arm-bsp/trusted-firmware-a: Reserve OP-TEE memory from NWd on N1SDP

 .../0001-Reserve-OP-TEE-memory-from-nwd.patch | 41 +++++++++++++++++++
 .../trusted-firmware-a-n1sdp.inc              |  6 +++
 2 files changed, 47 insertions(+)
 create mode 100644 meta-arm-bsp/recipes-bsp/trusted-firmware-a/files/n1sdp/0001-Reserve-OP-TEE-memory-from-nwd.patch
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/1 arm-bsp/trusted-firmware-a: Reserve OP-TEE memory from NWd on N1SDP

From: Adam Johnston <[email protected]>

The physical memory which is used to run OP-TEE on the N1SDP is known to the secure world via TOS_FW_CONFIG, but it may not be known to the normal world.

As a precaution, explicitly reserve this memory via NT_FW_CONFIG to prevent the normal world from using it. This is not required on most platforms as the Trusted OS is run from secure RAM.

---
 .../0001-Reserve-OP-TEE-memory-from-nwd.patch | 41 +++++++++++++++++++
 .../trusted-firmware-a-n1sdp.inc              |  6 +++
 2 files changed, 47 insertions(+)
 create mode 100644 meta-arm-bsp/recipes-bsp/trusted-firmware-a/files/n1sdp/0001-Reserve-OP-TEE-memory-from-nwd.patch
meta-arm-bsp/recipes-bsp/trusted-firmware-a/files/n1sdp/0001-Reserve-OP-TEE-memory-from-nwd.patch new file +41 -0
new file mode 100644
index 00000000..2c634e35
@@ -0,0 +1,41 @@
+From 2d305094f8f500362079e9e7637d46129bf980e4 Mon Sep 17 00:00:00 2001
+From: Adam Johnston <[email protected]>
+Date: Tue, 25 Jul 2023 16:05:51 +0000
+Subject: [PATCH] n1sdp: Reserve OP-TEE memory from NWd
+
+The physical memory which is used to run OP-TEE on the N1SDP is known
+to the secure world via TOS_FW_CONFIG, but it may not be known to the
+normal world.
+
+As a precaution, explicitly reserve this memory via NT_FW_CONFIG to
+prevent the normal world from using it. This is not required on most
+platforms as the Trusted OS is run from secure RAM.
+
+Upstream-Status: Pending (not yet submited to upstream)
+Signed-off-by: Adam Johnston <[email protected]>
+---
+ plat/arm/board/n1sdp/fdts/n1sdp_nt_fw_config.dts | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+diff --git a/plat/arm/board/n1sdp/fdts/n1sdp_nt_fw_config.dts b/plat/arm/board/n1sdp/fdts/n1sdp_nt_fw_config.dts
+index da5e04ddb6..b7e2d4e86f 100644
+--- a/plat/arm/board/n1sdp/fdts/n1sdp_nt_fw_config.dts
++++ b/plat/arm/board/n1sdp/fdts/n1sdp_nt_fw_config.dts
+@@ -20,4 +20,16 @@
+ 		local-ddr-size = <0x0>;
+ 		remote-ddr-size = <0x0>;
+ 	};
++
++	reserved-memory {
++		#address-cells = <2>;
++		#size-cells = <2>;
++		ranges;
++
++		optee@0x08000000 {
++			compatible = "removed-dma-pool";
++			reg = <0x0 0x08000000 0x0 0x02000000>;
++			no-map;
++		};
++	};
+ };
+\ No newline at end of file
meta-arm-bsp/recipes-bsp/trusted-firmware-a/trusted-firmware-a-n1sdp.inc +6 -0
index f4ebcc1c..654e4327 100644
@@ -9,6 +9,12 @@ TFA_MBEDTLS        = "1"
 TFA_UBOOT          = "0"
 TFA_UEFI           = "1"
 
+FILESEXTRAPATHS:prepend := "${THISDIR}/files/n1sdp:"
+
+SRC_URI:append = " \ 
+    file://0001-Reserve-OP-TEE-memory-from-nwd.patch \
+    "
+
 TFA_ROT_KEY= "plat/arm/board/common/rotpk/arm_rotprivk_rsa.pem"
 
 # Enabling Secure-EL1 Payload Dispatcher (SPD)
Signature · 1 line
2.25.1
Applied
#2 lore raw
In reply to [email protected]
Quoted 11 lines · On Wed, 26 Jul 2023 16:17:24 +0100, [email protected] wrote:

From: Adam Johnston <[email protected]>

The physical memory which is used to run OP-TEE on the N1SDP is known to the secure world via TOS_FW_CONFIG, but it may not be known to the normal world.

As a precaution, explicitly reserve this memory via NT_FW_CONFIG to prevent the normal world from using it. This is not required on most platforms as the Trusted OS is run from secure RAM.

[...]

Applied, thanks!

[1/1] arm-bsp/trusted-firmware-a: Reserve OP-TEE memory from NWd on N1SDP

      commit: 308e5d7145f2a1295283db445970dd181ecd67b3

Best regards,

Signature · 1 line
Jon Mason <[email protected]>
author Applied
#3 lore raw

Can this fix be backported to mickledore please?

Thanks and Regards

Adam

-----Original Message-----
From: Jon Mason <[email protected]>
Sent: Thursday, July 27, 2023 4:29 AM
To: [email protected]; Ross Burton <[email protected]>; Adam Johnston <[email protected]>
Cc: nd <[email protected]>
Subject: Re: [PATCH 0/1] arm-bsp/trusted-firmware-a: Reserve OP-TEE memory from NWd on N1SDP

Quoted 11 lines · On Wed, 26 Jul 2023 16:17:24 +0100, [email protected] wrote:

From: Adam Johnston <[email protected]>

The physical memory which is used to run OP-TEE on the N1SDP is known to the secure world via TOS_FW_CONFIG, but it may not be known to the normal world.

As a precaution, explicitly reserve this memory via NT_FW_CONFIG to prevent the normal world from using it. This is not required on most platforms as the Trusted OS is run from secure RAM.

[...]

Applied, thanks!

[1/1] arm-bsp/trusted-firmware-a: Reserve OP-TEE memory from NWd on N1SDP

      commit: 308e5d7145f2a1295283db445970dd181ecd67b3

Best regards,
--
Jon Mason <[email protected]>