Skip to contentSkip to conversation

spl: Kconfig: Fix SPL_OPTEE_IMAGE dependency

PATCH In review Jagan Teki 3 participants 10 messages Nov 3, 2022 – Dec 23, 2022

Subsystems (2)
lore
Share & tools
lore

Jagan Teki

author
#0 lore raw

PATCH v2 1/3 spl: Kconfig: Fix SPL_OPTEE_IMAGE dependency

fdt_addr will build as part of SPL_LOAD_FIT or SPL_LOAD_FIT_FULL which is indeed required to build optee image support in SPL.

common/spl/spl.c: In function ‘jump_to_image_optee’:
common/spl/spl.c:220:46: error: ‘struct spl_image_info’ has no member named ‘fdt_addr’
220 | spl_optee_entry(NULL, NULL, spl_image->fdt_addr,

Fix the dependency support.

---
Changes for v2:
- none

 common/spl/Kconfig | 1 +
 1 file changed, 1 insertion(+)
common/spl/Kconfig +1 -0
index b738c749ff..95a4b8e855 100644
@@ -1479,6 +1479,7 @@ config SPL_AM33XX_ENABLE_RTC32K_OSC
 config SPL_OPTEE_IMAGE
 	bool "Support OP-TEE Trusted OS image in SPL"
 	depends on ARM
+	depends on SPL_LOAD_FIT || SPL_LOAD_FIT_FULL
 	help
 	  OP-TEE is an open source Trusted OS which is loaded by SPL.
 	  More detail at: https://github.com/OP-TEE/optee_os
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH v2 2/3 arm: dts: rockchip: Separate rockchip-binman.dtsi

rockchip-u-boot.dtsi has the FIT image for the final stage of binman image creation.

If the actual binman node is part of this dtsi then there are build issues to use optee as input to this final stage binman image since optee is built via another binman image creation unlike ATF built via tools like make_fit_atf.py.

binman: Filename 'u-boot.itb' not found in input path

Fix this by separating binman FIT image in rockchip-binman.dtsi

rockchip-u-boot.dtsi: binman node
rockchip-binman.dtsi: binman FIT image node

The inclusion of rockchip-binman.dtsi is always to be last in included files as it has a FIT image node for final image creation.

Sample example of optee used rk3288 looks like
b/arch/arm/dts/rk3288-u-boot.dtsi
#include "rockchip-u-boot.dtsi"
#include "rockchip-optee.dtsi"
#include "rockchip-binman.dtsi"

---
Changes for v2:
- excluded rv1126

 arch/arm/dts/px30-u-boot.dtsi              |  1 +
 arch/arm/dts/rk3036-u-boot.dtsi            |  1 +
 arch/arm/dts/rk3066a-u-boot.dtsi           |  1 +
 arch/arm/dts/rk3188-u-boot.dtsi            |  1 +
 arch/arm/dts/rk322x-u-boot.dtsi            |  1 +
 arch/arm/dts/rk3288-u-boot.dtsi            |  1 +
 arch/arm/dts/rk3308-u-boot.dtsi            |  1 +
 arch/arm/dts/rk3326-odroid-go2-u-boot.dtsi |  1 +
 arch/arm/dts/rk3328-u-boot.dtsi            |  1 +
 arch/arm/dts/rk3368-u-boot.dtsi            |  1 +
 arch/arm/dts/rk3399-u-boot.dtsi            |  1 +
 arch/arm/dts/rk356x-u-boot.dtsi            |  1 +
 arch/arm/dts/rockchip-binman.dtsi          | 67 ++++++++++++++++++++++
 arch/arm/dts/rockchip-u-boot.dtsi          | 61 --------------------
 arch/arm/dts/rv1108-u-boot.dtsi            |  1 +
 15 files changed, 80 insertions(+), 61 deletions(-)
 create mode 100644 arch/arm/dts/rockchip-binman.dtsi
arch/arm/dts/px30-u-boot.dtsi +1 -0
index 462eaf68f8..7cea48181c 100644
@@ -4,6 +4,7 @@
  */
 
 #include "rockchip-u-boot.dtsi"
+#include "rockchip-binman.dtsi"
 
 / {
 	aliases {
arch/arm/dts/rk3036-u-boot.dtsi +1 -0
index 41ac054b81..a49526c63a 100644
@@ -4,3 +4,4 @@
  */
 
 #include "rockchip-u-boot.dtsi"
+#include "rockchip-binman.dtsi"
arch/arm/dts/rk3066a-u-boot.dtsi +1 -0
index bc6e609d02..a85f752477 100644
@@ -1,4 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0+
 
 #include "rockchip-u-boot.dtsi"
+#include "rockchip-binman.dtsi"
 #include "rk3xxx-u-boot.dtsi"
arch/arm/dts/rk3188-u-boot.dtsi +1 -0
index 735776c16b..bc028a8c1b 100644
@@ -4,6 +4,7 @@
  */
 
 #include "rockchip-u-boot.dtsi"
+#include "rockchip-binman.dtsi"
 #include "rk3xxx-u-boot.dtsi"
 
 &global_timer {
arch/arm/dts/rk322x-u-boot.dtsi +1 -0
index 79c41e481b..bd31c3bdc4 100644
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 
 #include "rockchip-u-boot.dtsi"
+#include "rockchip-binman.dtsi"
 
 / {
 	bus_intmem@10080000 {
arch/arm/dts/rk3288-u-boot.dtsi +1 -0
index e411445ed6..a24d590e20 100644
@@ -5,6 +5,7 @@
 
 #include "rockchip-u-boot.dtsi"
 #include "rockchip-optee.dtsi"
+#include "rockchip-binman.dtsi"
 
 / {
 	aliases {
arch/arm/dts/rk3308-u-boot.dtsi +1 -0
index ab5bfc2ce9..665582ddd3 100644
@@ -4,6 +4,7 @@
  */
 
 #include "rockchip-u-boot.dtsi"
+#include "rockchip-binman.dtsi"
 
 / {
 	aliases {
arch/arm/dts/rk3326-odroid-go2-u-boot.dtsi +1 -0
index 16c33735eb..cd5d43b3c4 100644
@@ -4,6 +4,7 @@
  */
 
 #include "rockchip-u-boot.dtsi"
+#include "rockchip-binman.dtsi"
 
 / {
 	chosen {
arch/arm/dts/rk3328-u-boot.dtsi +1 -0
index d4a7540a92..407286b176 100644
@@ -4,6 +4,7 @@
  */
 
 #include "rockchip-u-boot.dtsi"
+#include "rockchip-binman.dtsi"
 
 / {
 	aliases {
arch/arm/dts/rk3368-u-boot.dtsi +1 -0
index 811d59ac34..c33604266a 100644
@@ -5,6 +5,7 @@
 
 #include <dt-bindings/memory/rk3368-dmc.h>
 #include "rockchip-u-boot.dtsi"
+#include "rockchip-binman.dtsi"
 
 / {
 	dmc: dmc@ff610000 {
arch/arm/dts/rk3399-u-boot.dtsi +1 -0
index 3c1a15fe51..03a328b295 100644
@@ -5,6 +5,7 @@
 #define USB_CLASS_HUB			9
 
 #include "rockchip-u-boot.dtsi"
+#include "rockchip-binman.dtsi"
 
 / {
 	aliases {
arch/arm/dts/rk356x-u-boot.dtsi +1 -0
index ccb8db0001..8265e1a0bd 100644
@@ -4,6 +4,7 @@
  */
 
 #include "rockchip-u-boot.dtsi"
+#include "rockchip-binman.dtsi"
 
 / {
 	aliases {
arch/arm/dts/rockchip-binman.dtsi new file +67 -0

67 lines not on this page · raw message

arch/arm/dts/rockchip-u-boot.dtsi +0 -61

64 lines not on this page · raw message

arch/arm/dts/rv1108-u-boot.dtsi +1 -0
index 6a2098b8d4..e6cb7b2f24 100644
@@ -4,6 +4,7 @@
  */
 
 #include "rockchip-u-boot.dtsi"
+#include "rockchip-binman.dtsi"
 
 &grf {
 	u-boot,dm-pre-reloc;
Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH v2 2/3] arm: dts: rockchip: Separate rockchip-binman.dtsi

Hi Jagan,

Quoted 12 lines · Jagan Teki

rockchip-u-boot.dtsi has the FIT image for the final stage of binman image creation.

If the actual binman node is part of this dtsi then there are build issues to use optee as input to this final stage binman image since optee is built via another binman image creation unlike ATF built via tools like make_fit_atf.py.

binman: Filename 'u-boot.itb' not found in input path

Fix this by separating binman FIT image in rockchip-binman.dtsi

My understanding is that this is a work-around for something that should be implemented in binman instead (e.g. dependency between images). If i'm not mistaken, what you're suggesting is to not build u-boot-rockchip.bin for some platforms? IIRC the plan for this binary was that it would apply to all Rockchip platforms, and this patch makes this "promise" go away.

Quoted 6 lines

rockchip-u-boot.dtsi: binman node
rockchip-binman.dtsi: binman FIT image node

The inclusion of rockchip-binman.dtsi is always to be last in included files as it has a FIT image node for final image creation.

You are not respecting this in your patch. Please update or remove this section if not required. (I assume you have this limitation because you use a binman phandle, meaning the node needs to be defined before).

Also, rockchip-u-boot.dtsi content is now literally:

/ {
	binman: binman {
		multiple-images;
	};
};

which is pretty much useless.

Since you want to work around your build issue, why just not include rockchip-u-boot.dtsi instead of moving part of it to another file without any added benefit (at least at first glance, I may be missing some context).

BTW, we were discussing some months ago on moving away from make_fit_atf.py to binman for all Rockchip platforms, c.f. the long discussion here: https://lore.kernel.org/u-boot/20220725172953.GD2029@begut/ So maybe we should just do this and that might fix the problem you're trying to work-around?

In any case, can you provide a bit more context on the failing platform(s)?

Cheers,
Quentin

Quoted 322 lines

Sample example of optee used rk3288 looks like

    b/arch/arm/dts/rk3288-u-boot.dtsi
    #include "rockchip-u-boot.dtsi"
    #include "rockchip-optee.dtsi"
    #include "rockchip-binman.dtsi"

---
Changes for v2:
- excluded rv1126

  arch/arm/dts/px30-u-boot.dtsi              |  1 +
  arch/arm/dts/rk3036-u-boot.dtsi            |  1 +
  arch/arm/dts/rk3066a-u-boot.dtsi           |  1 +
  arch/arm/dts/rk3188-u-boot.dtsi            |  1 +
  arch/arm/dts/rk322x-u-boot.dtsi            |  1 +
  arch/arm/dts/rk3288-u-boot.dtsi            |  1 +
  arch/arm/dts/rk3308-u-boot.dtsi            |  1 +
  arch/arm/dts/rk3326-odroid-go2-u-boot.dtsi |  1 +
  arch/arm/dts/rk3328-u-boot.dtsi            |  1 +
  arch/arm/dts/rk3368-u-boot.dtsi            |  1 +
  arch/arm/dts/rk3399-u-boot.dtsi            |  1 +
  arch/arm/dts/rk356x-u-boot.dtsi            |  1 +
  arch/arm/dts/rockchip-binman.dtsi          | 67 ++++++++++++++++++++++
  arch/arm/dts/rockchip-u-boot.dtsi          | 61 --------------------
  arch/arm/dts/rv1108-u-boot.dtsi            |  1 +
  15 files changed, 80 insertions(+), 61 deletions(-)

create mode 100644 arch/arm/dts/rockchip-binman.dtsi

arch/arm/dts/px30-u-boot.dtsi +1 -0
index 462eaf68f8..7cea48181c 100644
@@ -4,6 +4,7 @@
   */
 
  #include "rockchip-u-boot.dtsi"
+#include "rockchip-binman.dtsi"
 
  / {
  	aliases {
arch/arm/dts/rk3036-u-boot.dtsi +1 -0
index 41ac054b81..a49526c63a 100644
@@ -4,3 +4,4 @@
   */
 
  #include "rockchip-u-boot.dtsi"
+#include "rockchip-binman.dtsi"
arch/arm/dts/rk3066a-u-boot.dtsi +1 -0
index bc6e609d02..a85f752477 100644
@@ -1,4 +1,5 @@
  // SPDX-License-Identifier: GPL-2.0+
 
  #include "rockchip-u-boot.dtsi"
+#include "rockchip-binman.dtsi"
  #include "rk3xxx-u-boot.dtsi"
arch/arm/dts/rk3188-u-boot.dtsi +1 -0
index 735776c16b..bc028a8c1b 100644
@@ -4,6 +4,7 @@
   */
 
  #include "rockchip-u-boot.dtsi"
+#include "rockchip-binman.dtsi"
  #include "rk3xxx-u-boot.dtsi"
 
  &global_timer {
arch/arm/dts/rk322x-u-boot.dtsi +1 -0
index 79c41e481b..bd31c3bdc4 100644
@@ -1,6 +1,7 @@
  // SPDX-License-Identifier: GPL-2.0+
 
  #include "rockchip-u-boot.dtsi"
+#include "rockchip-binman.dtsi"
 
  / {
  	bus_intmem@10080000 {
arch/arm/dts/rk3288-u-boot.dtsi +1 -0
index e411445ed6..a24d590e20 100644
@@ -5,6 +5,7 @@
 
  #include "rockchip-u-boot.dtsi"
  #include "rockchip-optee.dtsi"
+#include "rockchip-binman.dtsi"
 
  / {
  	aliases {
arch/arm/dts/rk3308-u-boot.dtsi +1 -0
index ab5bfc2ce9..665582ddd3 100644
@@ -4,6 +4,7 @@
   */
 
  #include "rockchip-u-boot.dtsi"
+#include "rockchip-binman.dtsi"
 
  / {
  	aliases {
arch/arm/dts/rk3326-odroid-go2-u-boot.dtsi +1 -0
index 16c33735eb..cd5d43b3c4 100644
@@ -4,6 +4,7 @@
   */
 
  #include "rockchip-u-boot.dtsi"
+#include "rockchip-binman.dtsi"
 
  / {
  	chosen {
arch/arm/dts/rk3328-u-boot.dtsi +1 -0
index d4a7540a92..407286b176 100644
@@ -4,6 +4,7 @@
   */
 
  #include "rockchip-u-boot.dtsi"
+#include "rockchip-binman.dtsi"
 
  / {
  	aliases {
arch/arm/dts/rk3368-u-boot.dtsi +1 -0
index 811d59ac34..c33604266a 100644
@@ -5,6 +5,7 @@
 
  #include <dt-bindings/memory/rk3368-dmc.h>
  #include "rockchip-u-boot.dtsi"
+#include "rockchip-binman.dtsi"
 
  / {
  	dmc: dmc@ff610000 {
arch/arm/dts/rk3399-u-boot.dtsi +1 -0
index 3c1a15fe51..03a328b295 100644
@@ -5,6 +5,7 @@
  #define USB_CLASS_HUB			9
 
  #include "rockchip-u-boot.dtsi"
+#include "rockchip-binman.dtsi"
 
  / {
  	aliases {
arch/arm/dts/rk356x-u-boot.dtsi +1 -0
index ccb8db0001..8265e1a0bd 100644
@@ -4,6 +4,7 @@
   */
 
  #include "rockchip-u-boot.dtsi"
+#include "rockchip-binman.dtsi"
 
  / {
  	aliases {
arch/arm/dts/rockchip-binman.dtsi new file +67 -0
new file mode 100644
index 0000000000..8f7b3ee53b
@@ -0,0 +1,67 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Jagan Teki <[email protected]>
+ */
+
+#include <config.h>
+
+#ifdef CONFIG_SPL
+&binman {
+	simple-bin {
+		filename = "u-boot-rockchip.bin";
+		pad-byte = <0xff>;
+
+		mkimage {
+			filename = "idbloader.img";
+			args = "-n", CONFIG_SYS_SOC, "-T", "rksd";
+#ifdef CONFIG_TPL
+			multiple-data-files;
+
+			u-boot-tpl {
+			};
+#endif
+			u-boot-spl {
+			};
+		};
+
+#ifdef CONFIG_ARM64
+		blob {
+			filename = "u-boot.itb";
+#else
+		u-boot-img {
+#endif
+			offset = <CONFIG_SPL_PAD_TO>;
+		};
+	};
+
+#ifdef CONFIG_ROCKCHIP_SPI_IMAGE
+	simple-bin-spi {
+		filename = "u-boot-rockchip-spi.bin";
+		pad-byte = <0xff>;
+
+		mkimage {
+			filename = "idbloader-spi.img";
+			args = "-n", CONFIG_SYS_SOC, "-T", "rkspi";
+#ifdef CONFIG_TPL
+			multiple-data-files;
+
+			u-boot-tpl {
+			};
+#endif
+			u-boot-spl {
+			};
+		};
+
+#ifdef CONFIG_ARM64
+		blob {
+			filename = "u-boot.itb";
+#else
+		u-boot-img {
+#endif
+			/* Sync with u-boot,spl-payload-offset if present */
+			offset = <CONFIG_SYS_SPI_U_BOOT_OFFS>;
+		};
+	};
+#endif
+};
+#endif
arch/arm/dts/rockchip-u-boot.dtsi +0 -61
index 584f21eb5b..3d55553e44 100644
@@ -10,64 +10,3 @@
  		multiple-images;
  	};
  };
-
-#ifdef CONFIG_SPL
-&binman {
-	simple-bin {
-		filename = "u-boot-rockchip.bin";
-		pad-byte = <0xff>;
-
-		mkimage {
-			filename = "idbloader.img";
-			args = "-n", CONFIG_SYS_SOC, "-T", "rksd";
-#ifdef CONFIG_TPL
-			multiple-data-files;
-
-			u-boot-tpl {
-			};
-#endif
-			u-boot-spl {
-			};
-		};
-
-#ifdef CONFIG_ARM64
-		blob {
-			filename = "u-boot.itb";
-#else
-		u-boot-img {
-#endif
-			offset = <CONFIG_SPL_PAD_TO>;
-		};
-	};
-
-#ifdef CONFIG_ROCKCHIP_SPI_IMAGE
-	simple-bin-spi {
-		filename = "u-boot-rockchip-spi.bin";
-		pad-byte = <0xff>;
-
-		mkimage {
-			filename = "idbloader-spi.img";
-			args = "-n", CONFIG_SYS_SOC, "-T", "rkspi";
-#ifdef CONFIG_TPL
-			multiple-data-files;
-
-			u-boot-tpl {
-			};
-#endif
-			u-boot-spl {
-			};
-		};
-
-#ifdef CONFIG_ARM64
-		blob {
-			filename = "u-boot.itb";
-#else
-		u-boot-img {
-#endif
-			/* Sync with u-boot,spl-payload-offset if present */
-			offset = <CONFIG_SYS_SPI_U_BOOT_OFFS>;
-		};
-	};
-#endif
-};
-#endif
arch/arm/dts/rv1108-u-boot.dtsi +1 -0
index 6a2098b8d4..e6cb7b2f24 100644
@@ -4,6 +4,7 @@
   */
 
  #include "rockchip-u-boot.dtsi"
+#include "rockchip-binman.dtsi"
 
  &grf {
  	u-boot,dm-pre-reloc;
author
#3 lore raw

Re: [PATCH v2 2/3] arm: dts: rockchip: Separate rockchip-binman.dtsi

Quoted 17 lines · Quentin Schulz

Hi Jagan,

Quoted 12 lines · Jagan Teki

rockchip-u-boot.dtsi has the FIT image for the final stage of binman image creation.

If the actual binman node is part of this dtsi then there are build issues to use optee as input to this final stage binman image since optee is built via another binman image creation unlike ATF built via tools like make_fit_atf.py.

binman: Filename 'u-boot.itb' not found in input path

Fix this by separating binman FIT image in rockchip-binman.dtsi

Quoted 6 lines

My understanding is that this is a work-around for something that should be implemented in binman instead (e.g. dependency between images). If i'm not mistaken, what you're suggesting is to not build u-boot-rockchip.bin for some platforms? IIRC the plan for this binary was that it would apply to all Rockchip platforms, and this patch makes this "promise" go away.

Not really, no functionality is changed. It is just that we cannot create the final binman image for optee. It is not possible to implement in binman alone however if you want to add optee binman prior to the final binman can be solvable but it makes unnecessary ifdefs and maintaining many binman node definitions in one file seems confusing and difficult to maintain.

Quoted 26 lines
Quoted 7 lines

rockchip-u-boot.dtsi: binman node
rockchip-binman.dtsi: binman FIT image node

The inclusion of rockchip-binman.dtsi is always to be last in included files as it has a FIT image node for final image creation.

You are not respecting this in your patch. Please update or remove this section if not required. (I assume you have this limitation because you use a binman phandle, meaning the node needs to be defined before).

Also, rockchip-u-boot.dtsi content is now literally:

/ {
        binman: binman {
                multiple-images;
        };
};

which is pretty much useless.

Since you want to work around your build issue, why just not include rockchip-u-boot.dtsi instead of moving part of it to another file without any added benefit (at least at first glance, I may be missing some context).

Quoted 8 lines

BTW, we were discussing some months ago on moving away from make_fit_atf.py to binman for all Rockchip platforms, c.f. the long discussion here:
https://lore.kernel.org/u-boot/20220725172953.GD2029@begut/ So maybe we should just do this and that might fix the problem you're trying to work-around?

In any case, can you provide a bit more context on the failing platform(s)?

As I explained above, the functionality remains unchanged. Even if you build atf via binam dts files the final binman node has to be in the order of last since input files like bl31 and tee.bin have depended. Adding all the binman image creations and the final binman image creation in one file make it difficult to read and maintain and unnecessary ifdef.

Thanks,
Jagan.

#4 lore raw

Re: [PATCH v2 2/3] arm: dts: rockchip: Separate rockchip-binman.dtsi

Hi Jagan,

Quoted 26 lines · Jagan Teki
Quoted 17 lines · Quentin Schulz

Hi Jagan,

Quoted 12 lines · Jagan Teki

rockchip-u-boot.dtsi has the FIT image for the final stage of binman image creation.

If the actual binman node is part of this dtsi then there are build issues to use optee as input to this final stage binman image since optee is built via another binman image creation unlike ATF built via tools like make_fit_atf.py.

binman: Filename 'u-boot.itb' not found in input path

Fix this by separating binman FIT image in rockchip-binman.dtsi

Quoted 6 lines

My understanding is that this is a work-around for something that should be implemented in binman instead (e.g. dependency between images). If i'm not mistaken, what you're suggesting is to not build u-boot-rockchip.bin for some platforms? IIRC the plan for this binary was that it would apply to all Rockchip platforms, and this patch makes this "promise" go away.

Quoted 7 lines

Not really, no functionality is changed. It is just that we cannot create the final binman image for optee. It is not possible to implement in binman alone however if you want to add optee binman prior to the final binman can be solvable but it makes unnecessary ifdefs and maintaining many binman node definitions in one file seems confusing and difficult to maintain.

The project does not want us to use a separate script for building the SPL fit image, c.f. the message printed when you build (https://source.denx.de/u-boot/u-boot/-/blob/master/Makefile#L1134-L1140) so we'll need to migrate to binman eventually.

Patches or suggestions on how to make the binman nodes easier to maintain welcome obviously. That's a different topic though.

Quoted 33 lines
Quoted 33 lines
Quoted 7 lines

rockchip-u-boot.dtsi: binman node
rockchip-binman.dtsi: binman FIT image node

The inclusion of rockchip-binman.dtsi is always to be last in included files as it has a FIT image node for final image creation.

You are not respecting this in your patch. Please update or remove this section if not required. (I assume you have this limitation because you use a binman phandle, meaning the node needs to be defined before).

Also, rockchip-u-boot.dtsi content is now literally:

/ {
         binman: binman {
                 multiple-images;
         };
};

which is pretty much useless.

Since you want to work around your build issue, why just not include rockchip-u-boot.dtsi instead of moving part of it to another file without any added benefit (at least at first glance, I may be missing some context).

BTW, we were discussing some months ago on moving away from make_fit_atf.py to binman for all Rockchip platforms, c.f. the long discussion here:

https://urldefense.com/v3/__https://lore.kernel.org/u-boot/20220725172953.GD2029@begut/__;!!OOPJP91ZZw!loeWJQdnvs4xp1KOPE_UekBxO1MVtI8zdMU2brPPR5vPO312JHwp5kdeK2xAzXnMrepRjers3vG5dmMKdVNqzWA2G5WTCZE$  So maybe we
should just do this and that might fix the problem you're trying to
work-around?
Quoted 5 lines
Quoted 1 line

In any case, can you provide a bit more context on the failing platform(s)?

As I explained above, the functionality remains unchanged. Even if you build atf via binam dts files the final binman node has to be in the order of last since input files like bl31 and tee.bin have depended.

Yes, that's something we discussed on the linked topic. Binman would need to gain the ability to express dependencies between nodes. Otherwise, one could also force binman to build images sequentially in which case (AFAIK) the images are created top to bottom in the binman node. It makes the image creation slower but you should get what you want.

AFAIK, binman is what we're supposed to use to create U-Boot binaries and binman uses FDT for how to generate them. If there's a better way to configure the FDT without ifdef, feel free to suggest something.

Quoted 4 lines

Adding all the binman image creations and the final binman image creation in one file make it difficult to read and maintain and unnecessary ifdef.

We'll eventually have to make this migration anyways.

Back to the patch.

Applying your patch, rockchip-u-boot.dtsi only contains:

/ {
          binman: binman {
                  multiple-images;
          };
};

This makes very little sense since it is useless and meaningless on its own.

You would need to move this node to the newly added rockchip-binman.dtsi which would make this patch just about a file rename. All of this because of a build issue for one platform/SoC (as per my understanding). If you don't want to work on improving binman to support your use case right now, just don't include rockchip-u-boot.dtsi for your platform until what you want is supported?

Cheers,
Quentin

author
#5 lore raw

Re: [PATCH v2 2/3] arm: dts: rockchip: Separate rockchip-binman.dtsi

Hi Quentin,

Quoted 110 lines · Quentin Schulz

Hi Jagan,

Quoted 26 lines · Jagan Teki
Quoted 17 lines · Quentin Schulz

Hi Jagan,

Quoted 12 lines · Jagan Teki

rockchip-u-boot.dtsi has the FIT image for the final stage of binman image creation.

If the actual binman node is part of this dtsi then there are build issues to use optee as input to this final stage binman image since optee is built via another binman image creation unlike ATF built via tools like make_fit_atf.py.

binman: Filename 'u-boot.itb' not found in input path

Fix this by separating binman FIT image in rockchip-binman.dtsi

Quoted 6 lines

My understanding is that this is a work-around for something that should be implemented in binman instead (e.g. dependency between images). If i'm not mistaken, what you're suggesting is to not build u-boot-rockchip.bin for some platforms? IIRC the plan for this binary was that it would apply to all Rockchip platforms, and this patch makes this "promise" go away.

Quoted 7 lines

Not really, no functionality is changed. It is just that we cannot create the final binman image for optee. It is not possible to implement in binman alone however if you want to add optee binman prior to the final binman can be solvable but it makes unnecessary ifdefs and maintaining many binman node definitions in one file seems confusing and difficult to maintain.

The project does not want us to use a separate script for building the SPL fit image, c.f. the message printed when you build
(https://source.denx.de/u-boot/u-boot/-/blob/master/Makefile#L1134-L1140)
so we'll need to migrate to binman eventually.

Patches or suggestions on how to make the binman nodes easier to maintain welcome obviously. That's a different topic though.

Quoted 33 lines
Quoted 33 lines
Quoted 7 lines

rockchip-u-boot.dtsi: binman node
rockchip-binman.dtsi: binman FIT image node

The inclusion of rockchip-binman.dtsi is always to be last in included files as it has a FIT image node for final image creation.

You are not respecting this in your patch. Please update or remove this section if not required. (I assume you have this limitation because you use a binman phandle, meaning the node needs to be defined before).

Also, rockchip-u-boot.dtsi content is now literally:

/ {
         binman: binman {
                 multiple-images;
         };
};

which is pretty much useless.

Since you want to work around your build issue, why just not include rockchip-u-boot.dtsi instead of moving part of it to another file without any added benefit (at least at first glance, I may be missing some context).

BTW, we were discussing some months ago on moving away from make_fit_atf.py to binman for all Rockchip platforms, c.f. the long discussion here:

https://urldefense.com/v3/__https://lore.kernel.org/u-boot/20220725172953.GD2029@begut/__;!!OOPJP91ZZw!loeWJQdnvs4xp1KOPE_UekBxO1MVtI8zdMU2brPPR5vPO312JHwp5kdeK2xAzXnMrepRjers3vG5dmMKdVNqzWA2G5WTCZE$  So maybe we
should just do this and that might fix the problem you're trying to
work-around?
Quoted 5 lines
Quoted 1 line

In any case, can you provide a bit more context on the failing platform(s)?

As I explained above, the functionality remains unchanged. Even if you build atf via binam dts files the final binman node has to be in the order of last since input files like bl31 and tee.bin have depended.

Yes, that's something we discussed on the linked topic. Binman would need to gain the ability to express dependencies between nodes. Otherwise, one could also force binman to build images sequentially in which case (AFAIK) the images are created top to bottom in the binman node. It makes the image creation slower but you should get what you want.

AFAIK, binman is what we're supposed to use to create U-Boot binaries and binman uses FDT for how to generate them. If there's a better way to configure the FDT without ifdef, feel free to suggest something.

Quoted 4 lines

Adding all the binman image creations and the final binman image creation in one file make it difficult to read and maintain and unnecessary ifdef.

We'll eventually have to make this migration anyways.

Back to the patch.

Applying your patch, rockchip-u-boot.dtsi only contains:

/ {
           binman: binman {
                   multiple-images;
           };
};
Quoted 8 lines

This makes very little sense since it is useless and meaningless on its own.

You would need to move this node to the newly added rockchip-binman.dtsi which would make this patch just about a file rename. All of this because of a build issue for one platform/SoC (as per my understanding). If you don't want to work on improving binman to support your use case right now, just don't include rockchip-u-boot.dtsi for your platform until what you want is supported?

< answering all together here>

As I said this is not about building issue on a specific platform.

Let's consider the situation w/o this patch and assume u-boot.itb creation for tf-a was done via binam.

The optee image creation is already part of binman in rockchip-optee.dtsi assumes it is optee-binman
The tf-a image creation can be part of binman in rockchip-tf-a.dtsi assumes it is tf-a-binam
and final image u-boot-rockchip.bin creation is part of rockchip-binman.dtsi assumes it is final-binman.

In order to build final-binman both the optee-binman and tf-a-binman have to be built prior.

Solutions: 1
- Keep maintaining individual binam in respective files.
- Add binman node in rockchip-u-boot.dtsi (This is needed as the binman node is updating and used in later files or we can add this on individual binman image creation files - assume we do a later step)
- Include the rockchip-binman.dtsi at last in the list as it is the final image creation.

For example, a platform with tf-a
#include "rockchip-tf-a.dtsi"
#include "rockcihp-binman.dtsi"

For examples, a platform with spl-optee
#include "rockchip-optee.dtsi"
#include "rockcihp-binman.dtsi"

Solution:2
Add all binman-related files in one file and add proper ifdef to control.

There are pros and cons to each solution but solution 1 seems to be maintainable at this point in time and this patches doing that. I understand more matureness to binman can simplify things but that can be a separate discussion as of now.

Hope you understand.

Thanks,
Jagan.

#6 lore raw

Re: [PATCH v2 2/3] arm: dts: rockchip: Separate rockchip-binman.dtsi

Hi Jagan,

Quoted 125 lines · Jagan Teki

Hi Quentin,

Quoted 110 lines · Quentin Schulz

Hi Jagan,

Quoted 26 lines · Jagan Teki
Quoted 17 lines · Quentin Schulz

Hi Jagan,

Quoted 12 lines · Jagan Teki

rockchip-u-boot.dtsi has the FIT image for the final stage of binman image creation.

If the actual binman node is part of this dtsi then there are build issues to use optee as input to this final stage binman image since optee is built via another binman image creation unlike ATF built via tools like make_fit_atf.py.

binman: Filename 'u-boot.itb' not found in input path

Fix this by separating binman FIT image in rockchip-binman.dtsi

Quoted 6 lines

My understanding is that this is a work-around for something that should be implemented in binman instead (e.g. dependency between images). If i'm not mistaken, what you're suggesting is to not build u-boot-rockchip.bin for some platforms? IIRC the plan for this binary was that it would apply to all Rockchip platforms, and this patch makes this "promise" go away.

Quoted 7 lines

Not really, no functionality is changed. It is just that we cannot create the final binman image for optee. It is not possible to implement in binman alone however if you want to add optee binman prior to the final binman can be solvable but it makes unnecessary ifdefs and maintaining many binman node definitions in one file seems confusing and difficult to maintain.

The project does not want us to use a separate script for building the SPL fit image, c.f. the message printed when you build

(https://urldefense.com/v3/__https://source.denx.de/u-boot/u-boot/-/blob/master/Makefile*L1134-L1140__;Iw!!OOPJP91ZZw!gqogvHFe6_TxXIlTvQcIrfgTlGSKMX5Fbd3LsWUfHCqgJ9ozw5ShnQJkoV31NcAcL7hu-Cr1BFDYKySB1HZuJuvw40qJ1XI$ )
so we'll need to migrate to binman eventually.

Patches or suggestions on how to make the binman nodes easier to maintain welcome obviously. That's a different topic though.

Quoted 33 lines
Quoted 33 lines
Quoted 7 lines

rockchip-u-boot.dtsi: binman node
rockchip-binman.dtsi: binman FIT image node

The inclusion of rockchip-binman.dtsi is always to be last in included files as it has a FIT image node for final image creation.

You are not respecting this in your patch. Please update or remove this section if not required. (I assume you have this limitation because you use a binman phandle, meaning the node needs to be defined before).

Also, rockchip-u-boot.dtsi content is now literally:

/ {
          binman: binman {
                  multiple-images;
          };
};

which is pretty much useless.

Since you want to work around your build issue, why just not include rockchip-u-boot.dtsi instead of moving part of it to another file without any added benefit (at least at first glance, I may be missing some context).

BTW, we were discussing some months ago on moving away from make_fit_atf.py to binman for all Rockchip platforms, c.f. the long discussion here:

https://urldefense.com/v3/__https://lore.kernel.org/u-boot/20220725172953.GD2029@begut/__;!!OOPJP91ZZw!loeWJQdnvs4xp1KOPE_UekBxO1MVtI8zdMU2brPPR5vPO312JHwp5kdeK2xAzXnMrepRjers3vG5dmMKdVNqzWA2G5WTCZE$  So maybe we
should just do this and that might fix the problem you're trying to
work-around?
Quoted 5 lines
Quoted 1 line

In any case, can you provide a bit more context on the failing platform(s)?

As I explained above, the functionality remains unchanged. Even if you build atf via binam dts files the final binman node has to be in the order of last since input files like bl31 and tee.bin have depended.

Yes, that's something we discussed on the linked topic. Binman would need to gain the ability to express dependencies between nodes. Otherwise, one could also force binman to build images sequentially in which case (AFAIK) the images are created top to bottom in the binman node. It makes the image creation slower but you should get what you want.

AFAIK, binman is what we're supposed to use to create U-Boot binaries and binman uses FDT for how to generate them. If there's a better way to configure the FDT without ifdef, feel free to suggest something.

Quoted 4 lines

Adding all the binman image creations and the final binman image creation in one file make it difficult to read and maintain and unnecessary ifdef.

We'll eventually have to make this migration anyways.

Back to the patch.

Applying your patch, rockchip-u-boot.dtsi only contains:

/ {
            binman: binman {
                    multiple-images;
            };
};
Quoted 8 lines

This makes very little sense since it is useless and meaningless on its own.

You would need to move this node to the newly added rockchip-binman.dtsi which would make this patch just about a file rename. All of this because of a build issue for one platform/SoC (as per my understanding). If you don't want to work on improving binman to support your use case right now, just don't include rockchip-u-boot.dtsi for your platform until what you want is supported?

< answering all together here>

Quoted 7 lines

As I said this is not about building issue on a specific platform.

Let's consider the situation w/o this patch and assume u-boot.itb creation for tf-a was done via binam.

The optee image creation is already part of binman in rockchip-optee.dtsi assumes it is optee-binman

It is not "the optee image" it is a fitImage which happens to contain OP-TEE OS in it, but it is not *only* OP-TEE (you have u-boot-nodtb.bin and u-boot fdt too). However, I concede that the name is confusing.

Quoted 8 lines

The tf-a image creation can be part of binman in rockchip-tf-a.dtsi assumes it is tf-a-binam
and final image u-boot-rockchip.bin creation is part of rockchip-binman.dtsi assumes it is final-binman.

In order to build final-binman both the optee-binman and tf-a-binman have to be built prior.

1) This is not possible currently since binman compiles all images in parallel and there's no inter-image dependency.
2) This also does not make much sense since U-Boot does not build OP-TEE OS nor TF-A, it merely injects them into a fitImage loaded by the SPL. I don't think we want a binman dtsi per possible combination of loadables (one for tf-a, one for tf-a+op-tee, one for no tf-a (Aarch32) but op-tee, one with none of them (Aarch32)).

Considering point 2), there seems to be a misunderstanding somewhere. What am I missing?

Quoted 12 lines

Solutions: 1
- Keep maintaining individual binam in respective files.
- Add binman node in rockchip-u-boot.dtsi (This is needed as the binman node is updating and used in later files or we can add this on individual binman image creation files - assume we do a later step)
- Include the rockchip-binman.dtsi at last in the list as it is the final image creation.

For example, a platform with tf-a
#include "rockchip-tf-a.dtsi"
#include "rockcihp-binman.dtsi"

Quoted 7 lines

For examples, a platform with spl-optee
#include "rockchip-optee.dtsi"
#include "rockcihp-binman.dtsi"

Solution:2
Add all binman-related files in one file and add proper ifdef to control.

You can have a separate file per binman image if you want and include it only when needed. That would be e.g. one binman dtsi for u-boot-rockchip.bin and one for u-boot-rockchip-spi.bin.

FWIW, rockchip-optee.dtsi seems like a mistake to me and should be merged with rockchip-u-boot.dtsi.

I agree that ifdefs don't make the dtsi easy to read and error-prone when doing changes to it. The issue is that there's usually a lot in common between dtsis when you split things to avoid ifdefs (and to have some generic support, I guess the ifdef will just be added to the SoC include list to know which binman dtsi to include?).

I feel like I don't understand what you're suggesting to fix and how.

Finally, if this patch series is to be continued, I believe you should just not have a rockchip-u-boot.dtsi and have in rockchip-binman.dtsi:

/ {
    binman: binman {
        multiple-images;

        whatever is in &binman currently
    };
};

same for rockchip-optee.dtsi:

/ {
    binman: binman {
        multiple-images;

        whatever is in &binman currently
    };
};

The point being that the dtsi for just setting multiple-images and have the node label is a bit silly. Also because it could be possible to include rockchip-optee.dtsi without rockchip-u-boot.dtsi by just adding a binman: binman {} node, which is incorrect since we need this multiple-images property.

Cheers,
Quentin

author
#7 lore raw

PATCH v2 3/3 arm: dts: rockchip: Build binman image for SPL_OPTEE_IMAGE

In reply to Jagan Teki

Like ARM64 the u-boot.itb is also built when SPL_OPTEE_IMAGE is defined.

So, add SPL_OPTEE_IMAGE check for u-boot.itb blob so-that OPTEE is part of u-boot-rockchip.bin.

---
Changes for v2:
- none

 arch/arm/dts/rockchip-binman.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/dts/rockchip-binman.dtsi +1 -1
index 8f7b3ee53b..48c6e2de4c 100644
@@ -24,7 +24,7 @@
 			};
 		};
 
-#ifdef CONFIG_ARM64
+#if defined(CONFIG_ARM64) || defined(CONFIG_SPL_OPTEE_IMAGE)
 		blob {
 			filename = "u-boot.itb";
 #else
Signature · 1 line
2.25.1
author
#8 lore raw
In reply to Jagan Teki
Quoted 4 lines · Jagan Teki

fdt_addr will build as part of SPL_LOAD_FIT or SPL_LOAD_FIT_FULL which is indeed required to build optee image support in SPL.

Quoted 8 lines

common/spl/spl.c: In function ‘jump_to_image_optee’:
common/spl/spl.c:220:46: error: ‘struct spl_image_info’ has no member named ‘fdt_addr’
220 | spl_optee_entry(NULL, NULL, spl_image->fdt_addr,

Fix the dependency support.

---

Tom, please apply this fix.

Jagan.

#9 lore raw
In reply to Jagan Teki
Quoted 10 lines · Jagan Teki

fdt_addr will build as part of SPL_LOAD_FIT or SPL_LOAD_FIT_FULL which is indeed required to build optee image support in SPL.

common/spl/spl.c: In function ‘jump_to_image_optee’:
common/spl/spl.c:220:46: error: ‘struct spl_image_info’ has no member named ‘fdt_addr’
220 | spl_optee_entry(NULL, NULL, spl_image->fdt_addr,

Fix the dependency support.

Applied to u-boot/master, thanks!

Signature · 1 line
Tom