[PATCH] 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.
Signed-off-by: Tim Harvey tharvey@gateworks.com --- 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(+)
diff --git a/arch/arm/dts/imx8mm-u-boot.dtsi b/arch/arm/dts/imx8mm-u-boot.dtsi index a843bb851eaf..61f907a4743b 100644 --- a/arch/arm/dts/imx8mm-u-boot.dtsi +++ b/arch/arm/dts/imx8mm-u-boot.dtsi @@ -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 }; }; diff --git a/arch/arm/dts/imx8mn-u-boot.dtsi b/arch/arm/dts/imx8mn-u-boot.dtsi index 86c9a6cd67f0..15cec4ffab44 100644 --- a/arch/arm/dts/imx8mn-u-boot.dtsi +++ b/arch/arm/dts/imx8mn-u-boot.dtsi @@ -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 }; }; diff --git a/arch/arm/dts/imx8mp-u-boot.dtsi b/arch/arm/dts/imx8mp-u-boot.dtsi index 8c9d6412ccb5..b46fc7eeed0d 100644 --- a/arch/arm/dts/imx8mp-u-boot.dtsi +++ b/arch/arm/dts/imx8mp-u-boot.dtsi @@ -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 }; }; diff --git a/drivers/tee/optee/Kconfig b/drivers/tee/optee/Kconfig index 9dc65b0501e2..09a8bbd2fafd 100644 --- a/drivers/tee/optee/Kconfig +++ b/drivers/tee/optee/Kconfig @@ -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

On 6/23/2023 1:30 AM, Tim Harvey wrote:
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.
Signed-off-by: Tim Harveytharvey@gateworks.com
Reviewed-by: Peng Fan peng.fan@nxp.com

Hi Tim,
On 22.06.23 19:30, Tim Harvey wrote:
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
Signed-off-by: Tim Harvey tharvey@gateworks.com
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(+)
diff --git a/arch/arm/dts/imx8mm-u-boot.dtsi b/arch/arm/dts/imx8mm-u-boot.dtsi index a843bb851eaf..61f907a4743b 100644 --- a/arch/arm/dts/imx8mm-u-boot.dtsi +++ b/arch/arm/dts/imx8mm-u-boot.dtsi @@ -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 }; }; diff --git a/arch/arm/dts/imx8mn-u-boot.dtsi b/arch/arm/dts/imx8mn-u-boot.dtsi index 86c9a6cd67f0..15cec4ffab44 100644 --- a/arch/arm/dts/imx8mn-u-boot.dtsi +++ b/arch/arm/dts/imx8mn-u-boot.dtsi @@ -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 }; }; diff --git a/arch/arm/dts/imx8mp-u-boot.dtsi b/arch/arm/dts/imx8mp-u-boot.dtsi index 8c9d6412ccb5..b46fc7eeed0d 100644 --- a/arch/arm/dts/imx8mp-u-boot.dtsi +++ b/arch/arm/dts/imx8mp-u-boot.dtsi @@ -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 }; }; diff --git a/drivers/tee/optee/Kconfig b/drivers/tee/optee/Kconfig index 9dc65b0501e2..09a8bbd2fafd 100644 --- a/drivers/tee/optee/Kconfig +++ b/drivers/tee/optee/Kconfig @@ -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

On Wed, Jul 12, 2023 at 3:37 AM Stefano Babic sbabic@denx.de wrote:
Hi Tim,
On 22.06.23 19:30, Tim Harvey wrote:
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 ?
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/20230622173006.3921891-1-th...
Signed-off-by: Tim Harvey tharvey@gateworks.com
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(+)
diff --git a/arch/arm/dts/imx8mm-u-boot.dtsi b/arch/arm/dts/imx8mm-u-boot.dtsi index a843bb851eaf..61f907a4743b 100644 --- a/arch/arm/dts/imx8mm-u-boot.dtsi +++ b/arch/arm/dts/imx8mm-u-boot.dtsi @@ -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 }; }; diff --git a/arch/arm/dts/imx8mn-u-boot.dtsi b/arch/arm/dts/imx8mn-u-boot.dtsi index 86c9a6cd67f0..15cec4ffab44 100644 --- a/arch/arm/dts/imx8mn-u-boot.dtsi +++ b/arch/arm/dts/imx8mn-u-boot.dtsi @@ -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 }; }; diff --git a/arch/arm/dts/imx8mp-u-boot.dtsi b/arch/arm/dts/imx8mp-u-boot.dtsi index 8c9d6412ccb5..b46fc7eeed0d 100644 --- a/arch/arm/dts/imx8mp-u-boot.dtsi +++ b/arch/arm/dts/imx8mp-u-boot.dtsi @@ -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 }; }; diff --git a/drivers/tee/optee/Kconfig b/drivers/tee/optee/Kconfig index 9dc65b0501e2..09a8bbd2fafd 100644 --- a/drivers/tee/optee/Kconfig +++ b/drivers/tee/optee/Kconfig @@ -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
--
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: sbabic@denx.de =====================================================================
participants (3)
-
Peng Fan
-
Stefano Babic
-
Tim Harvey