Skip to contentSkip to conversation

arm64: dts: imx8m: Reinstate TEE ifdeffery

PATCH In review Marek Vasut 3 participants 11 messages Jun 30 – Jul 27 1 message not in the archive

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

PATCH 1/1 arm64: dts: imx8m: Reinstate TEE ifdeffery

Since b57ed147939c ("dts: imx8m{m,n,p,q}: Make optee packaging optional") the TEE node is always present in U-Boot proper fitImage, even if the CONFIG_OPTEE is disabled because the u-boot.itb should not contain any tee.bin. This is wasteful, and produces the following warning which is also confusing to users:

"
Image 'image' is missing optional external blobs but is still functional: tee-os

/binman/section/fit/images/tee/tee-os (tee.bin):
See the documentation for your board. You may need to build Open Portable Trusted Execution Environment (OP-TEE) and build with TEE=/path/to/tee.bin
"

Reinstate the CONFIG_OPTEE ifdeffery to mitigate the problem, but retain the binman "optional" keyword at tee.bin .

Before:
"

$ mkimage -l u-boot.itb
FIT description: Configuration to load ATF before U-Boot
Created:         Tue Jun 30 17:23:54 2026
 Image 0 (uboot)
...
 Image 2 (tee) <------------------------------ bogus empty image entry
  Description:  OP-TEE                                 |
  Created:      Tue Jun 30 17:23:54 2026               |
  Type:         Trusted Execution Environment Image    |
  Compression:  uncompressed                           |
  Data Size:    0 Bytes = 0.00 KiB = 0.00 MiB <--------'
 Image 3 (fdt-1)
...
"

After:
"

$ mkimage -l u-boot.itb
FIT description: Configuration to load ATF before U-Boot
Created:         Tue Jun 30 17:58:15 2026
 Image 0 (uboot)
...
 Image 1 (atf)
...
 Image 2 (fdt-1)
...
"
Fixes b57ed147939c ("dts: imx8m{m,n,p,q}: Make optee packaging optional")

---
Cc: "NXP i.MX U-Boot Team" <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Yannic Moog <[email protected]>
Cc: Ye Li <[email protected]>
Cc: [email protected]

---
 arch/arm/dts/imx8mm-u-boot.dtsi | 6 ++++++
 arch/arm/dts/imx8mn-u-boot.dtsi | 6 ++++++
 arch/arm/dts/imx8mp-u-boot.dtsi | 6 ++++++
 arch/arm/dts/imx8mq-u-boot.dtsi | 6 ++++++
 4 files changed, 24 insertions(+)
arch/arm/dts/imx8mm-u-boot.dtsi +6 -0
index ab135fc8a47..56ab70e54ea 100644
@@ -165,6 +165,7 @@
 					};
 #endif
 
+#ifdef CONFIG_OPTEE
 					tee: tee {
 						description = "OP-TEE";
 						type = "tee";
@@ -179,6 +180,7 @@
 							optional;
 						};
 					};
+#endif
 
 					binman_fip: fip {
 						arch = "arm64";
@@ -208,7 +210,11 @@
 						fdt = "fdt-SEQ";
 						firmware = "uboot";
 #ifndef CONFIG_ARMV8_PSCI
+#ifdef CONFIG_OPTEE
 						loadables = "atf", "tee";
+#else
+						loadables = "atf";
+#endif
 #endif
 					};
 				};
arch/arm/dts/imx8mn-u-boot.dtsi +6 -0
index 8993605af3c..e4918bf5975 100644
@@ -241,6 +241,7 @@
 					};
 #endif
 
+#ifdef CONFIG_OPTEE
 					tee: tee {
 						description = "OP-TEE";
 						type = "tee";
@@ -255,6 +256,7 @@
 							optional;
 						};
 					};
+#endif
 
 					binman_fip: fip {
 						arch = "arm64";
@@ -284,7 +286,11 @@
 						fdt = "fdt-SEQ";
 						firmware = "uboot";
 #ifndef CONFIG_ARMV8_PSCI
+#ifdef CONFIG_OPTEE
 						loadables = "atf", "tee";
+#else
+						loadables = "atf";
+#endif
 #endif
 					};
 				};
arch/arm/dts/imx8mp-u-boot.dtsi +6 -0
index d9d220c70db..58b6863f003 100644
@@ -189,6 +189,7 @@
 					};
 #endif
 
+#ifdef CONFIG_OPTEE
 					tee: tee {
 						description = "OP-TEE";
 						type = "tee";
@@ -203,6 +204,7 @@
 							optional;
 						};
 					};
+#endif
 
 					@fdt-SEQ {
 						description = "NAME";
@@ -223,7 +225,11 @@
 						fdt = "fdt-SEQ";
 						firmware = "uboot";
 #ifndef CONFIG_ARMV8_PSCI
+#ifdef CONFIG_OPTEE
 						loadables = "atf", "tee";
+#else
+						loadables = "atf";
+#endif
 #endif
 					};
 				};
arch/arm/dts/imx8mq-u-boot.dtsi +6 -0
index ed2c704f2e5..2f9b4a504c3 100644
@@ -173,6 +173,7 @@
 				};
 #endif
 
+#ifdef CONFIG_OPTEE
 				tee: tee {
 					description = "OP-TEE";
 					type = "tee";
@@ -187,6 +188,7 @@
 						optional;
 					};
 				};
+#endif
 
 				fdt {
 					compression = "none";
@@ -208,7 +210,11 @@
 					fdt = "fdt";
 					firmware = "uboot";
 #ifndef CONFIG_ARMV8_PSCI
+#ifdef CONFIG_OPTEE
 					loadables = "atf", "tee";
+#else
+					loadables = "atf";
+#endif
 #endif
 				};
 			};
Signature · 1 line
2.53.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 47 lines · Marek Vasut

Since b57ed147939c ("dts: imx8m{m,n,p,q}: Make optee packaging optional") the TEE node is always present in U-Boot proper fitImage, even if the CONFIG_OPTEE is disabled because the u-boot.itb should not contain any tee.bin. This is wasteful, and produces the following warning which is also confusing to users:

"
Image 'image' is missing optional external blobs but is still functional: tee-os

/binman/section/fit/images/tee/tee-os (tee.bin):
See the documentation for your board. You may need to build Open Portable Trusted Execution Environment (OP-TEE) and build with TEE=/path/to/tee.bin
"

Reinstate the CONFIG_OPTEE ifdeffery to mitigate the problem, but retain the binman "optional" keyword at tee.bin .

Before:
"

$ mkimage -l u-boot.itb
FIT description: Configuration to load ATF before U-Boot
Created:         Tue Jun 30 17:23:54 2026
Image 0 (uboot)
...
Image 2 (tee) <------------------------------ bogus empty image entry
 Description:  OP-TEE                                 |
 Created:      Tue Jun 30 17:23:54 2026               |
 Type:         Trusted Execution Environment Image    |
 Compression:  uncompressed                           |
 Data Size:    0 Bytes = 0.00 KiB = 0.00 MiB <--------'
Image 3 (fdt-1)
...
"

After:
"

$ mkimage -l u-boot.itb
FIT description: Configuration to load ATF before U-Boot
Created:         Tue Jun 30 17:58:15 2026
Image 0 (uboot)
...
Image 1 (atf)
...
Image 2 (fdt-1)
...
"
Quoted 2 lines
Fixes b57ed147939c ("dts: imx8m{m,n,p,q}: Make optee packaging optional")
#2 lore raw
In reply to Marek Vasut

Hi Marek,

Quoted 9 lines · Marek Vasut

Since b57ed147939c ("dts: imx8m{m,n,p,q}: Make optee packaging optional") the TEE node is always present in U-Boot proper fitImage, even if the CONFIG_OPTEE is disabled because the u-boot.itb should not contain any tee.bin. This is wasteful, and produces the following warning which is also confusing to users:

"
Image 'image' is missing optional external blobs but is still functional: tee-os

Quoted 7 lines

/binman/section/fit/images/tee/tee-os (tee.bin):
   See the documentation for your board. You may need to build Open Portable Trusted Execution Environment (OP-TEE) and build with TEE=/path/to/tee.bin "

Reinstate the CONFIG_OPTEE ifdeffery to mitigate the problem, but retain the binman "optional" keyword at tee.bin .

I disagree. You are removing a feature and cause further problems with this commit.

Your initial assumption

Quoted 3 lines

even if the
CONFIG_OPTEE is disabled because the u-boot.itb should not contain any tee.bin

is not accurate. You were able to package OP-TEE without needing to enable support in U-Boot. And afaik this is a perfectly valid use-case.
With this change you can no longer do that, so this change is a regression.

About the warning message. I understand that you find it confusing; binman is designed so that it emits a warning when an optional blob is not found.

I prefer that approach to no message at all. You may want to package OP-TEE (e.g. you have an tf-a blob which jumps to OP-TEE addr) and being alerted to a possible mistake is important; Let's say tee path was incorrect during build.

Also, keeping optional when using if defs is not a good idea. Binman will still build you an image when no OP-TEE blob is present, but should not since you enabled OPTEE configs. If you enable OPTEE, you should have an OP-TEE blob packaged.
We could add ifndef OPTEE around the optional property.

Yannic

Quoted 178 lines

Before:
"

$ mkimage -l u-boot.itb
FIT description: Configuration to load ATF before U-Boot
Created:         Tue Jun 30 17:23:54 2026
 Image 0 (uboot)
...
 Image 2 (tee) <------------------------------ bogus empty image entry
  Description:  OP-TEE                                 |
  Created:      Tue Jun 30 17:23:54 2026               |
  Type:         Trusted Execution Environment Image    |
  Compression:  uncompressed                           |
  Data Size:    0 Bytes = 0.00 KiB = 0.00 MiB <--------'
 Image 3 (fdt-1)
...
"

After:
"

$ mkimage -l u-boot.itb
FIT description: Configuration to load ATF before U-Boot
Created:         Tue Jun 30 17:58:15 2026
 Image 0 (uboot)
...
 Image 1 (atf)
...
 Image 2 (fdt-1)
...
"
Fixes b57ed147939c ("dts: imx8m{m,n,p,q}: Make optee packaging optional")

---
Cc: "NXP i.MX U-Boot Team" <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Stefano Babic <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Yannic Moog <[email protected]>
Cc: Ye Li <[email protected]>
Cc: [email protected]
---

 arch/arm/dts/imx8mm-u-boot.dtsi | 6 ++++++
 arch/arm/dts/imx8mn-u-boot.dtsi | 6 ++++++
 arch/arm/dts/imx8mp-u-boot.dtsi | 6 ++++++
 arch/arm/dts/imx8mq-u-boot.dtsi | 6 ++++++
 4 files changed, 24 insertions(+)
arch/arm/dts/imx8mm-u-boot.dtsi +0 -0
index ab135fc8a47..56ab70e54ea 100644
@@ -165,6 +165,7 @@
  					};
  #endif


+#ifdef CONFIG_OPTEE
  tee: tee { description = "OP-TEE"; type = "tee";

arch/arm/dts/imx8mm-u-boot.dtsi +1 -0
@@ -179,6 +180,7 @@
  							optional;
  						};
  					};
+#endif


  binman_fip: fip { arch = "arm64";

arch/arm/dts/imx8mm-u-boot.dtsi +4 -0
@@ -208,7 +210,11 @@
  						fdt = "fdt-SEQ";
  						firmware = "uboot";
  #ifndef CONFIG_ARMV8_PSCI
+#ifdef CONFIG_OPTEE
  						loadables = "atf", "tee";
+#else
+						loadables = "atf";
+#endif
  #endif
  					};
  				};
arch/arm/dts/imx8mn-u-boot.dtsi +0 -0
index 8993605af3c..e4918bf5975 100644
@@ -241,6 +241,7 @@
  					};
  #endif


+#ifdef CONFIG_OPTEE
  tee: tee { description = "OP-TEE"; type = "tee";

arch/arm/dts/imx8mn-u-boot.dtsi +1 -0
@@ -255,6 +256,7 @@
  							optional;
  						};
  					};
+#endif


  binman_fip: fip { arch = "arm64";

arch/arm/dts/imx8mn-u-boot.dtsi +4 -0
@@ -284,7 +286,11 @@
  						fdt = "fdt-SEQ";
  						firmware = "uboot";
  #ifndef CONFIG_ARMV8_PSCI
+#ifdef CONFIG_OPTEE
  						loadables = "atf", "tee";
+#else
+						loadables = "atf";
+#endif
  #endif
  					};
  				};
arch/arm/dts/imx8mp-u-boot.dtsi +0 -0
index d9d220c70db..58b6863f003 100644
@@ -189,6 +189,7 @@
  					};
  #endif


+#ifdef CONFIG_OPTEE
  tee: tee { description = "OP-TEE"; type = "tee";

arch/arm/dts/imx8mp-u-boot.dtsi +1 -0
@@ -203,6 +204,7 @@
  							optional;
  						};
  					};
+#endif


  @fdt-SEQ { description = "NAME";

arch/arm/dts/imx8mp-u-boot.dtsi +4 -0
@@ -223,7 +225,11 @@
  						fdt = "fdt-SEQ";
  						firmware = "uboot";
  #ifndef CONFIG_ARMV8_PSCI
+#ifdef CONFIG_OPTEE
  						loadables = "atf", "tee";
+#else
+						loadables = "atf";
+#endif
  #endif
  					};
  				};
arch/arm/dts/imx8mq-u-boot.dtsi +0 -0
index ed2c704f2e5..2f9b4a504c3 100644
@@ -173,6 +173,7 @@
  				};
  #endif


+#ifdef CONFIG_OPTEE
  tee: tee { description = "OP-TEE"; type = "tee";

arch/arm/dts/imx8mq-u-boot.dtsi +1 -0
@@ -187,6 +188,7 @@
  						optional;
  					};
  				};
+#endif


  fdt {
  compression = "none";

arch/arm/dts/imx8mq-u-boot.dtsi +4 -0
@@ -208,7 +210,11 @@
  					fdt = "fdt";
  					firmware = "uboot";
  #ifndef CONFIG_ARMV8_PSCI
+#ifdef CONFIG_OPTEE
  					loadables = "atf", "tee";
+#else
+					loadables = "atf";
+#endif
  #endif
  				};
  			};
#3 lore raw

On 7/2/26 9:04 AM, Yannic Moog wrote:

Hello Yannic,

Quoted 15 lines · Marek Vasut
Quoted 14 lines

Since b57ed147939c ("dts: imx8m{m,n,p,q}: Make optee packaging optional") the TEE node is always present in U-Boot proper fitImage, even if the CONFIG_OPTEE is disabled because the u-boot.itb should not contain any tee.bin. This is wasteful, and produces the following warning which is also confusing to users:

"
Image 'image' is missing optional external blobs but is still functional: tee-os

/binman/section/fit/images/tee/tee-os (tee.bin):
   See the documentation for your board. You may need to build Open Portable Trusted Execution Environment (OP-TEE) and build with TEE=/path/to/tee.bin
"

Quoted 4 lines
Quoted 2 lines

Reinstate the CONFIG_OPTEE ifdeffery to mitigate the problem, but retain the binman "optional" keyword at tee.bin .

I disagree. You are removing a feature and cause further problems with this commit.

I tried to avoid outright reverting the offending commit b57ed147939c ("dts: imx8m{m,n,p,q}: Make optee packaging optional") which introduced the problem I described above.

Quoted 8 lines

Your initial assumption

Quoted 3 lines

even if the
CONFIG_OPTEE is disabled because the u-boot.itb should not contain any tee.bin

is not accurate. You were able to package OP-TEE without needing to enable support in U-Boot. And afaik this is a perfectly valid use-case.

When you include optee-os in the U-Boot fitImage, what do you do with that optee-os which U-Boot does not support ? Details please ?

Quoted 4 lines

With this change you can no longer do that, so this change is a regression.

About the warning message. I understand that you find it confusing; binman is designed so that it emits a warning when an optional blob is not found.

Please see above.

Quoted 3 lines

I prefer that approach to no message at all. You may want to package OP-TEE (e.g. you have an tf-a blob which jumps to OP-TEE addr) and being alerted to a possible mistake is important; Let's say tee path was incorrect during build.

Is this some sort of a board-specific configuration ?

Why does U-Boot not enable OPTEE-OS support in this case ?

Quoted 4 lines

Also, keeping optional when using if defs is not a good idea. Binman will still build you an image when no OP-TEE blob is present, but should not since you enabled OPTEE configs. If you enable OPTEE, you should have an OP-TEE blob packaged.
We could add ifndef OPTEE around the optional property.

The optional keyword is actually kept in this case, it is not a full revert.

You did however miss one vital point -- the tee node is part of the U-boot fitImage, even if the tee.bin binary is not present and OPTEE support in U-Boot is disabled. Binman prints a confusing message, and generates a bogus empty tee {} node in the fitImage. That is incorrect.

#4 lore raw
Quoted 34 lines · Marek Vasut

On 7/2/26 9:04 AM, Yannic Moog wrote:

Hello Yannic,

Quoted 15 lines · Marek Vasut
Quoted 14 lines

Since b57ed147939c ("dts: imx8m{m,n,p,q}: Make optee packaging optional") the TEE node is always present in U-Boot proper fitImage, even if the CONFIG_OPTEE is disabled because the u-boot.itb should not contain any tee.bin. This is wasteful, and produces the following warning which is also confusing to users:

"
Image 'image' is missing optional external blobs but is still functional: tee-os

/binman/section/fit/images/tee/tee-os (tee.bin):
    See the documentation for your board. You may need to build Open Portable Trusted Execution Environment (OP-TEE) and build with TEE=/path/to/tee.bin "

Quoted 4 lines
Quoted 2 lines

Reinstate the CONFIG_OPTEE ifdeffery to mitigate the problem, but retain the binman "optional" keyword at tee.bin .

I disagree. You are removing a feature and cause further problems with this commit.

I tried to avoid outright reverting the offending commit b57ed147939c ("dts: imx8m{m,n,p,q}: Make optee packaging optional") which introduced the problem I described above.

Quoted 6 lines

Your initial assumption

Quoted 3 lines

even if the
CONFIG_OPTEE is disabled because the u-boot.itb should not contain any tee.bin

Quoted 6 lines
Quoted 3 lines

is not accurate. You were able to package OP-TEE without needing to enable support in U-Boot. And
afaik this is a perfectly valid use-case.

When you include optee-os in the U-Boot fitImage, what do you do with that optee-os which U-Boot does not support ? Details please ?

Sure, sorry. OS can/will use it. There is no requirement, that I know, of any bootloader interfacing with OP-TEE for proper functionality and its purpose is to work with Linux kernel. I guess the only job bootloader needs to do is load it into memory. I don't know details about specific uses within the security context and if there are any that require bootloader support.

Quoted 9 lines
Quoted 6 lines

With this change you can no longer do that, so this change is a regression.

About the warning message. I understand that you find it confusing; binman is designed so that it
emits a warning when an optional blob is not found.

Please see above.

Quoted 7 lines
Quoted 5 lines

I prefer that approach to no message at all. You may want to package OP-TEE (e.g. you have an tf-a
blob which jumps to OP-TEE addr) and being alerted to a possible mistake is important; Let's say
tee path was incorrect during build.

Is this some sort of a board-specific configuration ?

kind of. We have tee path set in <soc>-u-boot.dtsi: filename = "tee.bin";

Could happen that TEE=teee.bin is set or file is named tee-raw.bin and then it helps to get a warning that binman was not able to package the blob.

Quoted 2 lines

Why does U-Boot not enable OPTEE-OS support in this case ?

No need to. Maybe to conserve space, or by principle only enable the configs that are actually needed? I believe PHYTEC boards used to do that before KASLR support.

Quoted 7 lines
Quoted 6 lines

Also, keeping optional when using if defs is not a good idea. Binman will still build you an image
when no OP-TEE blob is present, but should not since you enabled OPTEE configs. If you enable OPTEE, you should have an OP-TEE blob packaged.
We could add ifndef OPTEE around the optional property.

Quoted 6 lines

The optional keyword is actually kept in this case, it is not a full revert.

You did however miss one vital point -- the tee node is part of the U-boot fitImage, even if the tee.bin binary is not present and OPTEE support in U-Boot is disabled. Binman prints a confusing message, and generates a bogus empty tee {} node in the fitImage. That is incorrect.

Yes, forgot to address that. I don't think it is confusing, at least content wise. Visually, I can see how that is confusing. I want to neither agree nor disagree on the correctness part because I don't really know the fitImage spec. Having the tee node be part of the fitImage is a design choice, all optional blobs behave that way from my understanding.
I guess it means that there is a bug in binman if you say having empty tee node is incorrect. And so it should be fixed in binman itself imo, not here for imx8.

Yannic

#5 lore raw

On 7/3/26 8:16 AM, Yannic Moog wrote:

Hello Yannic,

[...]

Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

is not accurate. You were able to package OP-TEE without needing to enable support in U-Boot. And
afaik this is a perfectly valid use-case.

When you include optee-os in the U-Boot fitImage, what do you do with that optee-os which U-Boot does not support ? Details please ?

Sure, sorry. OS can/will use it. There is no requirement, that I know, of any bootloader interfacing with OP-TEE for proper functionality and its purpose is to work with Linux kernel.

At minimum, if CONFIG_OPTEE is not enabled, U-Boot won't execute optee_copy_fdt_nodes() and won't transfer any optee-os firmware and reserved-memory DT nodes to the Linux DT when starting the kernel, so Linux DT will be buggy and Linux may possibly misbehave.

Quoted 2 lines

I guess the only job bootloader needs to do is load it into memory. I don't know details about specific uses within the security context and if there are any that require bootloader support.

If in your use case, U-Boot is supposed to only load optee-os into memory , why not load it from U-Boot command line or as part of fitImage when booting Linux kernel ?

It seems in your use case, optee-os does not have to be part of the bootloader image at all ?

Quoted 18 lines
Quoted 8 lines
Quoted 5 lines

With this change you can no longer do that, so this change is a regression.

About the warning message. I understand that you find it confusing; binman is designed so that it
emits a warning when an optional blob is not found.

Please see above.

Quoted 7 lines
Quoted 5 lines

I prefer that approach to no message at all. You may want to package OP-TEE (e.g. you have an tf-a
blob which jumps to OP-TEE addr) and being alerted to a possible mistake is important; Let's say
tee path was incorrect during build.

Is this some sort of a board-specific configuration ?

kind of. We have tee path set in <soc>-u-boot.dtsi: filename = "tee.bin";

Quoted 8 lines

Could happen that TEE=teee.bin is set or file is named tee-raw.bin and then it helps to get a warning that binman was not able to package the blob.

Quoted 2 lines

Why does U-Boot not enable OPTEE-OS support in this case ?

No need to. Maybe to conserve space, or by principle only enable the configs that are actually needed? I believe PHYTEC boards used to do that before KASLR support.

This does not seem correct, please see above.

At this point, I would suggest that if you want to retain this kind of configuration for your hardware, it should be moved into board specific DT, it should not be part of the common DTs.

Quoted 13 lines
Quoted 6 lines
Quoted 5 lines

Also, keeping optional when using if defs is not a good idea. Binman will still build you an image
when no OP-TEE blob is present, but should not since you enabled OPTEE configs. If you enable OPTEE, you should have an OP-TEE blob packaged.
We could add ifndef OPTEE around the optional property.

Quoted 6 lines

The optional keyword is actually kept in this case, it is not a full revert.

You did however miss one vital point -- the tee node is part of the U-boot fitImage, even if the tee.bin binary is not present and OPTEE support in U-Boot is disabled. Binman prints a confusing message, and generates a bogus empty tee {} node in the fitImage. That is incorrect.

Quoted 4 lines

Yes, forgot to address that. I don't think it is confusing, at least content wise. Visually, I can see how that is confusing. I want to neither agree nor disagree on the correctness part because I don't really know the fitImage spec. Having the tee node be part of the fitImage is a design choice, all optional blobs behave that way from my understanding.

It is a broken node introduced by commit b57ed147939c ("dts: imx8m{m,n,p,q}: Make optee packaging optional") , it is not supposed to be part of the fitImage unless optee-os is bundled into the fitImage.

Quoted 2 lines

I guess it means that there is a bug in binman if you say having empty tee node is incorrect. And so it should be fixed in binman itself imo, not here for imx8.

No, this is not a bug in binman, please see above.

#6 lore raw

Hey Marek,

Quoted 14 lines · Marek Vasut

On 7/3/26 8:16 AM, Yannic Moog wrote:

Hello Yannic,

[...]

Quoted 8 lines
Quoted 7 lines
Quoted 4 lines

is not accurate. You were able to package OP-TEE without needing to enable support in U- Boot.
And
afaik this is a perfectly valid use-case.

When you include optee-os in the U-Boot fitImage, what do you do with that optee-os which U-Boot does not support ? Details please ?

Quoted 7 lines
Quoted 2 lines

Sure, sorry. OS can/will use it. There is no requirement, that I know, of any bootloader interfacing with OP-TEE for proper functionality and its purpose is to work with Linux kernel.

At minimum, if CONFIG_OPTEE is not enabled, U-Boot won't execute optee_copy_fdt_nodes() and won't transfer any optee-os firmware and reserved-memory DT nodes to the Linux DT when starting the kernel, so Linux DT will be buggy and Linux may possibly misbehave.

Got it. I tested your theory and with all TEE configs off and OP-TEE packaged, kernel device tree still has the necessary device tree nodes. Is there something I missed (am using phycore-imx8mp board) ? How does your Linux dtb look like in that scenario?

Quoted 7 lines
Quoted 3 lines

I guess the only job bootloader needs to do is load it into memory. I don't know details about specific uses within the security context and if there are any that require bootloader support.

If in your use case, U-Boot is supposed to only load optee-os into memory , why not load it from U-Boot command line or as part of fitImage when booting Linux kernel ?

I figured via the u-boot.dtsi is the easiest solution.

Quoted 3 lines

It seems in your use case, optee-os does not have to be part of the bootloader image at all ?

I believe it does. The init phase looks the following (on imx8m)

ROM -> U-Boot SPL -> tf-a -> OP-TEE -> tf-a -> U-boot proper

and something has to load OP-TEE into main memory when tf-a is done with init and jumps to the OPTEE load addr. That's what U-Boot does.

Quoted 59 lines
Quoted 22 lines
Quoted 18 lines
Quoted 7 lines

With this change you can no longer do that, so this change is a regression.

About the warning message. I understand that you find it confusing; binman is designed so that
it
emits a warning when an optional blob is not found.

Please see above.

Quoted 7 lines

I prefer that approach to no message at all. You may want to package OP-TEE (e.g. you have an
tf-a
blob which jumps to OP-TEE addr) and being alerted to a possible mistake is important; Let's
say
tee path was incorrect during build.

Quoted 1 line

Is this some sort of a board-specific configuration ?

kind of. We have tee path set in <soc>-u-boot.dtsi: filename = "tee.bin";

Quoted 8 lines

Could happen that TEE=teee.bin is set or file is named tee-raw.bin and then it helps to get a warning that binman was not able to package the blob.

Quoted 2 lines

Why does U-Boot not enable OPTEE-OS support in this case ?

No need to. Maybe to conserve space, or by principle only enable the configs that are actually needed? I believe PHYTEC boards used to do that before KASLR support.

This does not seem correct, please see above.

At this point, I would suggest that if you want to retain this kind of configuration for your hardware, it should be moved into board specific DT, it should not be part of the common DTs.

Quoted 15 lines
Quoted 8 lines
Quoted 7 lines

Also, keeping optional when using if defs is not a good idea. Binman will still build you an
image
when no OP-TEE blob is present, but should not since you enabled OPTEE configs. If you enable
OPTEE, you should have an OP-TEE blob packaged.
We could add ifndef OPTEE around the optional property.

Quoted 6 lines

The optional keyword is actually kept in this case, it is not a full revert.

You did however miss one vital point -- the tee node is part of the U-boot fitImage, even if the tee.bin binary is not present and OPTEE support in U-Boot is disabled. Binman prints a confusing message, and generates a bogus empty tee {} node in the fitImage. That is incorrect.

Quoted 6 lines

Yes, forgot to address that. I don't think it is confusing, at least content wise. Visually, I can
see how that is confusing. I want to neither agree nor disagree on the correctness part because I
don't really know the fitImage spec. Having the tee node be part of the fitImage is a design choice, all optional blobs behave that way from my understanding.

Quoted 3 lines

It is a broken node introduced by commit b57ed147939c ("dts:
imx8m{m,n,p,q}: Make optee packaging optional") , it is not supposed to be part of the fitImage unless optee-os is bundled into the fitImage.

This I still do not understand how you come to the conclusion that it (tee node) is not supposed to be part of the fitImage. Can you point me to the doc that disallows this?

Quoted 4 lines
Quoted 3 lines

I guess it means that there is a bug in binman if you say having empty tee node is incorrect. And so it should be fixed in binman itself imo, not here for imx8.

No, this is not a bug in binman, please see above.

Also, assuming that it is indeed illegal: Binman looks at an external blob and does not remove the parent node when it is the only child and found to be missing.
Can you please clarify what should happen when no tee blob could be found and packaged? I am asking because you wanted to keep the optional property which will cause us to end up in the same situation you said is illegal: Having the tee node in the fitImage but no tee blob.

Yannic

#7 lore raw

On 7/6/26 2:36 PM, Yannic Moog wrote:

Hello Yannic,

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

When you include optee-os in the U-Boot fitImage, what do you do with that optee-os which U-Boot does not support ? Details please ?

Sure, sorry. OS can/will use it. There is no requirement, that I know, of any bootloader interfacing with OP-TEE for proper functionality and its purpose is to work with Linux kernel.

Quoted 8 lines
Quoted 4 lines

At minimum, if CONFIG_OPTEE is not enabled, U-Boot won't execute optee_copy_fdt_nodes() and won't transfer any optee-os firmware and reserved-memory DT nodes to the Linux DT when starting the kernel, so Linux DT will be buggy and Linux may possibly misbehave.

Got it. I tested your theory and with all TEE configs off and OP-TEE packaged, kernel device tree still has the necessary device tree nodes. Is there something I missed (am using phycore-imx8mp board) ? How does your Linux dtb look like in that scenario?

I cannot answer this question, the test you performed is not well documented -- kernel version is unknown, whether the kernel was in any way modified is also unknown, etc. Maybe your kernel tree already contains some optee-os node ?

Quoted 13 lines
Quoted 6 lines
Quoted 2 lines

I guess the only job bootloader needs to do is load it into memory. I don't know details about specific uses within the security context and if there are any that require bootloader support.

If in your use case, U-Boot is supposed to only load optee-os into memory , why not load it from U-Boot command line or as part of fitImage when booting Linux kernel ?

I figured via the u-boot.dtsi is the easiest solution.

Quoted 3 lines

It seems in your use case, optee-os does not have to be part of the bootloader image at all ?

Quoted 6 lines

I believe it does. The init phase looks the following (on imx8m)

ROM -> U-Boot SPL -> tf-a -> OP-TEE -> tf-a -> U-boot proper

and something has to load OP-TEE into main memory when tf-a is done with init and jumps to the OPTEE load addr. That's what U-Boot does.

In that case, U-Boot should be aware of that optee-os , i.e. enable CONFIG_OPTEE .

[...]

Quoted 22 lines
Quoted 22 lines
Quoted 21 lines
Quoted 8 lines
Quoted 7 lines

Also, keeping optional when using if defs is not a good idea. Binman will still build you an
image
when no OP-TEE blob is present, but should not since you enabled OPTEE configs. If you enable
OPTEE, you should have an OP-TEE blob packaged.
We could add ifndef OPTEE around the optional property.

Quoted 6 lines

The optional keyword is actually kept in this case, it is not a full revert.

You did however miss one vital point -- the tee node is part of the U-boot fitImage, even if the tee.bin binary is not present and OPTEE support in U-Boot is disabled. Binman prints a confusing message, and generates a bogus empty tee {} node in the fitImage. That is incorrect.

Yes, forgot to address that. I don't think it is confusing, at least content wise. Visually, I can
see how that is confusing. I want to neither agree nor disagree on the correctness part because I
don't really know the fitImage spec. Having the tee node be part of the fitImage is a design choice, all optional blobs behave that way from my understanding.

Quoted 6 lines
Quoted 3 lines

It is a broken node introduced by commit b57ed147939c ("dts:
imx8m{m,n,p,q}: Make optee packaging optional") , it is not supposed to be part of the fitImage unless optee-os is bundled into the fitImage.

This I still do not understand how you come to the conclusion that it (tee node) is not supposed to be part of the fitImage. Can you point me to the doc that disallows this?

The empty tee node is dead code, that is why it should not be in the fitImage. Before b57ed147939c ("dts: imx8m{m,n,p,q}: Make optee packaging optional") that tee node was correctly not part of the fitImage unless explicitly configured in by the user (CONFIG_OPTEE=y).

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines

I guess it means that there is a bug in binman if you say having empty tee node is incorrect. And so it should be fixed in binman itself imo, not here for imx8.

No, this is not a bug in binman, please see above.

Also, assuming that it is indeed illegal: Binman looks at an external blob and does not remove the parent node when it is the only child and found to be missing.
Can you please clarify what should happen when no tee blob could be found and packaged?

In case of CONFIG_OPTEE=y and "optional" keyword and missing tee.bin blob , I think the node should be retained, because the user might inject tee.bin into the u-boot.itb after the build with some "mkimage -F ..." invocation.

In case of CONFIG_OPTEE=n , there should be no tee node.

Quoted 2 lines

I am asking because you wanted to keep the optional property which will cause us to end up in the same situation you said is illegal: Having the tee node in the fitImage but no tee blob.

Please see above.

#8 lore raw
Quoted 102 lines · Marek Vasut

On 7/6/26 2:36 PM, Yannic Moog wrote:

Hello Yannic,

Quoted 12 lines
Quoted 11 lines
Quoted 6 lines
Quoted 2 lines

When you include optee-os in the U-Boot fitImage, what do you do with that optee-os which U-Boot does not support ? Details please ?

Sure, sorry. OS can/will use it. There is no requirement, that I know, of any bootloader interfacing with OP-TEE for proper functionality and its purpose is to work with Linux kernel.

At minimum, if CONFIG_OPTEE is not enabled, U-Boot won't execute optee_copy_fdt_nodes() and won't transfer any optee-os firmware and reserved-memory DT nodes to the Linux DT when starting the kernel, so Linux DT will be buggy and Linux may possibly misbehave.

Quoted 4 lines

Got it. I tested your theory and with all TEE configs off and OP-TEE packaged, kernel device tree
still has the necessary device tree nodes. Is there something I missed (am using phycore-imx8mp board) ? How does your Linux dtb look like in that scenario?

I cannot answer this question, the test you performed is not well documented -- kernel version is unknown, whether the kernel was in any way modified is also unknown, etc. Maybe your kernel tree already contains some optee-os node ?

Quoted 15 lines
Quoted 8 lines
Quoted 4 lines

I guess the only job bootloader needs to do is load it into memory. I don't know details about
specific uses within the security context and if there are any that require bootloader support.

If in your use case, U-Boot is supposed to only load optee-os into memory , why not load it from U-Boot command line or as part of fitImage when booting Linux kernel ?

I figured via the u-boot.dtsi is the easiest solution.

Quoted 3 lines

It seems in your use case, optee-os does not have to be part of the bootloader image at all ?

Quoted 6 lines

I believe it does. The init phase looks the following (on imx8m)

ROM -> U-Boot SPL -> tf-a -> OP-TEE -> tf-a -> U-boot proper

and something has to load OP-TEE into main memory when tf-a is done with init and jumps to the OPTEE load addr. That's what U-Boot does.

In that case, U-Boot should be aware of that optee-os , i.e. enable CONFIG_OPTEE .

[...]

Quoted 26 lines
Quoted 26 lines
Quoted 25 lines
Quoted 9 lines
Quoted 8 lines

Also, keeping optional when using if defs is not a good idea. Binman will still build you
an
image
when no OP-TEE blob is present, but should not since you enabled OPTEE configs. If you enable
OPTEE, you should have an OP-TEE blob packaged.
We could add ifndef OPTEE around the optional property.

Quoted 6 lines

The optional keyword is actually kept in this case, it is not a full revert.

You did however miss one vital point -- the tee node is part of the U-boot fitImage, even if the tee.bin binary is not present and OPTEE support in U-Boot is disabled. Binman prints a confusing message, and generates a bogus empty tee {} node in the fitImage. That is incorrect.

Yes, forgot to address that. I don't think it is confusing, at least content wise. Visually, I
can
see how that is confusing. I want to neither agree nor disagree on the correctness part because
I
don't really know the fitImage spec. Having the tee node be part of the fitImage is a design
choice, all optional blobs behave that way from my understanding.

Quoted 7 lines
Quoted 3 lines

It is a broken node introduced by commit b57ed147939c ("dts:
imx8m{m,n,p,q}: Make optee packaging optional") , it is not supposed to be part of the fitImage unless optee-os is bundled into the fitImage.

This I still do not understand how you come to the conclusion that it (tee node) is not supposed to
be part of the fitImage. Can you point me to the doc that disallows this?

The empty tee node is dead code, that is why it should not be in the fitImage. Before b57ed147939c ("dts: imx8m{m,n,p,q}: Make optee packaging optional") that tee node was correctly not part of the fitImage unless explicitly configured in by the user (CONFIG_OPTEE=y).

Quoted 9 lines
Quoted 4 lines
Quoted 3 lines

I guess it means that there is a bug in binman if you say having empty tee node is incorrect.
And so it should be fixed in binman itself imo, not here for imx8.

No, this is not a bug in binman, please see above.

Also, assuming that it is indeed illegal: Binman looks at an external blob and does not remove the
parent node when it is the only child and found to be missing.
Can you please clarify what should happen when no tee blob could be found and packaged?

Quoted 6 lines

In case of CONFIG_OPTEE=y and "optional" keyword and missing tee.bin blob , I think the node should be retained, because the user might inject tee.bin into the u-boot.itb after the build with some "mkimage -F ..." invocation.

In case of CONFIG_OPTEE=n , there should be no tee node.

I think I need more time to digest your points. You did not convince me that when CONFIG_OPTEE=n there should not be any tee node. The rest of the discussion is based on this point so I would like to avoid discussing things further for now.
If we can get another opinion on this discussion that'd be great I think. Either way, I am okay with taking this patch. Again, it is my opinion that this is not a fix, rather we are losing a feature.

Yannic

Quoted 5 lines
Quoted 4 lines

I am asking because you wanted to keep the optional property which will cause us to end up in the
same situation you said is illegal: Having the tee node in the fitImage but no tee blob.

Please see above.

#9 lore raw

On 7/9/26 9:16 AM, Yannic Moog wrote:

Hello Yannic,

Quoted 103 lines
Quoted 103 lines
Quoted 12 lines
Quoted 11 lines
Quoted 6 lines
Quoted 2 lines

When you include optee-os in the U-Boot fitImage, what do you do with that optee-os which U-Boot does not support ? Details please ?

Sure, sorry. OS can/will use it. There is no requirement, that I know, of any bootloader interfacing with OP-TEE for proper functionality and its purpose is to work with Linux kernel.

At minimum, if CONFIG_OPTEE is not enabled, U-Boot won't execute optee_copy_fdt_nodes() and won't transfer any optee-os firmware and reserved-memory DT nodes to the Linux DT when starting the kernel, so Linux DT will be buggy and Linux may possibly misbehave.

Quoted 4 lines

Got it. I tested your theory and with all TEE configs off and OP-TEE packaged, kernel device tree
still has the necessary device tree nodes. Is there something I missed (am using phycore-imx8mp board) ? How does your Linux dtb look like in that scenario?

I cannot answer this question, the test you performed is not well documented -- kernel version is unknown, whether the kernel was in any way modified is also unknown, etc. Maybe your kernel tree already contains some optee-os node ?

Quoted 15 lines
Quoted 8 lines
Quoted 4 lines

I guess the only job bootloader needs to do is load it into memory. I don't know details about
specific uses within the security context and if there are any that require bootloader support.

If in your use case, U-Boot is supposed to only load optee-os into memory , why not load it from U-Boot command line or as part of fitImage when booting Linux kernel ?

I figured via the u-boot.dtsi is the easiest solution.

Quoted 3 lines

It seems in your use case, optee-os does not have to be part of the bootloader image at all ?

Quoted 6 lines

I believe it does. The init phase looks the following (on imx8m)

ROM -> U-Boot SPL -> tf-a -> OP-TEE -> tf-a -> U-boot proper

and something has to load OP-TEE into main memory when tf-a is done with init and jumps to the OPTEE load addr. That's what U-Boot does.

In that case, U-Boot should be aware of that optee-os , i.e. enable CONFIG_OPTEE .

[...]

Quoted 26 lines
Quoted 26 lines
Quoted 25 lines
Quoted 9 lines
Quoted 8 lines

Also, keeping optional when using if defs is not a good idea. Binman will still build you
an
image
when no OP-TEE blob is present, but should not since you enabled OPTEE configs. If you enable
OPTEE, you should have an OP-TEE blob packaged.
We could add ifndef OPTEE around the optional property.

Quoted 6 lines

The optional keyword is actually kept in this case, it is not a full revert.

You did however miss one vital point -- the tee node is part of the U-boot fitImage, even if the tee.bin binary is not present and OPTEE support in U-Boot is disabled. Binman prints a confusing message, and generates a bogus empty tee {} node in the fitImage. That is incorrect.

Yes, forgot to address that. I don't think it is confusing, at least content wise. Visually, I
can
see how that is confusing. I want to neither agree nor disagree on the correctness part because
I
don't really know the fitImage spec. Having the tee node be part of the fitImage is a design
choice, all optional blobs behave that way from my understanding.

Quoted 7 lines
Quoted 3 lines

It is a broken node introduced by commit b57ed147939c ("dts:
imx8m{m,n,p,q}: Make optee packaging optional") , it is not supposed to be part of the fitImage unless optee-os is bundled into the fitImage.

This I still do not understand how you come to the conclusion that it (tee node) is not supposed to
be part of the fitImage. Can you point me to the doc that disallows this?

The empty tee node is dead code, that is why it should not be in the fitImage. Before b57ed147939c ("dts: imx8m{m,n,p,q}: Make optee packaging optional") that tee node was correctly not part of the fitImage unless explicitly configured in by the user (CONFIG_OPTEE=y).

Quoted 9 lines
Quoted 4 lines
Quoted 3 lines

I guess it means that there is a bug in binman if you say having empty tee node is incorrect.
And so it should be fixed in binman itself imo, not here for imx8.

No, this is not a bug in binman, please see above.

Also, assuming that it is indeed illegal: Binman looks at an external blob and does not remove the
parent node when it is the only child and found to be missing.
Can you please clarify what should happen when no tee blob could be found and packaged?

In case of CONFIG_OPTEE=y and "optional" keyword and missing tee.bin blob , I think the node should be retained, because the user might inject tee.bin into the u-boot.itb after the build with some "mkimage -F ..." invocation.

Quoted 8 lines
Quoted 1 line

In case of CONFIG_OPTEE=n , there should be no tee node.

I think I need more time to digest your points. You did not convince me that when CONFIG_OPTEE=n there should not be any tee node. The rest of the discussion is based on this point so I would like to avoid discussing things further for now.
If we can get another opinion on this discussion that'd be great I think. Either way, I am okay with taking this patch. Again, it is my opinion that this is not a fix, rather we are losing a feature.

Please do keep digesting. Please do keep two things in mind -- if the platform does run optee-os, the software stack should be aware of it. If there is a special case where the software stack should not be aware of it, please put that into board DTs or board U-Boot extras DTs, but that use case is special and non-default. Finally, including dead code / dead DT nodes in build artifacts that only grows the size of the build artifact is not good.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#11 lore raw

Hi Marek,

Quoted 30 lines · Marek Vasut

On 7/9/26 1:53 PM, Marek Vasut wrote:

Hello again,

Quoted 18 lines
Quoted 7 lines
Quoted 6 lines

In case of CONFIG_OPTEE=y and "optional" keyword and missing tee.bin blob , I think the node should be retained, because the user might inject tee.bin into the u-boot.itb after the build with some "mkimage -F ..." invocation.

In case of CONFIG_OPTEE=n , there should be no tee node.

Quoted 10 lines

I think I need more time to digest your points. You did not convince me that when CONFIG_OPTEE=n
there should not be any tee node. The rest of the discussion is based on this point so I would like
to avoid discussing things further for now.
If we can get another opinion on this discussion that'd be great I think. Either way, I am okay
with taking this patch. Again, it is my opinion that this is not a fix, rather we are losing a
feature.

Quoted 7 lines

Please do keep digesting. Please do keep two things in mind -- if the platform does run optee-os, the software stack should be aware of it. If there is a special case where the software stack should not be aware of it, please put that into board DTs or board U-Boot extras DTs, but that use case is special and non-default. Finally, including dead code / dead DT nodes in build artifacts that only grows the size of the build artifact is not good.

Quoted 1 line

It has been two weeks now, what is the current state ?

My opinion on the necessity of this patch hasn't changed, yet. But I stand by what I said previously:

Quoted 2 lines

Either way, I am okay
with taking this patch.

Yannic