Skip to contentSkip to conversation

arm: dts: imx8m: add OPTEE_LOAD_ADDRESS config and tee.bin

PATCH In review Tim Harvey 3 participants 4 messages Jun 22, 2023 – Jul 12, 2023

Subsystems (4)
lore
Share & tools
lore

Tim Harvey

author
#0 lore raw

PATCH 1/1 arm: dts: imx8m: add OPTEE_LOAD_ADDRESS config and tee.bin

Add a Kconfig for OPTEE_LOAD_ADDRESS which adds tee.bin to the imx8m{m,n,p} FIT image.

Prior to using binman for image creation the presense of tee.bin in the directory would cause mkimage_fit_atf.sh to add the tee.bin node to the FIT image. Once boards moved away from using CONFIG_SPL_FIT_GENERATOR this was lost. This patch restores that functionality. A Kconfig option is added due to binman not being able to utilize env variables.

---
 arch/arm/dts/imx8mm-u-boot.dtsi | 19 +++++++++++++++++++
 arch/arm/dts/imx8mn-u-boot.dtsi | 19 +++++++++++++++++++
 arch/arm/dts/imx8mp-u-boot.dtsi | 19 +++++++++++++++++++
 drivers/tee/optee/Kconfig       |  7 +++++++
 4 files changed, 64 insertions(+)
arch/arm/dts/imx8mm-u-boot.dtsi +19 -0
index a843bb851eaf..61f907a4743b 100644
@@ -124,6 +124,21 @@
 						type = "atf-bl31";
 					};
 				};
+
+#ifdef CONFIG_OPTEE_LOAD_ADDRESS
+				tee {
+					description = "TEE firmware";
+					type = "firmware";
+					arch = "arm64";
+					compression = "none";
+					load = <CONFIG_OPTEE_LOAD_ADDRESS>;
+					entry = <CONFIG_OPTEE_LOAD_ADDRESS>;
+
+					tee_blob: blob-ext {
+						filename = "tee.bin";
+					};
+				};
+#endif
 #endif
 
 				binman_fip: fip {
@@ -154,7 +169,11 @@
 					fdt = "fdt-SEQ";
 					firmware = "uboot";
 #ifndef CONFIG_ARMV8_PSCI
+#ifdef CONFIG_OPTEE_LOAD_ADDRESS
+					loadables = "atf", "tee";
+#else
 					loadables = "atf";
+#endif
 #endif
 				};
 			};
arch/arm/dts/imx8mn-u-boot.dtsi +19 -0
index 86c9a6cd67f0..15cec4ffab44 100644
@@ -181,6 +181,21 @@
 						type = "atf-bl31";
 					};
 				};
+
+#ifdef CONFIG_OPTEE_LOAD_ADDRESS
+				tee {
+					description = "TEE firmware";
+					type = "firmware";
+					arch = "arm64";
+					compression = "none";
+					load = <CONFIG_OPTEE_LOAD_ADDRESS>;
+					entry = <CONFIG_OPTEE_LOAD_ADDRESS>;
+
+					tee_blob: blob-ext {
+						filename = "tee.bin";
+					};
+				};
+#endif
 #endif
 
 				binman_fip: fip {
@@ -211,7 +226,11 @@
 					fdt = "fdt-SEQ";
 					firmware = "uboot";
 #ifndef CONFIG_ARMV8_PSCI
+#ifdef CONFIG_OPTEE_LOAD_ADDRESS
+					loadables = "atf", "tee";
+#else
 					loadables = "atf";
+#endif
 #endif
 				};
 			};
arch/arm/dts/imx8mp-u-boot.dtsi +19 -0
index 8c9d6412ccb5..b46fc7eeed0d 100644
@@ -145,6 +145,21 @@
 						type = "atf-bl31";
 					};
 				};
+
+#ifdef CONFIG_OPTEE_LOAD_ADDRESS
+				tee {
+					description = "TEE firmware";
+					type = "firmware";
+					arch = "arm64";
+					compression = "none";
+					load = <CONFIG_OPTEE_LOAD_ADDRESS>;
+					entry = <CONFIG_OPTEE_LOAD_ADDRESS>;
+
+					tee_blob: blob-ext {
+						filename = "tee.bin";
+					};
+				};
+#endif
 #endif
 
 				@fdt-SEQ {
@@ -166,7 +181,11 @@
 					fdt = "fdt-SEQ";
 					firmware = "uboot";
 #ifndef CONFIG_ARMV8_PSCI
+#ifdef CONFIG_OPTEE_LOAD_ADDRESS
+					loadables = "atf", "tee";
+#else
 					loadables = "atf";
+#endif
 #endif
 				};
 			};
drivers/tee/optee/Kconfig +7 -0
index 9dc65b0501e2..09a8bbd2fafd 100644
@@ -14,6 +14,13 @@ if OPTEE || SANDBOX
 
 menu "OP-TEE options"
 
+config OPTEE_LOAD_ADDRESS
+	hex "Load address of OPTEE"
+	help
+	  Defines the load and entry address used by U-Boot FIT images
+	  for tee.bin. This address must match the link address that
+	  tee.bin was built with.
+
 config OPTEE_TA_AVB
 	bool "Support AVB TA"
 	default y
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Tim Harvey

Add a Kconfig for OPTEE_LOAD_ADDRESS which adds tee.bin to the imx8m{m,n,p} FIT image.

Prior to using binman for image creation the presense of tee.bin in the directory would cause mkimage_fit_atf.sh to add the tee.bin node to the FIT image. Once boards moved away from using CONFIG_SPL_FIT_GENERATOR this was lost. This patch restores that functionality. A Kconfig option is added due to binman not being able to utilize env variables.

#2 lore raw
In reply to Tim Harvey

Hi Tim,

Quoted 10 lines · Tim Harvey

Add a Kconfig for OPTEE_LOAD_ADDRESS which adds tee.bin to the imx8m{m,n,p} FIT image.

Prior to using binman for image creation the presense of tee.bin in the directory would cause mkimage_fit_atf.sh to add the tee.bin node to the FIT image. Once boards moved away from using CONFIG_SPL_FIT_GENERATOR this was lost. This patch restores that functionality. A Kconfig option is added due to binman not being able to utilize env variables.

I tried to apply this, and the other ones

	https://patchwork.ozlabs.org/user/todo/uboot/?series=360558
	https://patchwork.ozlabs.org/user/todo/uboot/?series=360911
	https://patchwork.ozlabs.org/user/todo/uboot/?series=361339

However, with CONFIG_OPTEE_LOAD_ADDRESS CI stucks because it is not configured for the "tools-only" target
make tools-only_config tools-only

Adding a dummy OPTEE_LOAD_ADDRESS to configs/tools-only_defconfig, issue is solved, but I bother why this is needed. Anyway, CI is not successful and build stops nby next check (run binman / pylint).

Could you take a look ?

Best regards,
Stefano

Quoted 140 lines
---
  arch/arm/dts/imx8mm-u-boot.dtsi | 19 +++++++++++++++++++
  arch/arm/dts/imx8mn-u-boot.dtsi | 19 +++++++++++++++++++
  arch/arm/dts/imx8mp-u-boot.dtsi | 19 +++++++++++++++++++
  drivers/tee/optee/Kconfig       |  7 +++++++
  4 files changed, 64 insertions(+)
arch/arm/dts/imx8mm-u-boot.dtsi +19 -0
index a843bb851eaf..61f907a4743b 100644
@@ -124,6 +124,21 @@
  						type = "atf-bl31";
  					};
  				};
+
+#ifdef CONFIG_OPTEE_LOAD_ADDRESS
+				tee {
+					description = "TEE firmware";
+					type = "firmware";
+					arch = "arm64";
+					compression = "none";
+					load = <CONFIG_OPTEE_LOAD_ADDRESS>;
+					entry = <CONFIG_OPTEE_LOAD_ADDRESS>;
+
+					tee_blob: blob-ext {
+						filename = "tee.bin";
+					};
+				};
+#endif
  #endif
 
  				binman_fip: fip {
@@ -154,7 +169,11 @@
  					fdt = "fdt-SEQ";
  					firmware = "uboot";
  #ifndef CONFIG_ARMV8_PSCI
+#ifdef CONFIG_OPTEE_LOAD_ADDRESS
+					loadables = "atf", "tee";
+#else
  					loadables = "atf";
+#endif
  #endif
  				};
  			};
arch/arm/dts/imx8mn-u-boot.dtsi +19 -0
index 86c9a6cd67f0..15cec4ffab44 100644
@@ -181,6 +181,21 @@
  						type = "atf-bl31";
  					};
  				};
+
+#ifdef CONFIG_OPTEE_LOAD_ADDRESS
+				tee {
+					description = "TEE firmware";
+					type = "firmware";
+					arch = "arm64";
+					compression = "none";
+					load = <CONFIG_OPTEE_LOAD_ADDRESS>;
+					entry = <CONFIG_OPTEE_LOAD_ADDRESS>;
+
+					tee_blob: blob-ext {
+						filename = "tee.bin";
+					};
+				};
+#endif
  #endif
 
  				binman_fip: fip {
@@ -211,7 +226,11 @@
  					fdt = "fdt-SEQ";
  					firmware = "uboot";
  #ifndef CONFIG_ARMV8_PSCI
+#ifdef CONFIG_OPTEE_LOAD_ADDRESS
+					loadables = "atf", "tee";
+#else
  					loadables = "atf";
+#endif
  #endif
  				};
  			};
arch/arm/dts/imx8mp-u-boot.dtsi +19 -0
index 8c9d6412ccb5..b46fc7eeed0d 100644
@@ -145,6 +145,21 @@
  						type = "atf-bl31";
  					};
  				};
+
+#ifdef CONFIG_OPTEE_LOAD_ADDRESS
+				tee {
+					description = "TEE firmware";
+					type = "firmware";
+					arch = "arm64";
+					compression = "none";
+					load = <CONFIG_OPTEE_LOAD_ADDRESS>;
+					entry = <CONFIG_OPTEE_LOAD_ADDRESS>;
+
+					tee_blob: blob-ext {
+						filename = "tee.bin";
+					};
+				};
+#endif
  #endif
 
  				@fdt-SEQ {
@@ -166,7 +181,11 @@
  					fdt = "fdt-SEQ";
  					firmware = "uboot";
  #ifndef CONFIG_ARMV8_PSCI
+#ifdef CONFIG_OPTEE_LOAD_ADDRESS
+					loadables = "atf", "tee";
+#else
  					loadables = "atf";
+#endif
  #endif
  				};
  			};
drivers/tee/optee/Kconfig +7 -0
index 9dc65b0501e2..09a8bbd2fafd 100644
@@ -14,6 +14,13 @@ if OPTEE || SANDBOX
 
  menu "OP-TEE options"
 
+config OPTEE_LOAD_ADDRESS
+	hex "Load address of OPTEE"
+	help
+	  Defines the load and entry address used by U-Boot FIT images
+	  for tee.bin. This address must match the link address that
+	  tee.bin was built with.
+
  config OPTEE_TA_AVB
  	bool "Support AVB TA"
  	default y
Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
author
#3 lore raw
Quoted 25 lines · Stefano Babic

Hi Tim,

Quoted 10 lines · Tim Harvey

Add a Kconfig for OPTEE_LOAD_ADDRESS which adds tee.bin to the imx8m{m,n,p} FIT image.

Prior to using binman for image creation the presense of tee.bin in the directory would cause mkimage_fit_atf.sh to add the tee.bin node to the FIT image. Once boards moved away from using CONFIG_SPL_FIT_GENERATOR this was lost. This patch restores that functionality. A Kconfig option is added due to binman not being able to utilize env variables.

I tried to apply this, and the other ones

        https://patchwork.ozlabs.org/user/todo/uboot/?series=360558
        https://patchwork.ozlabs.org/user/todo/uboot/?series=360911
        https://patchwork.ozlabs.org/user/todo/uboot/?series=361339

However, with CONFIG_OPTEE_LOAD_ADDRESS CI stucks because it is not configured for the "tools-only" target
make tools-only_config tools-only

Quoted 6 lines

Adding a dummy OPTEE_LOAD_ADDRESS to configs/tools-only_defconfig, issue is solved, but I bother why this is needed. Anyway, CI is not successful and build stops nby next check (run binman / pylint).

Could you take a look ?

Hi Stefano,

'arm: dts: imx8m: add OPTEE_LOAD_ADDRESS config and tee.bin' should not be required for the other patches to apply cleanly.

I guess config/tools-only_defconfig needs a '# OPTEE_LOAD_ADDRESS is not set' because it enables SANDBOX. I don't know of a way around adding that.

Simon, is there a way to use env in place of what I'm doing with 'arm:
dts: imx8m: add OPTEE_LOAD_ADDRESS config and tee.bin' [1] for binman? I really hate having to add yet another obscure address config.

Best regards,

Tim
[1] https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Quoted 149 lines
Quoted 131 lines
---
  arch/arm/dts/imx8mm-u-boot.dtsi | 19 +++++++++++++++++++
  arch/arm/dts/imx8mn-u-boot.dtsi | 19 +++++++++++++++++++
  arch/arm/dts/imx8mp-u-boot.dtsi | 19 +++++++++++++++++++
  drivers/tee/optee/Kconfig       |  7 +++++++
  4 files changed, 64 insertions(+)
arch/arm/dts/imx8mm-u-boot.dtsi +19 -0
index a843bb851eaf..61f907a4743b 100644
@@ -124,6 +124,21 @@
                                              type = "atf-bl31";
                                      };
                              };
+
+#ifdef CONFIG_OPTEE_LOAD_ADDRESS
+                             tee {
+                                     description = "TEE firmware";
+                                     type = "firmware";
+                                     arch = "arm64";
+                                     compression = "none";
+                                     load = <CONFIG_OPTEE_LOAD_ADDRESS>;
+                                     entry = <CONFIG_OPTEE_LOAD_ADDRESS>;
+
+                                     tee_blob: blob-ext {
+                                             filename = "tee.bin";
+                                     };
+                             };
+#endif
  #endif
 
                              binman_fip: fip {
@@ -154,7 +169,11 @@
                                      fdt = "fdt-SEQ";
                                      firmware = "uboot";
  #ifndef CONFIG_ARMV8_PSCI
+#ifdef CONFIG_OPTEE_LOAD_ADDRESS
+                                     loadables = "atf", "tee";
+#else
                                      loadables = "atf";
+#endif
  #endif
                              };
                      };
arch/arm/dts/imx8mn-u-boot.dtsi +19 -0
index 86c9a6cd67f0..15cec4ffab44 100644
@@ -181,6 +181,21 @@
                                              type = "atf-bl31";
                                      };
                              };
+
+#ifdef CONFIG_OPTEE_LOAD_ADDRESS
+                             tee {
+                                     description = "TEE firmware";
+                                     type = "firmware";
+                                     arch = "arm64";
+                                     compression = "none";
+                                     load = <CONFIG_OPTEE_LOAD_ADDRESS>;
+                                     entry = <CONFIG_OPTEE_LOAD_ADDRESS>;
+
+                                     tee_blob: blob-ext {
+                                             filename = "tee.bin";
+                                     };
+                             };
+#endif
  #endif
 
                              binman_fip: fip {
@@ -211,7 +226,11 @@
                                      fdt = "fdt-SEQ";
                                      firmware = "uboot";
  #ifndef CONFIG_ARMV8_PSCI
+#ifdef CONFIG_OPTEE_LOAD_ADDRESS
+                                     loadables = "atf", "tee";
+#else
                                      loadables = "atf";
+#endif
  #endif
                              };
                      };
arch/arm/dts/imx8mp-u-boot.dtsi +19 -0
index 8c9d6412ccb5..b46fc7eeed0d 100644
@@ -145,6 +145,21 @@
                                              type = "atf-bl31";
                                      };
                              };
+
+#ifdef CONFIG_OPTEE_LOAD_ADDRESS
+                             tee {
+                                     description = "TEE firmware";
+                                     type = "firmware";
+                                     arch = "arm64";
+                                     compression = "none";
+                                     load = <CONFIG_OPTEE_LOAD_ADDRESS>;
+                                     entry = <CONFIG_OPTEE_LOAD_ADDRESS>;
+
+                                     tee_blob: blob-ext {
+                                             filename = "tee.bin";
+                                     };
+                             };
+#endif
  #endif
 
                              @fdt-SEQ {
@@ -166,7 +181,11 @@
                                      fdt = "fdt-SEQ";
                                      firmware = "uboot";
  #ifndef CONFIG_ARMV8_PSCI
+#ifdef CONFIG_OPTEE_LOAD_ADDRESS
+                                     loadables = "atf", "tee";
+#else
                                      loadables = "atf";
+#endif
  #endif
                              };
                      };
drivers/tee/optee/Kconfig +0 -0
index 9dc65b0501e2..09a8bbd2fafd 100644
@@ -14,6 +14,13 @@ if OPTEE || SANDBOX
 
  menu "OP-TEE options"
 

drivers/tee/optee/Kconfig if OPTEE || SANDBOX · line 26

Quoted 10 lines
drivers/tee/optee/Kconfig +7 -0
+config OPTEE_LOAD_ADDRESS
+     hex "Load address of OPTEE"
+     help
+       Defines the load and entry address used by U-Boot FIT images
+       for tee.bin. This address must match the link address that
+       tee.bin was built with.
+
  config OPTEE_TA_AVB
      bool "Support AVB TA"
      default y

--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================