Skip to contentSkip to conversation

VBE serial part H: Implement VBE on Rockchip RK3399

PATCH Superseded Simon Glass 5 participants 87 messages Feb 5, 2025 – Feb 11, 2025

Subsystems (3)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

cover VBE serial part H: Implement VBE on Rockchip RK3399

This series completes the work to enable VBE on a suitable board. Most of it is rockchip-specific patches to support the VPL phase, i.e. the one which decides which boot patch to take (A, B or recovery).

A good chunk of this series is adding an image for VBE, by creating a new Binman image. Future work in Binman may make this more automated / easier, but for now it is written out in full. The work is undertaken piecemeal so it is easier to review the steps.

VBE allows similar boards to share firmware images, with perhaps just TPL (around 75K) being different for each board. Using a common image for VPL, SPL and U-Boot saves a lot of space in the image and makes builds easier. Of course, each board still needs a separate devicetree.

Here is the layout of the image:

Name Image-pos Size Entry-type Offset Uncomp-size
----------------------------------------------------------------------------------------------

image                                 0   1b960cf  section                    0
  alternates-fdt                   8000     31000  alternates-fdt          8000
    mkimage                        8000     31000  mkimage                    0
      u-boot-tpl                   8048     12a11  u-boot-tpl                48
  vpl                            208000     16200  fit                   208000
    image-vpl                    209400      a5a3  section                 1400
      section                    209400      a5a3  section                    0
        u-boot-vpl-nodtb                    10348  u-boot-vpl-nodtb           0
        u-boot-vpl-bss-pad                     20  u-boot-vpl-bss-pad     10348
    @fdt-SEQ                          0         0  section                    0
  vbe-a                          800000    39b200  section               800000
    spl-a                        800000    100000  fit                        0
      spl                        801400     10c97  section                 1400
        section                  801400     10c97  section                    0
          u-boot-spl-nodtb                  1a908  u-boot-spl-nodtb           0
          u-boot-spl-bss-pad                  1b0  u-boot-spl-bss-pad     1a908
      @fdt-SEQ                        0         0  section                    0
    u-boot-a                     900000    29b200  fit                   100000
      spl                        902400     10c97  section                 2400
        section                  902400     10c97  section                    0
          u-boot-spl-nodtb                  1a908  u-boot-spl-nodtb           0
          u-boot-spl-bss-pad                  1b0  u-boot-spl-bss-pad     1a908
      u-boot                     913200     e4250  section                13200
        u-boot-nodtb             913200     e4250  u-boot-nodtb               0
      @atf-SEQ                        0         0  section                    0
        atf-bl31                      0         0  atf-bl31                   0
      @tee-SEQ                        0         0  section                    0
        tee-os                        0         0  tee-os                     0
      @fdt-SEQ                        0         0  section                    0
  vbe-b                         1000000    39b200  section              1000000
    spl-b                       1000000    100000  fit                        0
      spl                       1001400     10c97  section                 1400
        section                 1001400     10c97  section                    0
          u-boot-spl-nodtb                  1a908  u-boot-spl-nodtb           0
          u-boot-spl-bss-pad                  1b0  u-boot-spl-bss-pad     1a908
      @fdt-SEQ                        0         0  section                    0
    u-boot-b                    1100000    29b200  fit                   100000
      spl                       1102400     10c97  section                 2400
        section                 1102400     10c97  section                    0
          u-boot-spl-nodtb                  1a908  u-boot-spl-nodtb           0
          u-boot-spl-bss-pad                  1b0  u-boot-spl-bss-pad     1a908
      u-boot                    1113200     e4250  section                13200
        u-boot-nodtb            1113200     e4250  u-boot-nodtb               0
      @atf-SEQ                        0         0  section                    0
        atf-bl31                      0         0  atf-bl31                   0
      @tee-SEQ                        0         0  section                    0
        tee-os                        0         0  tee-os                     0
      @fdt-SEQ                        0         0  section                    0
  vbe-recovery                  1800000    39b200  section              1800000
    spl-recovery                1800000    100000  fit                        0
      spl                       1801400     10c97  section                 1400
        section                 1801400     10c97  section                    0
          u-boot-spl-nodtb                  1a908  u-boot-spl-nodtb           0
          u-boot-spl-bss-pad                  1b0  u-boot-spl-bss-pad     1a908
      @fdt-SEQ                        0         0  section                    0
    u-boot-recovery             1900000    29b200  fit                   100000
      spl                       1902400     10c97  section                 2400
        section                 1902400     10c97  section                    0
          u-boot-spl-nodtb                  1a908  u-boot-spl-nodtb           0
          u-boot-spl-bss-pad                  1b0  u-boot-spl-bss-pad     1a908
      u-boot                    1913200     e4250  section                13200
        u-boot-nodtb            1913200     e4250  u-boot-nodtb               0
      @atf-SEQ                        0         0  section                    0
        atf-bl31                      0         0  atf-bl31                   0
      @tee-SEQ                        0         0  section                    0
        tee-os                        0         0  tee-os                     0
      @fdt-SEQ                        0         0  section                    0
  fdtmap                        1b9b200      2ecf  fdtmap               1b9b200

Unfortunately I got a bit lost trying to figure out the bloblist code, despite my being the original author. So for now I have included a revert of a recent patch, so that the logic can be simplified and more in keeping with the original intent. We may in fact need a symbol which specifically says which phase creates the bloblist, but I'm not completely sure of what the reverted patch was trying to achieve.

This is (mostly) the final VBE series, but there are a few loose ends to tidy up:

- cache is disabled in SPL, which slows the boot a little
- pinctrl init needs to be tidied up to avoid warnings

Other things may become apparently after more usage / testing.

Simon Glass (29):
arm: Support a separate stack for VPL
spl: Adjust xPL symbols
spl: Allow VBE to handle xPL size
vbe: Show the margin when using SPL_RELOC
rockchip: Allow RAM init to happen in SPL on rk3399
rockchip: dts: Factor out arch and compression
rockchip: Add an fdtmap
rockchip: Add more space below the stack pointer with kevin
rockchip: dts: Create a template for the FIT
rockchip: dts: Un-indent the FIT template
rockchip: dts: Correct the OS for U-Boot
rockchip: Specify the phase in the image
rockchip: Provide a bootstd configuration
rockchip: Add SPL into the main FIT
rockchip: Include a compatible string in each configuration
rockchip: Set the skip-at-start property correctly
rockchip: Add a template for SPL
rockchip: Add a VPL image
rockchip: Add TPL alternatives
rockchip: Update rk3399 bootph-tags for VPL
rockchip: Provide a VPL phase on rk3399
rockchip: Add symbols for spl_reloc
rockchip: Adjust rk3399 TPL-stack to the same as SPL
rockchip: Allow SPL to set up SDRAM
rockchip: Add a generic rk3399 board
rockchip: Add documentation for VBE
gitlab: Add an VBE board to the sjg lab
Revert "bloblist: Load the bloblist from the previous loader"
bloblist: Allow relocation at the end of the SPL phase

 .gitlab-ci.yml                                |   6 +
 arch/arm/dts/rk3399-generic-u-boot.dtsi       |  32 ++
 arch/arm/dts/rk3399-generic.dts               |  30 ++
 arch/arm/dts/rk3399-u-boot.dtsi               |   9 +-
 arch/arm/dts/rockchip-u-boot.dtsi             | 455 +++++++++++++-----
 arch/arm/include/asm/spl.h                    |   1 +
 arch/arm/lib/crt0_64.S                        |   4 +-
 arch/arm/mach-rockchip/Kconfig                |  25 +-
 arch/arm/mach-rockchip/Makefile               |   6 +-
 arch/arm/mach-rockchip/rk3399/Kconfig         |  11 +-
 arch/arm/mach-rockchip/spl-boot-order.c       |   3 +-
 arch/arm/mach-rockchip/spl.c                  |   3 +
 arch/arm/mach-rockchip/tpl.c                  |  12 +-
 arch/arm/mach-rockchip/u-boot-tpl-v8.lds      |  13 +
 arch/arm/mach-rockchip/u-boot-vpl-v8.lds      | 107 ++++
 arch/arm/mach-rockchip/vpl.c                  |  53 ++
 board/rockchip/evb_rk3399/MAINTAINERS         |   5 +
 cmd/vbe.c                                     |   8 +-
 common/Kconfig                                |  20 +
 common/bloblist.c                             |  77 ++-
 common/spl/Kconfig                            |   1 +
 common/spl/Kconfig.vpl                        |  13 +
 common/spl/spl.c                              |  11 +
 common/spl/spl_reloc.c                        |  14 +-
 configs/anbernic-rgxx3-rk3566_defconfig       |   2 +-
 configs/bpi-r2-pro-rk3568_defconfig           |   2 +-
 configs/chromebit_mickey_defconfig            |   2 +-
 configs/chromebook_bob_defconfig              |   4 +-
 configs/chromebook_jerry_defconfig            |   2 +-
 configs/chromebook_kevin_defconfig            |   4 +-
 configs/chromebook_minnie_defconfig           |   2 +-
 configs/chromebook_speedy_defconfig           |   2 +-
 configs/cm3588-nas-rk3588_defconfig           |   2 +-
 configs/coolpi-4b-rk3588s_defconfig           |   2 +-
 configs/coolpi-cm5-evb-rk3588_defconfig       |   2 +-
 configs/coolpi-cm5-genbook-rk3588_defconfig   |   2 +-
 configs/eaidk-610-rk3399_defconfig            |   2 +-
 configs/evb-px30_defconfig                    |   2 +-
 configs/evb-px5_defconfig                     |   2 +-
 configs/evb-rk3036_defconfig                  |   2 +-
 configs/evb-rk3229_defconfig                  |   2 +-
 configs/evb-rk3288_defconfig                  |   2 +-
 configs/evb-rk3308_defconfig                  |   2 +-
 configs/evb-rk3328_defconfig                  |   2 +-
 configs/evb-rk3399_defconfig                  |   2 +-
 configs/evb-rk3568_defconfig                  |   2 +-
 configs/evb-rk3588_defconfig                  |   2 +-
 configs/ficus-rk3399_defconfig                |   2 +-
 configs/firefly-px30_defconfig                |   2 +-
 configs/firefly-rk3288_defconfig              |   2 +-
 configs/firefly-rk3399_defconfig              |   2 +-
 configs/generic-rk3568_defconfig              |   2 +-
 configs/generic-rk3588_defconfig              |   2 +-
 configs/jaguar-rk3588_defconfig               |   2 +-
 configs/khadas-edge-captain-rk3399_defconfig  |   2 +-
 configs/khadas-edge-rk3399_defconfig          |   2 +-
 configs/khadas-edge-v-rk3399_defconfig        |   2 +-
 configs/kylin-rk3036_defconfig                |   2 +-
 configs/leez-rk3399_defconfig                 |   2 +-
 configs/lubancat-2-rk3568_defconfig           |   2 +-
 configs/miqi-rk3288_defconfig                 |   2 +-
 configs/mk808_defconfig                       |   2 +-
 configs/nanopc-t4-rk3399_defconfig            |   2 +-
 configs/nanopc-t6-rk3588_defconfig            |   2 +-
 configs/nanopi-m4-2gb-rk3399_defconfig        |   2 +-
 configs/nanopi-m4-rk3399_defconfig            |   2 +-
 configs/nanopi-m4b-rk3399_defconfig           |   2 +-
 configs/nanopi-neo4-rk3399_defconfig          |   2 +-
 configs/nanopi-r2c-plus-rk3328_defconfig      |   2 +-
 configs/nanopi-r2c-rk3328_defconfig           |   2 +-
 configs/nanopi-r2s-plus-rk3328_defconfig      |   2 +-
 configs/nanopi-r2s-rk3328_defconfig           |   2 +-
 configs/nanopi-r4s-rk3399_defconfig           |   2 +-
 configs/nanopi-r5c-rk3568_defconfig           |   2 +-
 configs/nanopi-r5s-rk3568_defconfig           |   2 +-
 configs/nanopi-r6c-rk3588s_defconfig          |   2 +-
 configs/nanopi-r6s-rk3588s_defconfig          |   2 +-
 configs/neu2-io-rv1126_defconfig              |   2 +-
 configs/neu6a-io-rk3588_defconfig             |   2 +-
 configs/neu6b-io-rk3588_defconfig             |   2 +-
 configs/nova-rk3588s_defconfig                |   2 +-
 configs/odroid-go2_defconfig                  |   2 +-
 configs/odroid-m1-rk3568_defconfig            |   2 +-
 configs/odroid-m1s-rk3566_defconfig           |   2 +-
 configs/odroid-m2-rk3588s_defconfig           |   2 +-
 configs/orangepi-3b-rk3566_defconfig          |   2 +-
 configs/orangepi-5-plus-rk3588_defconfig      |   2 +-
 configs/orangepi-5-rk3588s_defconfig          |   2 +-
 configs/orangepi-r1-plus-lts-rk3328_defconfig |   2 +-
 configs/orangepi-r1-plus-rk3328_defconfig     |   2 +-
 configs/orangepi-rk3399_defconfig             |   2 +-
 configs/phycore-rk3288_defconfig              |   2 +-
 configs/pinebook-pro-rk3399_defconfig         |   2 +-
 configs/pinephone-pro-rk3399_defconfig        |   2 +-
 configs/pinetab2-rk3566_defconfig             |   2 +-
 configs/popmetal-rk3288_defconfig             |   2 +-
 configs/powkiddy-x55-rk3566_defconfig         |   2 +-
 configs/puma-rk3399_defconfig                 |   2 +-
 configs/px30-core-ctouch2-of10-px30_defconfig |   2 +-
 configs/px30-core-ctouch2-px30_defconfig      |   2 +-
 configs/px30-core-edimm2.2-px30_defconfig     |   2 +-
 configs/qnap-ts433-rk3568_defconfig           |   2 +-
 configs/quartz64-a-rk3566_defconfig           |   2 +-
 configs/quartz64-b-rk3566_defconfig           |   2 +-
 configs/quartzpro64-rk3588_defconfig          |   2 +-
 configs/radxa-cm3-io-rk3566_defconfig         |   2 +-
 configs/radxa-e25-rk3568_defconfig            |   2 +-
 configs/radxa-zero-3-rk3566_defconfig         |   2 +-
 configs/rk3399-generic_defconfig              | 133 +++++
 configs/roc-cc-rk3308_defconfig               |   2 +-
 configs/roc-cc-rk3328_defconfig               |   2 +-
 configs/roc-pc-mezzanine-rk3399_defconfig     |   2 +-
 configs/roc-pc-rk3399_defconfig               |   2 +-
 configs/rock-3a-rk3568_defconfig              |   2 +-
 configs/rock-3b-rk3568_defconfig              |   2 +-
 configs/rock-3c-rk3566_defconfig              |   2 +-
 configs/rock-4c-plus-rk3399_defconfig         |   2 +-
 configs/rock-4se-rk3399_defconfig             |   2 +-
 configs/rock-5-itx-rk3588_defconfig           |   2 +-
 configs/rock-pi-4-rk3399_defconfig            |   2 +-
 configs/rock-pi-4c-rk3399_defconfig           |   2 +-
 configs/rock-pi-e-rk3328_defconfig            |   2 +-
 configs/rock-pi-e-v3-rk3328_defconfig         |   2 +-
 configs/rock-pi-n10-rk3399pro_defconfig       |   2 +-
 configs/rock-pi-n8-rk3288_defconfig           |   2 +-
 configs/rock-pi-s-rk3308_defconfig            |   2 +-
 configs/rock-s0-rk3308_defconfig              |   2 +-
 configs/rock2_defconfig                       |   2 +-
 configs/rock5a-rk3588s_defconfig              |   2 +-
 configs/rock5b-rk3588_defconfig               |   2 +-
 configs/rock64-rk3328_defconfig               |   2 +-
 configs/rock960-rk3399_defconfig              |   2 +-
 configs/rock_defconfig                        |   2 +-
 configs/rockpro64-rk3399_defconfig            |   2 +-
 configs/sige7-rk3588_defconfig                |   2 +-
 configs/sonoff-ihost-rv1126_defconfig         |   2 +-
 configs/soquartz-blade-rk3566_defconfig       |   2 +-
 configs/soquartz-cm4-rk3566_defconfig         |   2 +-
 configs/soquartz-model-a-rk3566_defconfig     |   2 +-
 configs/tiger-rk3588_defconfig                |   2 +-
 configs/tinker-rk3288_defconfig               |   2 +-
 configs/tinker-s-rk3288_defconfig             |   2 +-
 configs/toybrick-rk3588_defconfig             |   2 +-
 configs/turing-rk1-rk3588_defconfig           |   2 +-
 configs/vyasa-rk3288_defconfig                |   2 +-
 doc/board/rockchip/rockchip.rst               |  13 +
 drivers/ram/rockchip/sdram_rk3399.c           |   6 +-
 include/bloblist.h                            |  10 -
 include/vbe.h                                 |   3 +
 149 files changed, 1016 insertions(+), 312 deletions(-)
 create mode 100644 arch/arm/dts/rk3399-generic-u-boot.dtsi
 create mode 100644 arch/arm/dts/rk3399-generic.dts
 create mode 100644 arch/arm/mach-rockchip/u-boot-vpl-v8.lds
 create mode 100644 arch/arm/mach-rockchip/vpl.c
 create mode 100644 configs/rk3399-generic_defconfig
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/29 arm: Support a separate stack for VPL

VPL has the same needs as TPL in situations where the stack is at the top of SRAM. Add an option for this and implement it for arm

---

 arch/arm/lib/crt0_64.S |  4 +++-
 common/spl/Kconfig.vpl | 13 +++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)
arch/arm/lib/crt0_64.S +3 -1
index 32401f544a7..122e0217470 100644
@@ -71,7 +71,9 @@ ENTRY(_main)
  */
 #if defined(CONFIG_TPL_BUILD) && defined(CONFIG_TPL_NEEDS_SEPARATE_STACK)
 	ldr	x0, =(CONFIG_TPL_STACK)
-#elif defined(CONFIG_XPL_BUILD) && defined(CONFIG_SPL_STACK)
+#elif defined(CONFIG_VPL_BUILD) && defined(CONFIG_VPL_NEEDS_SEPARATE_STACK)
+	ldr	x0, =(CONFIG_VPL_STACK)
+#elif defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK)
 	ldr	x0, =(CONFIG_SPL_STACK)
 #elif defined(CONFIG_INIT_SP_RELATIVE)
 #if CONFIG_POSITION_INDEPENDENT
common/spl/Kconfig.vpl +13 -0
index cf6b36c8e38..d4d4a00d99f 100644
@@ -252,6 +252,12 @@ config VPL_SYS_MALLOC_SIMPLE
 	  this will make the VPL binary smaller at the cost of more heap
 	  usage as the *_simple malloc functions do not re-use free-ed mem.
 
+config VPL_NEEDS_SEPARATE_STACK
+	bool "VPL needs a separate initial stack-pointer"
+	help
+	  Enable, if the VPL stage should not inherit its initial
+	  stack-pointer from the settings for the TPL stage.
+
 config VPL_TEXT_BASE
 	hex "VPL Text Base"
 	default 0x0
@@ -266,6 +272,13 @@ config VPL_MAX_SIZE
 	  The maximum size (in bytes) of the TPL stage. This size is determined
 	  by the amount of internal SRAM memory.
 
+config VPL_STACK
+	hex "Address of the initial stack-pointer for the TPL stage"
+	depends on VPL_NEEDS_SEPARATE_STACK
+	help
+	  The address of the initial stack-pointer for the TPL stage.
+	  Usually this will be the (aligned) top-of-stack.
+
 config VPL_BINMAN_SYMBOLS
 	bool "Declare binman symbols in VPL"
 	depends on VPL_FRAMEWORK && BINMAN
Signature · 1 line
2.43.0
#2 lore raw

Re: [PATCH 01/29] arm: Support a separate stack for VPL

Quoted 15 lines · Simon Glass

VPL has the same needs as TPL in situations where the stack is at the top of SRAM. Add an option for this and implement it for arm

---

 arch/arm/lib/crt0_64.S |  4 +++-
 common/spl/Kconfig.vpl | 13 +++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)
arch/arm/lib/crt0_64.S +0 -0
index 32401f544a7..122e0217470 100644

arch/arm/lib/crt0_64.S ENTRY(_main) · line 79

Quoted 10 lines
arch/arm/lib/crt0_64.S +3 -1
@@ -71,7 +71,9 @@ ENTRY(_main)
  */
 #if defined(CONFIG_TPL_BUILD) && defined(CONFIG_TPL_NEEDS_SEPARATE_STACK)
 	ldr	x0, =(CONFIG_TPL_STACK)
-#elif defined(CONFIG_XPL_BUILD) && defined(CONFIG_SPL_STACK)
+#elif defined(CONFIG_VPL_BUILD) && defined(CONFIG_VPL_NEEDS_SEPARATE_STACK)
+	ldr	x0, =(CONFIG_VPL_STACK)
+#elif defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK)
 	ldr	x0, =(CONFIG_SPL_STACK)
 #elif defined(CONFIG_INIT_SP_RELATIVE)
 #if CONFIG_POSITION_INDEPENDENT

We should rename CONFIG_SPL_STACK to CONFIG_SPL_NEEDS_SEPARATE_STACK so that this can be tidied up to something like:

#if defined(CONFIG_XPL_BUILD) && CONFIG_IS_ENABLED(NEEDS_SEPARATE_STACK)
	ldr	x0, =CONFIG_VAL(STACK)

#endif

Signature · 1 line
Tom
#3 lore raw

Re: [PATCH 01/29] arm: Support a separate stack for VPL

In reply to Simon Glass

Hi Simon,

Quoted 9 lines · Simon Glass

VPL has the same needs as TPL in situations where the stack is at the top of SRAM. Add an option for this and implement it for arm

---

 arch/arm/lib/crt0_64.S |  4 +++-
 common/spl/Kconfig.vpl | 13 +++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

[snip]

Quoted 4 lines
common/spl/Kconfig.vpl +0 -0
index cf6b36c8e38..d4d4a00d99f 100644

[snip]

common/spl/Kconfig.vpl config VPL_MAX_SIZE · line 280

Quoted 10 lines
common/spl/Kconfig.vpl +6 -0
@@ -266,6 +272,13 @@ config VPL_MAX_SIZE
 	  The maximum size (in bytes) of the TPL stage. This size is determined
 	  by the amount of internal SRAM memory.
 
+config VPL_STACK
+	hex "Address of the initial stack-pointer for the TPL stage"
+	depends on VPL_NEEDS_SEPARATE_STACK
+	help
+	  The address of the initial stack-pointer for the TPL stage.
+	  Usually this will be the (aligned) top-of-stack.

I am guessing the two mentions of TPL above should be VPL?

Regards,
Jonas

Quoted 4 lines
common/spl/Kconfig.vpl +1 -0
+
 config VPL_BINMAN_SYMBOLS
 	bool "Declare binman symbols in VPL"
 	depends on VPL_FRAMEWORK && BINMAN
#4 lore raw

PATCH 2/29 spl: Adjust xPL symbols

In reply to Simon Glass

Update for the new xPL naming, which was missed in a previous patch which proported to do this.

---

 common/spl/spl_reloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/spl/spl_reloc.c +1 -1
index 324b98eaf98..216c0f36623 100644
@@ -59,7 +59,7 @@ static int setup_layout(struct spl_image_info *image, ulong *addrp)
 	uint need_size = image->size + image->fdt_size;
 	margin = buf_size - need_size;
 	log_debug("spl_reloc %s->%s: margin%s%lx limit %lx fdt_size %lx base %lx avail %x image %x fdt %lx need %x\n",
-		  spl_phase_name(spl_phase()), spl_phase_name(spl_phase() + 1),
+		  xpl_name(xpl_phase()), xpl_name(xpl_phase() + 1),
 		  margin >= 0 ? " " : " -", abs(margin), limit, fdt_size, base,
 		  buf_size, image->size, image->fdt_size, need_size);
 	if (margin < 0) {
Signature · 1 line
2.43.0
#6 lore raw

PATCH 3/29 spl: Allow VBE to handle xPL size

In reply to Simon Glass

When VBE is in use, the size of each phase is obtained by reading it from a FIT. Avoid using binman symbols unless necessary, i.e. in TPL.

---

 common/spl/spl.c | 2 ++
 1 file changed, 2 insertions(+)
common/spl/spl.c +2 -0
index 6b75910e243..e7157df1ff9 100644
@@ -200,6 +200,8 @@ ulong spl_get_image_size(void)
 #ifdef CONFIG_VPL
 	if (xpl_next_phase() == PHASE_VPL)
 		return binman_sym(ulong, u_boot_vpl_any, size);
+
+	return 0;	/* VBE handles this */
 #endif
 	return xpl_next_phase() == PHASE_SPL ?
 		binman_sym(ulong, u_boot_spl_any, size) :
Signature · 1 line
2.43.0
#7 lore raw

PATCH 4/29 vbe: Show the margin when using SPL_RELOC

In reply to Simon Glass

Collect information about the memory-margin in each phase which uses this feature. Update the 'vbe state' command to show it.

---

 cmd/vbe.c              |  8 ++++++--
 common/spl/spl_reloc.c | 12 ++++++++++++
 include/vbe.h          |  3 +++
 3 files changed, 21 insertions(+), 2 deletions(-)
cmd/vbe.c +6 -2
index 186f6e6860d..02d224ad286 100644
@@ -92,9 +92,13 @@ static int do_vbe_state(struct cmd_tbl *cmdtp, int flag, int argc,
 
 	printf("Phases:");
 	for (i = PHASE_NONE; i < PHASE_COUNT; i++) {
-		if (handoff->phases & (1 << i))
-			printf(" %s", xpl_name(i));
+		if (handoff->phases & (1 << i)) {
+			int margin = handoff->reloc_margin[i];
 
+			printf(" %s", xpl_name(i));
+			if (margin)
+				printf(" (margin %x) ", margin);
+		}
 	}
 	if (!handoff->phases)
 		printf(" (none)");
common/spl/spl_reloc.c +12 -0
index 216c0f36623..6bfc75bc484 100644
@@ -4,11 +4,13 @@
  * Written by Simon Glass <[email protected]>
  */
 
+#include <bloblist.h>
 #include <gzip.h>
 #include <image.h>
 #include <log.h>
 #include <mapmem.h>
 #include <spl.h>
+#include <vbe.h>
 #include <asm/global_data.h>
 #include <asm/io.h>
 #include <asm/sections.h>
@@ -58,6 +60,16 @@ static int setup_layout(struct spl_image_info *image, ulong *addrp)
 	buf_size = rcode_base - base;
 	uint need_size = image->size + image->fdt_size;
 	margin = buf_size - need_size;
+
+	if (CONFIG_IS_ENABLED(BLOBLIST)) {
+		struct vbe_handoff *handoff;
+
+		handoff = bloblist_find(BLOBLISTT_VBE,
+					sizeof(struct vbe_handoff));
+		if (handoff)
+			handoff->reloc_margin[xpl_phase()] = margin;
+	}
+
 	log_debug("spl_reloc %s->%s: margin%s%lx limit %lx fdt_size %lx base %lx avail %x image %x fdt %lx need %x\n",
 		  xpl_name(xpl_phase()), xpl_name(xpl_phase() + 1),
 		  margin >= 0 ? " " : " -", abs(margin), limit, fdt_size, base,
include/vbe.h +3 -0
index 61bfa0e557d..84a996cdf7f 100644
@@ -11,6 +11,7 @@
 #define __VBE_H
 
 #include <linux/types.h>
+#include <spl.h>
 
 /**
  * enum vbe_phase_t - current phase of VBE
@@ -47,12 +48,14 @@ enum vbe_pick_t {
  * @size: Size of the area containing the FIT
  * @phases: Indicates which phases used the VBE bootmeth (1 << PHASE_...)
  * @pick: Indicates which firmware pick was used (enum vbe_pick_t)
+ * @reloc_margin: Indicates the number of bytes of margin coming into this phase
  */
 struct vbe_handoff {
 	ulong offset;
 	ulong size;
 	u8 phases;
 	u8 pick;
+	int reloc_margin[PHASE_COUNT];
 };
 
 /**
Signature · 1 line
2.43.0
#8 lore raw

PATCH 5/29 rockchip: Allow RAM init to happen in SPL on rk3399

In reply to Simon Glass

TPL runs before VPL. The earliest updatable phase with VBE is SPL. We want to be able to update the RAM-init code in the field.

So when VPL is being used, init the RAM later, in SPL.

---

 drivers/ram/rockchip/sdram_rk3399.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/ram/rockchip/sdram_rk3399.c +4 -2
index 6fa8f268770..9ac16dfdc71 100644
@@ -194,6 +194,7 @@ struct io_setting {
 static bool phase_sdram_init(void)
 {
 	return xpl_phase() == PHASE_TPL ||
+		(IS_ENABLED(CONFIG_VPL) && xpl_phase() == PHASE_SPL) ||
 		(!IS_ENABLED(CONFIG_TPL) &&
 		 !IS_ENABLED(CONFIG_ROCKCHIP_EXTERNAL_TPL) &&
 		 !not_xpl());
@@ -3195,8 +3196,9 @@ U_BOOT_DRIVER(dmc_rk3399) = {
 	.of_to_plat = rk3399_dmc_of_to_plat,
 	.probe = rk3399_dmc_probe,
 	.priv_auto	= sizeof(struct dram_info),
-#if defined(CONFIG_TPL_BUILD) || \
-	(!defined(CONFIG_TPL) && defined(CONFIG_XPL_BUILD))
+#if defined(CONFIG_VPL) && defined(CONFIG_SPL_BUILD) || \
+	!defined(CONFIG_VPL) && defined(CONFIG_TPL_BUILD) || \
+	!defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD)
 	.plat_auto	= sizeof(struct rockchip_dmc_plat),
 #endif
 };
Signature · 1 line
2.43.0
#9 lore raw

Re: [PATCH 05/29] rockchip: Allow RAM init to happen in SPL on rk3399

Hi Simon,

Quoted 2 lines · Simon Glass

TPL runs before VPL. The earliest updatable phase with VBE is SPL. We want to be able to update the RAM-init code in the field.

If I understand your description here, you mean that both TPL and VPL are meant to be "burned" onto the board and not intended to be updatable?

Is this a typo or do I misunderstand something? Else I do not understand why you would need TPL->VPL->SPL, please explain.

Quoted 23 lines

So when VPL is being used, init the RAM later, in SPL.

---

 drivers/ram/rockchip/sdram_rk3399.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/ram/rockchip/sdram_rk3399.c +1 -0
index 6fa8f268770..9ac16dfdc71 100644
@@ -194,6 +194,7 @@ struct io_setting {
 static bool phase_sdram_init(void)
 {
 	return xpl_phase() == PHASE_TPL ||
+		(IS_ENABLED(CONFIG_VPL) && xpl_phase() == PHASE_SPL) ||
 		(!IS_ENABLED(CONFIG_TPL) &&
 		 !IS_ENABLED(CONFIG_ROCKCHIP_EXTERNAL_TPL) &&
 		 !not_xpl());
@@ -3195,8 +3196,9 @@ U_BOOT_DRIVER(dmc_rk3399) = {
 	.of_to_plat = rk3399_dmc_of_to_plat,

drivers/ram/rockchip/sdram_rk3399.c U_BOOT_DRIVER(dmc_rk3399) = { · line 3204

Quoted 10 lines
drivers/ram/rockchip/sdram_rk3399.c +3 -2
 	.probe = rk3399_dmc_probe,
 	.priv_auto	= sizeof(struct dram_info),
-#if defined(CONFIG_TPL_BUILD) || \
-	(!defined(CONFIG_TPL) && defined(CONFIG_XPL_BUILD))
+#if defined(CONFIG_VPL) && defined(CONFIG_SPL_BUILD) || \
+	!defined(CONFIG_VPL) && defined(CONFIG_TPL_BUILD) || \
+	!defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD)
 	.plat_auto	= sizeof(struct rockchip_dmc_plat),
 #endif
 };

These two conditions are starting to get ridiculous.

With "[PATCH 24/29] rockchip: Allow SPL to set up SDRAM" you are depending on TPL_RAM to decide if RAM should be initialized. Maybe that is something we can use here to simplify?

Basically we will have 3 possible DRAM init scenarios to support:
- ROCKCHIP_EXTERNA_TPL=y -> DRAM init happen in external TPL and SPL should only read DRAM size
- VPL=y or TPL=n -> both DRAM init and read DRAM size happen in SPL
- TPL=y -> DRAM init in TPL and SPL should only read DRAM size

Regards,
Jonas

#10 lore raw

Re: [PATCH 05/29] rockchip: Allow RAM init to happen in SPL on rk3399

Hi Jonas,

Quoted 9 lines · Jonas Karlman

Hi Simon,

Quoted 2 lines · Simon Glass

TPL runs before VPL. The earliest updatable phase with VBE is SPL. We want to be able to update the RAM-init code in the field.

If I understand your description here, you mean that both TPL and VPL are meant to be "burned" onto the board and not intended to be updatable?

Yes, that's right. If you look at [1] and click on 'vbe-intro' there is a diagram that shows the flow.

Quoted 40 lines

Is this a typo or do I misunderstand something? Else I do not understand why you would need TPL->VPL->SPL, please explain.

Quoted 23 lines

So when VPL is being used, init the RAM later, in SPL.

---

 drivers/ram/rockchip/sdram_rk3399.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/ram/rockchip/sdram_rk3399.c +1 -0
index 6fa8f268770..9ac16dfdc71 100644
@@ -194,6 +194,7 @@ struct io_setting {
 static bool phase_sdram_init(void)
 {
      return xpl_phase() == PHASE_TPL ||
+             (IS_ENABLED(CONFIG_VPL) && xpl_phase() == PHASE_SPL) ||
              (!IS_ENABLED(CONFIG_TPL) &&
               !IS_ENABLED(CONFIG_ROCKCHIP_EXTERNAL_TPL) &&
               !not_xpl());
@@ -3195,8 +3196,9 @@ U_BOOT_DRIVER(dmc_rk3399) = {
      .of_to_plat = rk3399_dmc_of_to_plat,

drivers/ram/rockchip/sdram_rk3399.c U_BOOT_DRIVER(dmc_rk3399) = { · line 3204

Quoted 10 lines
drivers/ram/rockchip/sdram_rk3399.c +3 -2
      .probe = rk3399_dmc_probe,
      .priv_auto      = sizeof(struct dram_info),
-#if defined(CONFIG_TPL_BUILD) || \
-     (!defined(CONFIG_TPL) && defined(CONFIG_XPL_BUILD))
+#if defined(CONFIG_VPL) && defined(CONFIG_SPL_BUILD) || \
+     !defined(CONFIG_VPL) && defined(CONFIG_TPL_BUILD) || \
+     !defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD)
      .plat_auto      = sizeof(struct rockchip_dmc_plat),
 #endif
 };

These two conditions are starting to get ridiculous.

Quoted 3 lines

With "[PATCH 24/29] rockchip: Allow SPL to set up SDRAM" you are depending on TPL_RAM to decide if RAM should be initialized. Maybe that is something we can use here to simplify?

The problem is that TPL_RAM means that the ram driver is present, which isn't the same thing as actually doing the RAM init in that phase. If we had a Kconfig value for 'phase' then we could perhaps have CONFIG_PHASE_RAM=tpl or something like that. I plan to get back to my rejected XPL series soon and that is something I could incorporate when that goes in.

Quoted 6 lines

Basically we will have 3 possible DRAM init scenarios to support:
- ROCKCHIP_EXTERNA_TPL=y -> DRAM init happen in external TPL and SPL should only read DRAM size
- VPL=y or TPL=n -> both DRAM init and read DRAM size happen in SPL
- TPL=y -> DRAM init in TPL and SPL should only read DRAM size

Yes that's my understanding too. For the last one, for clarity:

- TPL=y -> DRAM init in TPL; SPL should only read DRAM size

Regards,
Simon

[1] https://docs.u-boot.org/en/latest/develop/vbe.html#verified-boot-for-embedded-vbe

#11 lore raw

Re: [PATCH 05/29] rockchip: Allow RAM init to happen in SPL on rk3399

Hi Simon,

Quoted 7 lines · Simon Glass

Hi Jonas,

Quoted 4 lines · Jonas Karlman

Hi Simon,

On 2025-02-05 02:54, Simon Glass wrote:

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

TPL runs before VPL. The earliest updatable phase with VBE is SPL. We want to be able to update the RAM-init code in the field.

If I understand your description here, you mean that both TPL and VPL are meant to be "burned" onto the board and not intended to be updatable?

Yes, that's right. If you look at [1] and click on 'vbe-intro' there is a diagram that shows the flow.

Thanks for the reference, I can see that both are listed as read-only. Unfortunately that do not explain why we need to have both TPL and VPL aside from it being two separate conceptual parts.

We can as easily just have BootROM load VPL and start from there, it does not look like TPL provides anything of real value for VBE on Rockchip, only one more part that can potentially fail?

Quoted 41 lines
Quoted 41 lines

Is this a typo or do I misunderstand something? Else I do not understand why you would need TPL->VPL->SPL, please explain.

Quoted 23 lines

So when VPL is being used, init the RAM later, in SPL.

---

 drivers/ram/rockchip/sdram_rk3399.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/ram/rockchip/sdram_rk3399.c +1 -0
index 6fa8f268770..9ac16dfdc71 100644
@@ -194,6 +194,7 @@ struct io_setting {
 static bool phase_sdram_init(void)
 {
      return xpl_phase() == PHASE_TPL ||
+             (IS_ENABLED(CONFIG_VPL) && xpl_phase() == PHASE_SPL) ||
              (!IS_ENABLED(CONFIG_TPL) &&
               !IS_ENABLED(CONFIG_ROCKCHIP_EXTERNAL_TPL) &&
               !not_xpl());
@@ -3195,8 +3196,9 @@ U_BOOT_DRIVER(dmc_rk3399) = {
      .of_to_plat = rk3399_dmc_of_to_plat,

drivers/ram/rockchip/sdram_rk3399.c U_BOOT_DRIVER(dmc_rk3399) = { · line 3204

Quoted 10 lines
drivers/ram/rockchip/sdram_rk3399.c +3 -2
      .probe = rk3399_dmc_probe,
      .priv_auto      = sizeof(struct dram_info),
-#if defined(CONFIG_TPL_BUILD) || \
-     (!defined(CONFIG_TPL) && defined(CONFIG_XPL_BUILD))
+#if defined(CONFIG_VPL) && defined(CONFIG_SPL_BUILD) || \
+     !defined(CONFIG_VPL) && defined(CONFIG_TPL_BUILD) || \
+     !defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD)
      .plat_auto      = sizeof(struct rockchip_dmc_plat),
 #endif
 };

These two conditions are starting to get ridiculous.

Quoted 8 lines
Quoted 3 lines

With "[PATCH 24/29] rockchip: Allow SPL to set up SDRAM" you are depending on TPL_RAM to decide if RAM should be initialized. Maybe that is something we can use here to simplify?

The problem is that TPL_RAM means that the ram driver is present, which isn't the same thing as actually doing the RAM init in that phase. If we had a Kconfig value for 'phase' then we could perhaps have CONFIG_PHASE_RAM=tpl or something like that.

Yes, we may need to add a new Kconfig symbol to more easily control where DRAM init happens.

I have been slowly working on unifying all Rockchip SoCs to use TPL for DRAM init and SPL for loading a FIT. All AArch64 should now follow this, and currently looking at migrating the older ARMv7 SoCs.

Quoted 11 lines

I plan to get back
to my rejected XPL series soon and that is something I could incorporate when that goes in.

Quoted 6 lines

Basically we will have 3 possible DRAM init scenarios to support:
- ROCKCHIP_EXTERNA_TPL=y -> DRAM init happen in external TPL and SPL should only read DRAM size
- VPL=y or TPL=n -> both DRAM init and read DRAM size happen in SPL
- TPL=y -> DRAM init in TPL and SPL should only read DRAM size

Quoted 3 lines

Yes that's my understanding too. For the last one, for clarity:

- TPL=y -> DRAM init in TPL; SPL should only read DRAM size

Correct.

Regards,
Jonas

Quoted 5 lines

Regards,
Simon

[1] https://docs.u-boot.org/en/latest/develop/vbe.html#verified-boot-for-embedded-vbe

#12 lore raw

Re: [PATCH 05/29] rockchip: Allow RAM init to happen in SPL on rk3399

Hi Jonas,

Quoted 20 lines · Jonas Karlman

Hi Simon,

Quoted 7 lines · Simon Glass

Hi Jonas,

Quoted 4 lines · Jonas Karlman

Hi Simon,

On 2025-02-05 02:54, Simon Glass wrote:

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

TPL runs before VPL. The earliest updatable phase with VBE is SPL. We want to be able to update the RAM-init code in the field.

If I understand your description here, you mean that both TPL and VPL are meant to be "burned" onto the board and not intended to be updatable?

Yes, that's right. If you look at [1] and click on 'vbe-intro' there is a diagram that shows the flow.

Quoted 7 lines

Thanks for the reference, I can see that both are listed as read-only. Unfortunately that do not explain why we need to have both TPL and VPL aside from it being two separate conceptual parts.

We can as easily just have BootROM load VPL and start from there, it does not look like TPL provides anything of real value for VBE on Rockchip, only one more part that can potentially fail?

It is partly conceptual, partly due to space.

TPL is about init setup and it is board-specific. VPL is a generic 'root-of-trust' thing which contains the ABrec logic. It is supposed to be generic and run on any supported board.

Some boards have very limited space for TPL, but can load a larger amount of code after that. There are quite a lot of x86 boards like that. Also, for rk3399 I was unable to fit all the TPL init and VPL logic into a single phase and still have room to load SPL.

As to combining them, I am sure it could be done, if there is enough SRAM. Perhaps that could be a build option?

If the MMC fails, we are not going to boot, so loading an extra phase is not a big problem, IMO.

Quoted 51 lines
Quoted 42 lines
Quoted 42 lines

Is this a typo or do I misunderstand something? Else I do not understand why you would need TPL->VPL->SPL, please explain.

Quoted 23 lines

So when VPL is being used, init the RAM later, in SPL.

---

 drivers/ram/rockchip/sdram_rk3399.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/ram/rockchip/sdram_rk3399.c +1 -0
index 6fa8f268770..9ac16dfdc71 100644
@@ -194,6 +194,7 @@ struct io_setting {
 static bool phase_sdram_init(void)
 {
      return xpl_phase() == PHASE_TPL ||
+             (IS_ENABLED(CONFIG_VPL) && xpl_phase() == PHASE_SPL) ||
              (!IS_ENABLED(CONFIG_TPL) &&
               !IS_ENABLED(CONFIG_ROCKCHIP_EXTERNAL_TPL) &&
               !not_xpl());
@@ -3195,8 +3196,9 @@ U_BOOT_DRIVER(dmc_rk3399) = {
      .of_to_plat = rk3399_dmc_of_to_plat,

drivers/ram/rockchip/sdram_rk3399.c U_BOOT_DRIVER(dmc_rk3399) = { · line 3204

Quoted 10 lines
drivers/ram/rockchip/sdram_rk3399.c +3 -2
      .probe = rk3399_dmc_probe,
      .priv_auto      = sizeof(struct dram_info),
-#if defined(CONFIG_TPL_BUILD) || \
-     (!defined(CONFIG_TPL) && defined(CONFIG_XPL_BUILD))
+#if defined(CONFIG_VPL) && defined(CONFIG_SPL_BUILD) || \
+     !defined(CONFIG_VPL) && defined(CONFIG_TPL_BUILD) || \
+     !defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD)
      .plat_auto      = sizeof(struct rockchip_dmc_plat),
 #endif
 };

These two conditions are starting to get ridiculous.

Quoted 8 lines
Quoted 3 lines

With "[PATCH 24/29] rockchip: Allow SPL to set up SDRAM" you are depending on TPL_RAM to decide if RAM should be initialized. Maybe that is something we can use here to simplify?

The problem is that TPL_RAM means that the ram driver is present, which isn't the same thing as actually doing the RAM init in that phase. If we had a Kconfig value for 'phase' then we could perhaps have CONFIG_PHASE_RAM=tpl or something like that.

Quoted 6 lines

Yes, we may need to add a new Kconfig symbol to more easily control where DRAM init happens.

I have been slowly working on unifying all Rockchip SoCs to use TPL for DRAM init and SPL for loading a FIT. All AArch64 should now follow this, and currently looking at migrating the older ARMv7 SoCs.

OK, that's fine, but note that SPL is where this is supposed to happen. What is the benefit of doing it earlier? From my understanding it was just to accommodate Rockchip's secret blobs?

Quoted 12 lines
Quoted 12 lines

I plan to get back
to my rejected XPL series soon and that is something I could incorporate when that goes in.

Quoted 6 lines

Basically we will have 3 possible DRAM init scenarios to support:
- ROCKCHIP_EXTERNA_TPL=y -> DRAM init happen in external TPL and SPL should only read DRAM size
- VPL=y or TPL=n -> both DRAM init and read DRAM size happen in SPL
- TPL=y -> DRAM init in TPL and SPL should only read DRAM size

Quoted 7 lines
Quoted 3 lines

Yes that's my understanding too. For the last one, for clarity:

- TPL=y -> DRAM init in TPL; SPL should only read DRAM size

Correct.

Regards,
SImon

Quoted 3 lines
Quoted 2 lines

[1] https://docs.u-boot.org/en/latest/develop/vbe.html#verified-boot-for-embedded-vbe

#13 lore raw

Re: [PATCH 05/29] rockchip: Allow RAM init to happen in SPL on rk3399

Hi Simon,

Quoted 33 lines · Simon Glass

Hi Jonas,

Quoted 20 lines · Jonas Karlman

Hi Simon,

Quoted 7 lines · Simon Glass

Hi Jonas,

Quoted 4 lines · Jonas Karlman

Hi Simon,

On 2025-02-05 02:54, Simon Glass wrote:

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

TPL runs before VPL. The earliest updatable phase with VBE is SPL. We want to be able to update the RAM-init code in the field.

If I understand your description here, you mean that both TPL and VPL are meant to be "burned" onto the board and not intended to be updatable?

Yes, that's right. If you look at [1] and click on 'vbe-intro' there is a diagram that shows the flow.

Quoted 7 lines

Thanks for the reference, I can see that both are listed as read-only. Unfortunately that do not explain why we need to have both TPL and VPL aside from it being two separate conceptual parts.

We can as easily just have BootROM load VPL and start from there, it does not look like TPL provides anything of real value for VBE on Rockchip, only one more part that can potentially fail?

It is partly conceptual, partly due to space.

Quoted 8 lines

TPL is about init setup and it is board-specific. VPL is a generic 'root-of-trust' thing which contains the ABrec logic. It is supposed to be generic and run on any supported board.

Some boards have very limited space for TPL, but can load a larger amount of code after that. There are quite a lot of x86 boards like that. Also, for rk3399 I was unable to fit all the TPL init and VPL logic into a single phase and still have room to load SPL.

For Rockchip RK3399 I do not really understand why it would not fit.

BootROM already does most init that is typically needed, and TPL probably only need to init iomux for debug uart and pinctrl for the storage media next phase is loaded from. Will be easier to understand once you have a series that can be applied :-)

Quoted 61 lines

As to combining them, I am sure it could be done, if there is enough SRAM. Perhaps that could be a build option?

If the MMC fails, we are not going to boot, so loading an extra phase is not a big problem, IMO.

Quoted 54 lines
Quoted 42 lines
Quoted 42 lines

Is this a typo or do I misunderstand something? Else I do not understand why you would need TPL->VPL->SPL, please explain.

Quoted 23 lines

So when VPL is being used, init the RAM later, in SPL.

---

 drivers/ram/rockchip/sdram_rk3399.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/ram/rockchip/sdram_rk3399.c +1 -0
index 6fa8f268770..9ac16dfdc71 100644
@@ -194,6 +194,7 @@ struct io_setting {
 static bool phase_sdram_init(void)
 {
      return xpl_phase() == PHASE_TPL ||
+             (IS_ENABLED(CONFIG_VPL) && xpl_phase() == PHASE_SPL) ||
              (!IS_ENABLED(CONFIG_TPL) &&
               !IS_ENABLED(CONFIG_ROCKCHIP_EXTERNAL_TPL) &&
               !not_xpl());
@@ -3195,8 +3196,9 @@ U_BOOT_DRIVER(dmc_rk3399) = {
      .of_to_plat = rk3399_dmc_of_to_plat,

drivers/ram/rockchip/sdram_rk3399.c U_BOOT_DRIVER(dmc_rk3399) = { · line 3204

Quoted 10 lines
drivers/ram/rockchip/sdram_rk3399.c +3 -2
      .probe = rk3399_dmc_probe,
      .priv_auto      = sizeof(struct dram_info),
-#if defined(CONFIG_TPL_BUILD) || \
-     (!defined(CONFIG_TPL) && defined(CONFIG_XPL_BUILD))
+#if defined(CONFIG_VPL) && defined(CONFIG_SPL_BUILD) || \
+     !defined(CONFIG_VPL) && defined(CONFIG_TPL_BUILD) || \
+     !defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD)
      .plat_auto      = sizeof(struct rockchip_dmc_plat),
 #endif
 };

These two conditions are starting to get ridiculous.

Quoted 8 lines
Quoted 3 lines

With "[PATCH 24/29] rockchip: Allow SPL to set up SDRAM" you are depending on TPL_RAM to decide if RAM should be initialized. Maybe that is something we can use here to simplify?

The problem is that TPL_RAM means that the ram driver is present, which isn't the same thing as actually doing the RAM init in that phase. If we had a Kconfig value for 'phase' then we could perhaps have CONFIG_PHASE_RAM=tpl or something like that.

Yes, we may need to add a new Kconfig symbol to more easily control where DRAM init happens.

Quoted 7 lines
Quoted 3 lines

I have been slowly working on unifying all Rockchip SoCs to use TPL for DRAM init and SPL for loading a FIT. All AArch64 should now follow this, and currently looking at migrating the older ARMv7 SoCs.

OK, that's fine, but note that SPL is where this is supposed to happen. What is the benefit of doing it earlier? From my understanding it was just to accommodate Rockchip's secret blobs?

It has nothing to do with accommodating Rockchip's secret blobs to my knowledge.

Most Rockchip SoCs have limited SRAM and initializing full DRAM is what needs to happen early, i.e. RK3036 have 8 KiB SRAM. Thanks to this SPL has full DRAM access and does not really have a size limit.

Theoretically you can have BootROM load full U-Boot proper as the next phase after the initial DRAM init phase. Not something that is really used, instead SPL is loaded to have more control over what is loaded next, i.e. falcon boot, EDK2, TF-A/OP-TEE and/or U-Boot proper.

Rockchip does provide DRAM init blobs that typically can be used as a stand in replacement for U-Boot TPL (DRAM init) in case there is no open-source implementation for the DRAM used on a board or SoC.

Regards,
Jonas

Quoted 27 lines
Quoted 13 lines
Quoted 13 lines

I plan to get back
to my rejected XPL series soon and that is something I could incorporate when that goes in.

Quoted 6 lines

Basically we will have 3 possible DRAM init scenarios to support:
- ROCKCHIP_EXTERNA_TPL=y -> DRAM init happen in external TPL and SPL should only read DRAM size
- VPL=y or TPL=n -> both DRAM init and read DRAM size happen in SPL
- TPL=y -> DRAM init in TPL and SPL should only read DRAM size

Quoted 7 lines
Quoted 3 lines

Yes that's my understanding too. For the last one, for clarity:

- TPL=y -> DRAM init in TPL; SPL should only read DRAM size

Correct.

Regards,
SImon

Quoted 3 lines
Quoted 2 lines

[1] https://docs.u-boot.org/en/latest/develop/vbe.html#verified-boot-for-embedded-vbe

#14 lore raw

Re: [PATCH 05/29] rockchip: Allow RAM init to happen in SPL on rk3399

Hi Jonas,

Quoted 41 lines · Jonas Karlman

Hi Simon,

Quoted 37 lines · Simon Glass

Hi Jonas,

Quoted 20 lines · Jonas Karlman

Hi Simon,

Quoted 7 lines · Simon Glass

Hi Jonas,

Quoted 4 lines · Jonas Karlman

Hi Simon,

On 2025-02-05 02:54, Simon Glass wrote:

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

TPL runs before VPL. The earliest updatable phase with VBE is SPL. We want to be able to update the RAM-init code in the field.

If I understand your description here, you mean that both TPL and VPL are meant to be "burned" onto the board and not intended to be updatable?

Yes, that's right. If you look at [1] and click on 'vbe-intro' there is a diagram that shows the flow.

Quoted 7 lines

Thanks for the reference, I can see that both are listed as read-only. Unfortunately that do not explain why we need to have both TPL and VPL aside from it being two separate conceptual parts.

We can as easily just have BootROM load VPL and start from there, it does not look like TPL provides anything of real value for VBE on Rockchip, only one more part that can potentially fail?

It is partly conceptual, partly due to space.

TPL is about init setup and it is board-specific. VPL is a generic 'root-of-trust' thing which contains the ABrec logic. It is supposed to be generic and run on any supported board.

Quoted 6 lines
Quoted 4 lines

Some boards have very limited space for TPL, but can load a larger amount of code after that. There are quite a lot of x86 boards like that. Also, for rk3399 I was unable to fit all the TPL init and VPL logic into a single phase and still have room to load SPL.

For Rockchip RK3399 I do not really understand why it would not fit.

Here are the margins at present. Loads of space going from TPL to VPL. From VPL to SPL it is a lot tighter. I'm pretty sure more things could be optimised, but there are also things I'd like to enable, like FIT signatures.

=> vbe state
Phases: TPL (margin 94ea) VPL (margin 2a9f) SPL

Quoted 5 lines

BootROM already does most init that is typically needed, and TPL probably only need to init iomux for debug uart and pinctrl for the storage media next phase is loaded from. Will be easier to understand once you have a series that can be applied :-)

Yes indeed. It has been so hard trying to get this all landed and there are so many things needed. Once it is applied and in the lab it will be easier to try things.

Quoted 73 lines
Quoted 62 lines

As to combining them, I am sure it could be done, if there is enough SRAM. Perhaps that could be a build option?

If the MMC fails, we are not going to boot, so loading an extra phase is not a big problem, IMO.

Quoted 54 lines
Quoted 42 lines
Quoted 42 lines

Is this a typo or do I misunderstand something? Else I do not understand why you would need TPL->VPL->SPL, please explain.

Quoted 23 lines

So when VPL is being used, init the RAM later, in SPL.

---

 drivers/ram/rockchip/sdram_rk3399.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/ram/rockchip/sdram_rk3399.c +1 -0
index 6fa8f268770..9ac16dfdc71 100644
@@ -194,6 +194,7 @@ struct io_setting {
 static bool phase_sdram_init(void)
 {
      return xpl_phase() == PHASE_TPL ||
+             (IS_ENABLED(CONFIG_VPL) && xpl_phase() == PHASE_SPL) ||
              (!IS_ENABLED(CONFIG_TPL) &&
               !IS_ENABLED(CONFIG_ROCKCHIP_EXTERNAL_TPL) &&
               !not_xpl());
@@ -3195,8 +3196,9 @@ U_BOOT_DRIVER(dmc_rk3399) = {
      .of_to_plat = rk3399_dmc_of_to_plat,

drivers/ram/rockchip/sdram_rk3399.c U_BOOT_DRIVER(dmc_rk3399) = { · line 3204

Quoted 10 lines
drivers/ram/rockchip/sdram_rk3399.c +3 -2
      .probe = rk3399_dmc_probe,
      .priv_auto      = sizeof(struct dram_info),
-#if defined(CONFIG_TPL_BUILD) || \
-     (!defined(CONFIG_TPL) && defined(CONFIG_XPL_BUILD))
+#if defined(CONFIG_VPL) && defined(CONFIG_SPL_BUILD) || \
+     !defined(CONFIG_VPL) && defined(CONFIG_TPL_BUILD) || \
+     !defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD)
      .plat_auto      = sizeof(struct rockchip_dmc_plat),
 #endif
 };

These two conditions are starting to get ridiculous.

Quoted 8 lines
Quoted 3 lines

With "[PATCH 24/29] rockchip: Allow SPL to set up SDRAM" you are depending on TPL_RAM to decide if RAM should be initialized. Maybe that is something we can use here to simplify?

The problem is that TPL_RAM means that the ram driver is present, which isn't the same thing as actually doing the RAM init in that phase. If we had a Kconfig value for 'phase' then we could perhaps have CONFIG_PHASE_RAM=tpl or something like that.

Yes, we may need to add a new Kconfig symbol to more easily control where DRAM init happens.

Quoted 7 lines
Quoted 3 lines

I have been slowly working on unifying all Rockchip SoCs to use TPL for DRAM init and SPL for loading a FIT. All AArch64 should now follow this, and currently looking at migrating the older ARMv7 SoCs.

OK, that's fine, but note that SPL is where this is supposed to happen. What is the benefit of doing it earlier? From my understanding it was just to accommodate Rockchip's secret blobs?

It has nothing to do with accommodating Rockchip's secret blobs to my knowledge.

Quoted 8 lines

Most Rockchip SoCs have limited SRAM and initializing full DRAM is what needs to happen early, i.e. RK3036 have 8 KiB SRAM. Thanks to this SPL has full DRAM access and does not really have a size limit.

Theoretically you can have BootROM load full U-Boot proper as the next phase after the initial DRAM init phase. Not something that is really used, instead SPL is loaded to have more control over what is loaded next, i.e. falcon boot, EDK2, TF-A/OP-TEE and/or U-Boot proper.

OK. So I wonder whether DRAM should be in SPL, for modern SoCs, then?

It would be nice if Rockchip could expose the MMC-reading code as a function table in the ROM, so we don't need to repeat the code in xPL.

Quoted 4 lines

Rockchip does provide DRAM init blobs that typically can be used as a stand in replacement for U-Boot TPL (DRAM init) in case there is no open-source implementation for the DRAM used on a board or SoC.

OK.

Regards,
Simon

Quoted 32 lines

Regards,
Jonas

Quoted 27 lines
Quoted 13 lines
Quoted 13 lines

I plan to get back
to my rejected XPL series soon and that is something I could incorporate when that goes in.

Quoted 6 lines

Basically we will have 3 possible DRAM init scenarios to support:
- ROCKCHIP_EXTERNA_TPL=y -> DRAM init happen in external TPL and SPL should only read DRAM size
- VPL=y or TPL=n -> both DRAM init and read DRAM size happen in SPL
- TPL=y -> DRAM init in TPL and SPL should only read DRAM size

Quoted 7 lines
Quoted 3 lines

Yes that's my understanding too. For the last one, for clarity:

- TPL=y -> DRAM init in TPL; SPL should only read DRAM size

Correct.

Regards,
SImon

Quoted 3 lines
Quoted 2 lines

[1] https://docs.u-boot.org/en/latest/develop/vbe.html#verified-boot-for-embedded-vbe

#15 lore raw

Re: [PATCH 05/29] rockchip: Allow RAM init to happen in SPL on rk3399

Hi Simon,

Quoted 146 lines · Simon Glass

Hi Jonas,

Quoted 41 lines · Jonas Karlman

Hi Simon,

Quoted 37 lines · Simon Glass

Hi Jonas,

Quoted 20 lines · Jonas Karlman

Hi Simon,

Quoted 7 lines · Simon Glass

Hi Jonas,

Quoted 4 lines · Jonas Karlman

Hi Simon,

On 2025-02-05 02:54, Simon Glass wrote:

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

TPL runs before VPL. The earliest updatable phase with VBE is SPL. We want to be able to update the RAM-init code in the field.

If I understand your description here, you mean that both TPL and VPL are meant to be "burned" onto the board and not intended to be updatable?

Yes, that's right. If you look at [1] and click on 'vbe-intro' there is a diagram that shows the flow.

Quoted 7 lines

Thanks for the reference, I can see that both are listed as read-only. Unfortunately that do not explain why we need to have both TPL and VPL aside from it being two separate conceptual parts.

We can as easily just have BootROM load VPL and start from there, it does not look like TPL provides anything of real value for VBE on Rockchip, only one more part that can potentially fail?

It is partly conceptual, partly due to space.

TPL is about init setup and it is board-specific. VPL is a generic 'root-of-trust' thing which contains the ABrec logic. It is supposed to be generic and run on any supported board.

Quoted 6 lines
Quoted 4 lines

Some boards have very limited space for TPL, but can load a larger amount of code after that. There are quite a lot of x86 boards like that. Also, for rk3399 I was unable to fit all the TPL init and VPL logic into a single phase and still have room to load SPL.

For Rockchip RK3399 I do not really understand why it would not fit.

Here are the margins at present. Loads of space going from TPL to VPL. From VPL to SPL it is a lot tighter. I'm pretty sure more things could be optimised, but there are also things I'd like to enable, like FIT signatures.

=> vbe state
Phases: TPL (margin 94ea) VPL (margin 2a9f) SPL

Quoted 5 lines

BootROM already does most init that is typically needed, and TPL probably only need to init iomux for debug uart and pinctrl for the storage media next phase is loaded from. Will be easier to understand once you have a series that can be applied :-)

Yes indeed. It has been so hard trying to get this all landed and there are so many things needed. Once it is applied and in the lab it will be easier to try things.

Quoted 77 lines
Quoted 62 lines

As to combining them, I am sure it could be done, if there is enough SRAM. Perhaps that could be a build option?

If the MMC fails, we are not going to boot, so loading an extra phase is not a big problem, IMO.

Quoted 54 lines
Quoted 42 lines
Quoted 42 lines

Is this a typo or do I misunderstand something? Else I do not understand why you would need TPL->VPL->SPL, please explain.

Quoted 23 lines

So when VPL is being used, init the RAM later, in SPL.

---

 drivers/ram/rockchip/sdram_rk3399.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/ram/rockchip/sdram_rk3399.c +1 -0
index 6fa8f268770..9ac16dfdc71 100644
@@ -194,6 +194,7 @@ struct io_setting {
 static bool phase_sdram_init(void)
 {
      return xpl_phase() == PHASE_TPL ||
+             (IS_ENABLED(CONFIG_VPL) && xpl_phase() == PHASE_SPL) ||
              (!IS_ENABLED(CONFIG_TPL) &&
               !IS_ENABLED(CONFIG_ROCKCHIP_EXTERNAL_TPL) &&
               !not_xpl());
@@ -3195,8 +3196,9 @@ U_BOOT_DRIVER(dmc_rk3399) = {
      .of_to_plat = rk3399_dmc_of_to_plat,

drivers/ram/rockchip/sdram_rk3399.c U_BOOT_DRIVER(dmc_rk3399) = { · line 3204

Quoted 10 lines
drivers/ram/rockchip/sdram_rk3399.c +3 -2
      .probe = rk3399_dmc_probe,
      .priv_auto      = sizeof(struct dram_info),
-#if defined(CONFIG_TPL_BUILD) || \
-     (!defined(CONFIG_TPL) && defined(CONFIG_XPL_BUILD))
+#if defined(CONFIG_VPL) && defined(CONFIG_SPL_BUILD) || \
+     !defined(CONFIG_VPL) && defined(CONFIG_TPL_BUILD) || \
+     !defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD)
      .plat_auto      = sizeof(struct rockchip_dmc_plat),
 #endif
 };

These two conditions are starting to get ridiculous.

Quoted 8 lines
Quoted 3 lines

With "[PATCH 24/29] rockchip: Allow SPL to set up SDRAM" you are depending on TPL_RAM to decide if RAM should be initialized. Maybe that is something we can use here to simplify?

The problem is that TPL_RAM means that the ram driver is present, which isn't the same thing as actually doing the RAM init in that phase. If we had a Kconfig value for 'phase' then we could perhaps have CONFIG_PHASE_RAM=tpl or something like that.

Yes, we may need to add a new Kconfig symbol to more easily control where DRAM init happens.

Quoted 7 lines
Quoted 3 lines

I have been slowly working on unifying all Rockchip SoCs to use TPL for DRAM init and SPL for loading a FIT. All AArch64 should now follow this, and currently looking at migrating the older ARMv7 SoCs.

OK, that's fine, but note that SPL is where this is supposed to happen. What is the benefit of doing it earlier? From my understanding it was just to accommodate Rockchip's secret blobs?

It has nothing to do with accommodating Rockchip's secret blobs to my knowledge.

Most Rockchip SoCs have limited SRAM and initializing full DRAM is what needs to happen early, i.e. RK3036 have 8 KiB SRAM. Thanks to this SPL has full DRAM access and does not really have a size limit.

Quoted 6 lines
Quoted 4 lines

Theoretically you can have BootROM load full U-Boot proper as the next phase after the initial DRAM init phase. Not something that is really used, instead SPL is loaded to have more control over what is loaded next, i.e. falcon boot, EDK2, TF-A/OP-TEE and/or U-Boot proper.

OK. So I wonder whether DRAM should be in SPL, for modern SoCs, then?

To be uniform across the Rockchip platform I would not recommend that.

It is also my understanding that LPDDR4/5 DRAM controller and training code is typically under strict NDA, and open-source options may be problematic. For now the modern SoCs must use vendor blobs to initialize and run training algorithms for DRAM. E.g. only option is to have a blob run before any part of open-source U-Boot can run.

Quoted 3 lines

It would be nice if Rockchip could expose the MMC-reading code as a function table in the ROM, so we don't need to repeat the code in xPL.

On modern RK35xx SoCs the BootROM can load and run up to 4 images using the back-to-brom method.

See my "rockchip: mkimage: Improve support for v2 image format" series at https://patchwork.ozlabs.org/cover/2040406/ that extend support for the 2 extra images supported by the v2 image format.

Regards,
Jonas

Quoted 43 lines
Quoted 5 lines

Rockchip does provide DRAM init blobs that typically can be used as a stand in replacement for U-Boot TPL (DRAM init) in case there is no open-source implementation for the DRAM used on a board or SoC.

OK.

Regards,
Simon

Quoted 32 lines

Regards,
Jonas

Quoted 27 lines
Quoted 13 lines
Quoted 13 lines

I plan to get back
to my rejected XPL series soon and that is something I could incorporate when that goes in.

Quoted 6 lines

Basically we will have 3 possible DRAM init scenarios to support:
- ROCKCHIP_EXTERNA_TPL=y -> DRAM init happen in external TPL and SPL should only read DRAM size
- VPL=y or TPL=n -> both DRAM init and read DRAM size happen in SPL
- TPL=y -> DRAM init in TPL and SPL should only read DRAM size

Quoted 7 lines
Quoted 3 lines

Yes that's my understanding too. For the last one, for clarity:

- TPL=y -> DRAM init in TPL; SPL should only read DRAM size

Correct.

Regards,
SImon

Quoted 3 lines
Quoted 2 lines

[1] https://docs.u-boot.org/en/latest/develop/vbe.html#verified-boot-for-embedded-vbe

#16 lore raw

Re: [PATCH 05/29] rockchip: Allow RAM init to happen in SPL on rk3399

Hi Jonas,

Quoted 157 lines · Jonas Karlman

Hi Simon,

Quoted 146 lines · Simon Glass

Hi Jonas,

Quoted 41 lines · Jonas Karlman

Hi Simon,

Quoted 37 lines · Simon Glass

Hi Jonas,

Quoted 20 lines · Jonas Karlman

Hi Simon,

Quoted 7 lines · Simon Glass

Hi Jonas,

Quoted 4 lines · Jonas Karlman

Hi Simon,

On 2025-02-05 02:54, Simon Glass wrote:

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

TPL runs before VPL. The earliest updatable phase with VBE is SPL. We want to be able to update the RAM-init code in the field.

If I understand your description here, you mean that both TPL and VPL are meant to be "burned" onto the board and not intended to be updatable?

Yes, that's right. If you look at [1] and click on 'vbe-intro' there is a diagram that shows the flow.

Quoted 7 lines

Thanks for the reference, I can see that both are listed as read-only. Unfortunately that do not explain why we need to have both TPL and VPL aside from it being two separate conceptual parts.

We can as easily just have BootROM load VPL and start from there, it does not look like TPL provides anything of real value for VBE on Rockchip, only one more part that can potentially fail?

It is partly conceptual, partly due to space.

TPL is about init setup and it is board-specific. VPL is a generic 'root-of-trust' thing which contains the ABrec logic. It is supposed to be generic and run on any supported board.

Quoted 6 lines
Quoted 4 lines

Some boards have very limited space for TPL, but can load a larger amount of code after that. There are quite a lot of x86 boards like that. Also, for rk3399 I was unable to fit all the TPL init and VPL logic into a single phase and still have room to load SPL.

For Rockchip RK3399 I do not really understand why it would not fit.

Here are the margins at present. Loads of space going from TPL to VPL. From VPL to SPL it is a lot tighter. I'm pretty sure more things could be optimised, but there are also things I'd like to enable, like FIT signatures.

=> vbe state
Phases: TPL (margin 94ea) VPL (margin 2a9f) SPL

Quoted 5 lines

BootROM already does most init that is typically needed, and TPL probably only need to init iomux for debug uart and pinctrl for the storage media next phase is loaded from. Will be easier to understand once you have a series that can be applied :-)

Yes indeed. It has been so hard trying to get this all landed and there are so many things needed. Once it is applied and in the lab it will be easier to try things.

Quoted 77 lines
Quoted 62 lines

As to combining them, I am sure it could be done, if there is enough SRAM. Perhaps that could be a build option?

If the MMC fails, we are not going to boot, so loading an extra phase is not a big problem, IMO.

Quoted 54 lines
Quoted 42 lines
Quoted 42 lines

Is this a typo or do I misunderstand something? Else I do not understand why you would need TPL->VPL->SPL, please explain.

Quoted 23 lines

So when VPL is being used, init the RAM later, in SPL.

---

 drivers/ram/rockchip/sdram_rk3399.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/ram/rockchip/sdram_rk3399.c +1 -0
index 6fa8f268770..9ac16dfdc71 100644
@@ -194,6 +194,7 @@ struct io_setting {
 static bool phase_sdram_init(void)
 {
      return xpl_phase() == PHASE_TPL ||
+             (IS_ENABLED(CONFIG_VPL) && xpl_phase() == PHASE_SPL) ||
              (!IS_ENABLED(CONFIG_TPL) &&
               !IS_ENABLED(CONFIG_ROCKCHIP_EXTERNAL_TPL) &&
               !not_xpl());
@@ -3195,8 +3196,9 @@ U_BOOT_DRIVER(dmc_rk3399) = {
      .of_to_plat = rk3399_dmc_of_to_plat,

drivers/ram/rockchip/sdram_rk3399.c U_BOOT_DRIVER(dmc_rk3399) = { · line 3204

Quoted 10 lines
drivers/ram/rockchip/sdram_rk3399.c +3 -2
      .probe = rk3399_dmc_probe,
      .priv_auto      = sizeof(struct dram_info),
-#if defined(CONFIG_TPL_BUILD) || \
-     (!defined(CONFIG_TPL) && defined(CONFIG_XPL_BUILD))
+#if defined(CONFIG_VPL) && defined(CONFIG_SPL_BUILD) || \
+     !defined(CONFIG_VPL) && defined(CONFIG_TPL_BUILD) || \
+     !defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD)
      .plat_auto      = sizeof(struct rockchip_dmc_plat),
 #endif
 };

These two conditions are starting to get ridiculous.

Quoted 8 lines
Quoted 3 lines

With "[PATCH 24/29] rockchip: Allow SPL to set up SDRAM" you are depending on TPL_RAM to decide if RAM should be initialized. Maybe that is something we can use here to simplify?

The problem is that TPL_RAM means that the ram driver is present, which isn't the same thing as actually doing the RAM init in that phase. If we had a Kconfig value for 'phase' then we could perhaps have CONFIG_PHASE_RAM=tpl or something like that.

Yes, we may need to add a new Kconfig symbol to more easily control where DRAM init happens.

Quoted 7 lines
Quoted 3 lines

I have been slowly working on unifying all Rockchip SoCs to use TPL for DRAM init and SPL for loading a FIT. All AArch64 should now follow this, and currently looking at migrating the older ARMv7 SoCs.

OK, that's fine, but note that SPL is where this is supposed to happen. What is the benefit of doing it earlier? From my understanding it was just to accommodate Rockchip's secret blobs?

It has nothing to do with accommodating Rockchip's secret blobs to my knowledge.

Most Rockchip SoCs have limited SRAM and initializing full DRAM is what needs to happen early, i.e. RK3036 have 8 KiB SRAM. Thanks to this SPL has full DRAM access and does not really have a size limit.

Quoted 6 lines
Quoted 4 lines

Theoretically you can have BootROM load full U-Boot proper as the next phase after the initial DRAM init phase. Not something that is really used, instead SPL is loaded to have more control over what is loaded next, i.e. falcon boot, EDK2, TF-A/OP-TEE and/or U-Boot proper.

OK. So I wonder whether DRAM should be in SPL, for modern SoCs, then?

Quoted 7 lines

To be uniform across the Rockchip platform I would not recommend that.

It is also my understanding that LPDDR4/5 DRAM controller and training code is typically under strict NDA, and open-source options may be problematic. For now the modern SoCs must use vendor blobs to initialize and run training algorithms for DRAM. E.g. only option is to have a blob run before any part of open-source U-Boot can run.

The problem with that is that we cannot do VBE, or any sort of pre-DRAM A/B selection unless we can run code before the controller is set up.

Quoted 7 lines
Quoted 4 lines

It would be nice if Rockchip could expose the MMC-reading code as a function table in the ROM, so we don't need to repeat the code in xPL.

On modern RK35xx SoCs the BootROM can load and run up to 4 images using the back-to-brom method.

Do you mean one at a time? I still would rather be able to call into the ROM.

Quoted 4 lines

See my "rockchip: mkimage: Improve support for v2 image format" series at https://patchwork.ozlabs.org/cover/2040406/ that extend support for the 2 extra images supported by the v2 image format.

OK.

Regards,
Simon

Quoted 48 lines

Regards,
Jonas

Quoted 43 lines
Quoted 5 lines

Rockchip does provide DRAM init blobs that typically can be used as a stand in replacement for U-Boot TPL (DRAM init) in case there is no open-source implementation for the DRAM used on a board or SoC.

OK.

Regards,
Simon

Quoted 32 lines

Regards,
Jonas

Quoted 27 lines
Quoted 13 lines
Quoted 13 lines

I plan to get back
to my rejected XPL series soon and that is something I could incorporate when that goes in.

Quoted 6 lines

Basically we will have 3 possible DRAM init scenarios to support:
- ROCKCHIP_EXTERNA_TPL=y -> DRAM init happen in external TPL and SPL should only read DRAM size
- VPL=y or TPL=n -> both DRAM init and read DRAM size happen in SPL
- TPL=y -> DRAM init in TPL and SPL should only read DRAM size

Quoted 7 lines
Quoted 3 lines

Yes that's my understanding too. For the last one, for clarity:

- TPL=y -> DRAM init in TPL; SPL should only read DRAM size

Correct.

Regards,
SImon

Quoted 3 lines
Quoted 2 lines

[1] https://docs.u-boot.org/en/latest/develop/vbe.html#verified-boot-for-embedded-vbe

#17 lore raw

Re: [PATCH 05/29] rockchip: Allow RAM init to happen in SPL on rk3399

In reply to Simon Glass
Quoted 60 lines · Simon Glass

Hi Jonas,

Quoted 9 lines · Jonas Karlman

Hi Simon,

Quoted 2 lines · Simon Glass

TPL runs before VPL. The earliest updatable phase with VBE is SPL. We want to be able to update the RAM-init code in the field.

If I understand your description here, you mean that both TPL and VPL are meant to be "burned" onto the board and not intended to be updatable?

Yes, that's right. If you look at [1] and click on 'vbe-intro' there is a diagram that shows the flow.

Quoted 40 lines

Is this a typo or do I misunderstand something? Else I do not understand why you would need TPL->VPL->SPL, please explain.

Quoted 23 lines

So when VPL is being used, init the RAM later, in SPL.

---

 drivers/ram/rockchip/sdram_rk3399.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/ram/rockchip/sdram_rk3399.c +1 -0
index 6fa8f268770..9ac16dfdc71 100644
@@ -194,6 +194,7 @@ struct io_setting {
 static bool phase_sdram_init(void)
 {
      return xpl_phase() == PHASE_TPL ||
+             (IS_ENABLED(CONFIG_VPL) && xpl_phase() == PHASE_SPL) ||
              (!IS_ENABLED(CONFIG_TPL) &&
               !IS_ENABLED(CONFIG_ROCKCHIP_EXTERNAL_TPL) &&
               !not_xpl());
@@ -3195,8 +3196,9 @@ U_BOOT_DRIVER(dmc_rk3399) = {
      .of_to_plat = rk3399_dmc_of_to_plat,

drivers/ram/rockchip/sdram_rk3399.c U_BOOT_DRIVER(dmc_rk3399) = { · line 3204

Quoted 10 lines
drivers/ram/rockchip/sdram_rk3399.c +3 -2
      .probe = rk3399_dmc_probe,
      .priv_auto      = sizeof(struct dram_info),
-#if defined(CONFIG_TPL_BUILD) || \
-     (!defined(CONFIG_TPL) && defined(CONFIG_XPL_BUILD))
+#if defined(CONFIG_VPL) && defined(CONFIG_SPL_BUILD) || \
+     !defined(CONFIG_VPL) && defined(CONFIG_TPL_BUILD) || \
+     !defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD)
      .plat_auto      = sizeof(struct rockchip_dmc_plat),
 #endif
 };

These two conditions are starting to get ridiculous.

Quoted 3 lines

With "[PATCH 24/29] rockchip: Allow SPL to set up SDRAM" you are depending on TPL_RAM to decide if RAM should be initialized. Maybe that is something we can use here to simplify?

Quoted 6 lines

The problem is that TPL_RAM means that the ram driver is present, which isn't the same thing as actually doing the RAM init in that phase. If we had a Kconfig value for 'phase' then we could perhaps have CONFIG_PHASE_RAM=tpl or something like that. I plan to get back to my rejected XPL series soon and that is something I could incorporate when that goes in.

Please note that if you're going to revisit the "XPL" series I rejected you need to do what I asked instead or there's just going to be a larger gap between mainline and your downstream fork.

Signature · 1 line
Tom
#18 lore raw

Re: [PATCH 05/29] rockchip: Allow RAM init to happen in SPL on rk3399

Hi Tom,

Quoted 69 lines · Tom Rini
Quoted 60 lines · Simon Glass

Hi Jonas,

Quoted 9 lines · Jonas Karlman

Hi Simon,

Quoted 2 lines · Simon Glass

TPL runs before VPL. The earliest updatable phase with VBE is SPL. We want to be able to update the RAM-init code in the field.

If I understand your description here, you mean that both TPL and VPL are meant to be "burned" onto the board and not intended to be updatable?

Yes, that's right. If you look at [1] and click on 'vbe-intro' there is a diagram that shows the flow.

Quoted 40 lines

Is this a typo or do I misunderstand something? Else I do not understand why you would need TPL->VPL->SPL, please explain.

Quoted 23 lines

So when VPL is being used, init the RAM later, in SPL.

---

 drivers/ram/rockchip/sdram_rk3399.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/ram/rockchip/sdram_rk3399.c +1 -0
index 6fa8f268770..9ac16dfdc71 100644
@@ -194,6 +194,7 @@ struct io_setting {
 static bool phase_sdram_init(void)
 {
      return xpl_phase() == PHASE_TPL ||
+             (IS_ENABLED(CONFIG_VPL) && xpl_phase() == PHASE_SPL) ||
              (!IS_ENABLED(CONFIG_TPL) &&
               !IS_ENABLED(CONFIG_ROCKCHIP_EXTERNAL_TPL) &&
               !not_xpl());
@@ -3195,8 +3196,9 @@ U_BOOT_DRIVER(dmc_rk3399) = {
      .of_to_plat = rk3399_dmc_of_to_plat,

drivers/ram/rockchip/sdram_rk3399.c U_BOOT_DRIVER(dmc_rk3399) = { · line 3204

Quoted 10 lines
drivers/ram/rockchip/sdram_rk3399.c +3 -2
      .probe = rk3399_dmc_probe,
      .priv_auto      = sizeof(struct dram_info),
-#if defined(CONFIG_TPL_BUILD) || \
-     (!defined(CONFIG_TPL) && defined(CONFIG_XPL_BUILD))
+#if defined(CONFIG_VPL) && defined(CONFIG_SPL_BUILD) || \
+     !defined(CONFIG_VPL) && defined(CONFIG_TPL_BUILD) || \
+     !defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD)
      .plat_auto      = sizeof(struct rockchip_dmc_plat),
 #endif
 };

These two conditions are starting to get ridiculous.

Quoted 3 lines

With "[PATCH 24/29] rockchip: Allow SPL to set up SDRAM" you are depending on TPL_RAM to decide if RAM should be initialized. Maybe that is something we can use here to simplify?

Quoted 6 lines

The problem is that TPL_RAM means that the ram driver is present, which isn't the same thing as actually doing the RAM init in that phase. If we had a Kconfig value for 'phase' then we could perhaps have CONFIG_PHASE_RAM=tpl or something like that. I plan to get back to my rejected XPL series soon and that is something I could incorporate when that goes in.

Quoted 3 lines

Please note that if you're going to revisit the "XPL" series I rejected you need to do what I asked instead or there's just going to be a larger gap between mainline and your downstream fork.

Yes I recall you wanted to completely separate the phases at the defconfig level, which I am not keen on. I will send a proposal and let's see if we can figure something out there.

Regards,
Simon

#19 lore raw

PATCH 6/29 rockchip: dts: Factor out arch and compression

In reply to Simon Glass

Declare these at the top of the file to avoid needing #ifdefs in every usage.

Add a few comments to help with the remaining #ifdefs

---

 arch/arm/dts/rockchip-u-boot.dtsi | 44 +++++++++++++++----------------
 1 file changed, 22 insertions(+), 22 deletions(-)
arch/arm/dts/rockchip-u-boot.dtsi +22 -22
index c8c928c7e50..8d6b2184f43 100644
@@ -5,6 +5,20 @@
 
 #include <config.h>
 
+#ifdef CONFIG_ARM64
+#define ARCH	"arm64"
+#else
+#define ARCH	"arm"
+#endif
+
+#if defined(CONFIG_SPL_GZIP)
+#define COMP	"gzip"
+#elif defined(CONFIG_SPL_LZMA)
+#define COMP	"lzma"
+#else
+#define COMP	"none"
+#endif
+
 / {
 	binman: binman {
 		multiple-images;
@@ -51,26 +65,12 @@
 					description = "U-Boot";
 					type = "standalone";
 					os = "U-Boot";
-#ifdef CONFIG_ARM64
-					arch = "arm64";
-#else
-					arch = "arm";
-#endif
-#if defined(CONFIG_SPL_GZIP)
-					compression = "gzip";
-#elif defined(CONFIG_SPL_LZMA)
-					compression = "lzma";
-#else
-					compression = "none";
-#endif
+					arch = ARCH;
+					compression = COMP;
 					load = <CONFIG_TEXT_BASE>;
 					entry = <CONFIG_TEXT_BASE>;
 					u-boot-nodtb {
-#if defined(CONFIG_SPL_GZIP)
-					compress = "gzip";
-#elif defined(CONFIG_SPL_LZMA)
-					compress = "lzma";
-#endif
+					compress = COMP;
 					};
 #ifdef CONFIG_SPL_FIT_SIGNATURE
 					hash {
@@ -84,7 +84,7 @@
 					fit,operation = "split-elf";
 					description = "ARM Trusted Firmware";
 					type = "firmware";
-					arch = "arm64";
+					arch = ARCH;
 					os = "arm-trusted-firmware";
 					compression = "none";
 					fit,load;
@@ -103,7 +103,7 @@
 					fit,operation = "split-elf";
 					description = "TEE";
 					type = "tee";
-					arch = "arm64";
+					arch = ARCH;
 					os = "tee";
 					compression = "none";
 					fit,load;
@@ -119,11 +119,11 @@
 					};
 #endif
 				};
-#else
+#else /* !CONFIG_ARM64 */
 				op-tee {
 					description = "OP-TEE";
 					type = "tee";
-					arch = "arm";
+					arch = ARCH;
 					os = "tee";
 					compression = "none";
 					load = <(CFG_SYS_SDRAM_BASE + 0x8400000)>;
@@ -137,7 +137,7 @@
 					};
 #endif
 				};
-#endif
+#endif /* CONFIG_ARM64 */
 
 				@fdt-SEQ {
 					description = "fdt-NAME";
Signature · 1 line
2.43.0
Reviewed-by on v1 6/29
#20 lore raw

Re: [PATCH 06/29] rockchip: dts: Factor out arch and compression

Hi Simon,

Quoted 6 lines · Simon Glass

Declare these at the top of the file to avoid needing #ifdefs in every usage.

Add a few comments to help with the remaining #ifdefs

This patch should happen after the os = "U-Boot" fix if they are part of same series, fixes before features/enhancements, with that:

Regards,
Jonas

Quoted 101 lines

---

 arch/arm/dts/rockchip-u-boot.dtsi | 44 +++++++++++++++----------------
 1 file changed, 22 insertions(+), 22 deletions(-)
arch/arm/dts/rockchip-u-boot.dtsi +22 -22
index c8c928c7e50..8d6b2184f43 100644
@@ -5,6 +5,20 @@
 
 #include <config.h>
 
+#ifdef CONFIG_ARM64
+#define ARCH	"arm64"
+#else
+#define ARCH	"arm"
+#endif
+
+#if defined(CONFIG_SPL_GZIP)
+#define COMP	"gzip"
+#elif defined(CONFIG_SPL_LZMA)
+#define COMP	"lzma"
+#else
+#define COMP	"none"
+#endif
+
 / {
 	binman: binman {
 		multiple-images;
@@ -51,26 +65,12 @@
 					description = "U-Boot";
 					type = "standalone";
 					os = "U-Boot";
-#ifdef CONFIG_ARM64
-					arch = "arm64";
-#else
-					arch = "arm";
-#endif
-#if defined(CONFIG_SPL_GZIP)
-					compression = "gzip";
-#elif defined(CONFIG_SPL_LZMA)
-					compression = "lzma";
-#else
-					compression = "none";
-#endif
+					arch = ARCH;
+					compression = COMP;
 					load = <CONFIG_TEXT_BASE>;
 					entry = <CONFIG_TEXT_BASE>;
 					u-boot-nodtb {
-#if defined(CONFIG_SPL_GZIP)
-					compress = "gzip";
-#elif defined(CONFIG_SPL_LZMA)
-					compress = "lzma";
-#endif
+					compress = COMP;
 					};
 #ifdef CONFIG_SPL_FIT_SIGNATURE
 					hash {
@@ -84,7 +84,7 @@
 					fit,operation = "split-elf";
 					description = "ARM Trusted Firmware";
 					type = "firmware";
-					arch = "arm64";
+					arch = ARCH;
 					os = "arm-trusted-firmware";
 					compression = "none";
 					fit,load;
@@ -103,7 +103,7 @@
 					fit,operation = "split-elf";
 					description = "TEE";
 					type = "tee";
-					arch = "arm64";
+					arch = ARCH;
 					os = "tee";
 					compression = "none";
 					fit,load;
@@ -119,11 +119,11 @@
 					};
 #endif
 				};
-#else
+#else /* !CONFIG_ARM64 */
 				op-tee {
 					description = "OP-TEE";
 					type = "tee";
-					arch = "arm";
+					arch = ARCH;
 					os = "tee";
 					compression = "none";
 					load = <(CFG_SYS_SDRAM_BASE + 0x8400000)>;
@@ -137,7 +137,7 @@
 					};
 #endif
 				};
-#endif
+#endif /* CONFIG_ARM64 */
 
 				@fdt-SEQ {
 					description = "fdt-NAME";
#21 lore raw

PATCH 7/29 rockchip: Add an fdtmap

In reply to Simon Glass

Add an fdtmap so it is possible to look at the image with 'binman ls'.

---

 arch/arm/dts/rockchip-u-boot.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/dts/rockchip-u-boot.dtsi +4 -0
index 8d6b2184f43..da0ac078cb6 100644
@@ -170,6 +170,8 @@
 			offset = <CONFIG_SPL_PAD_TO>;
 		};
 #endif
+		fdtmap {
+		};
 	};
 
 #ifdef CONFIG_ROCKCHIP_SPI_IMAGE
@@ -203,6 +205,8 @@
 			/* Sync with u-boot,spl-payload-offset if present */
 			offset = <CONFIG_SYS_SPI_U_BOOT_OFFS>;
 		};
+		fdtmap {
+		};
 	};
 #endif /* CONFIG_ROCKCHIP_SPI_IMAGE */
 };
Signature · 1 line
2.43.0
#22 lore raw

PATCH 8/29 rockchip: Add more space below the stack pointer with kevin

In reply to Simon Glass

Move this up higher on kevin and bob so we can accommodate a larger U-Boot, e.g. with debugging info enabled.

---

 configs/chromebook_bob_defconfig   | 2 +-
 configs/chromebook_kevin_defconfig | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
configs/chromebook_bob_defconfig +1 -1
index decac2e1935..2f08cff41e6 100644
@@ -7,7 +7,7 @@ CONFIG_TEXT_BASE=0x00200000
 CONFIG_SPL_GPIO=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x400000
 CONFIG_SF_DEFAULT_SPEED=20000000
 CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3399-gru-bob"
configs/chromebook_kevin_defconfig +1 -1
index 5bbea6c42a8..8959d397256 100644
@@ -7,7 +7,7 @@ CONFIG_TEXT_BASE=0x00200000
 CONFIG_SPL_GPIO=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x400000
 CONFIG_SF_DEFAULT_SPEED=20000000
 CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3399-gru-kevin"
Signature · 1 line
2.43.0
#23 lore raw

Re: [PATCH 08/29] rockchip: Add more space below the stack pointer with kevin

Hi Simon,

Quoted 2 lines · Simon Glass

Move this up higher on kevin and bob so we can accommodate a larger U-Boot, e.g. with debugging info enabled.

These targets have moved to use ROCKCHIP_COMMON_STACK_ADDR and now use a completely different CUSTOM_SYS_INIT_SP_ADDR, please rebase.

Regards,
Jonas

Quoted 34 lines

---

 configs/chromebook_bob_defconfig   | 2 +-
 configs/chromebook_kevin_defconfig | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
configs/chromebook_bob_defconfig +1 -1
index decac2e1935..2f08cff41e6 100644
@@ -7,7 +7,7 @@ CONFIG_TEXT_BASE=0x00200000
 CONFIG_SPL_GPIO=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x400000
 CONFIG_SF_DEFAULT_SPEED=20000000
 CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3399-gru-bob"
configs/chromebook_kevin_defconfig +1 -1
index 5bbea6c42a8..8959d397256 100644
@@ -7,7 +7,7 @@ CONFIG_TEXT_BASE=0x00200000
 CONFIG_SPL_GPIO=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x400000
 CONFIG_SF_DEFAULT_SPEED=20000000
 CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3399-gru-kevin"
#24 lore raw

PATCH 9/29 rockchip: dts: Create a template for the FIT

In reply to Simon Glass

Move the FIT description into a template so that it can (later) be used in multiple places in the image.

---

 arch/arm/dts/rockchip-u-boot.dtsi | 57 ++++++++++++++++++-------------
 1 file changed, 34 insertions(+), 23 deletions(-)
arch/arm/dts/rockchip-u-boot.dtsi +34 -23
index da0ac078cb6..8418635ed84 100644
@@ -19,6 +19,10 @@
 #define COMP	"none"
 #endif
 
+#if defined(CONFIG_SPL_FIT) && (defined(CONFIG_ARM64) || defined(CONFIG_SPL_OPTEE_IMAGE))
+#define HAS_FIT
+#endif
+
 / {
 	binman: binman {
 		multiple-images;
@@ -27,28 +31,9 @@
 
 #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";
-			multiple-data-files;
-
-#ifdef CONFIG_ROCKCHIP_EXTERNAL_TPL
-			rockchip-tpl {
-			};
-#elif defined(CONFIG_TPL)
-			u-boot-tpl {
-			};
-#endif
-			u-boot-spl {
-			};
-		};
-
-#if defined(CONFIG_SPL_FIT) && (defined(CONFIG_ARM64) || defined(CONFIG_SPL_OPTEE_IMAGE))
-		fit: fit {
+#ifdef HAS_FIT
+	common_part: template-1 {
+			type = "fit";
 #ifdef CONFIG_ARM64
 			description = "FIT image for U-Boot with bl31 (TF-A)";
 #else
@@ -59,7 +44,6 @@
 			filename = "u-boot.itb";
 			fit,external-offset = <CONFIG_FIT_EXTERNAL_OFFSET>;
 			fit,align = <512>;
-			offset = <CONFIG_SPL_PAD_TO>;
 			images {
 				u-boot {
 					description = "U-Boot";
@@ -164,6 +148,33 @@
 					fit,loadables;
 				};
 			};
+	};
+#endif /* HAS_FIT */
+
+	simple-bin {
+		filename = "u-boot-rockchip.bin";
+		pad-byte = <0xff>;
+
+		mkimage {
+			filename = "idbloader.img";
+			args = "-n", CONFIG_SYS_SOC, "-T", "rksd";
+			multiple-data-files;
+
+#ifdef CONFIG_ROCKCHIP_EXTERNAL_TPL
+			rockchip-tpl {
+			};
+#elif defined(CONFIG_TPL)
+			u-boot-tpl {
+			};
+#endif
+			u-boot-spl {
+			};
+		};
+
+#ifdef HAS_FIT
+		fit {
+			offset = <CONFIG_SPL_PAD_TO>;
+			insert-template = <&common_part>;
 		};
 #else
 		u-boot-img {
Signature · 1 line
2.43.0
#25 lore raw

Re: [PATCH 09/29] rockchip: dts: Create a template for the FIT

Hi Simon,

Quoted 88 lines · Simon Glass

Move the FIT description into a template so that it can (later) be used in multiple places in the image.

---

 arch/arm/dts/rockchip-u-boot.dtsi | 57 ++++++++++++++++++-------------
 1 file changed, 34 insertions(+), 23 deletions(-)
arch/arm/dts/rockchip-u-boot.dtsi +27 -23
index da0ac078cb6..8418635ed84 100644
@@ -19,6 +19,10 @@
 #define COMP	"none"
 #endif
 
+#if defined(CONFIG_SPL_FIT) && (defined(CONFIG_ARM64) || defined(CONFIG_SPL_OPTEE_IMAGE))
+#define HAS_FIT
+#endif
+
 / {
 	binman: binman {
 		multiple-images;
@@ -27,28 +31,9 @@
 
 #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";
-			multiple-data-files;
-
-#ifdef CONFIG_ROCKCHIP_EXTERNAL_TPL
-			rockchip-tpl {
-			};
-#elif defined(CONFIG_TPL)
-			u-boot-tpl {
-			};
-#endif
-			u-boot-spl {
-			};
-		};
-
-#if defined(CONFIG_SPL_FIT) && (defined(CONFIG_ARM64) || defined(CONFIG_SPL_OPTEE_IMAGE))
-		fit: fit {
+#ifdef HAS_FIT
+	common_part: template-1 {
+			type = "fit";
 #ifdef CONFIG_ARM64
 			description = "FIT image for U-Boot with bl31 (TF-A)";
 #else
@@ -59,7 +44,6 @@
 			filename = "u-boot.itb";
 			fit,external-offset = <CONFIG_FIT_EXTERNAL_OFFSET>;
 			fit,align = <512>;
-			offset = <CONFIG_SPL_PAD_TO>;
 			images {
 				u-boot {
 					description = "U-Boot";
@@ -164,6 +148,33 @@
 					fit,loadables;
 				};
 			};
+	};
+#endif /* HAS_FIT */
+
+	simple-bin {
+		filename = "u-boot-rockchip.bin";
+		pad-byte = <0xff>;
+
+		mkimage {
+			filename = "idbloader.img";
+			args = "-n", CONFIG_SYS_SOC, "-T", "rksd";
+			multiple-data-files;
+
+#ifdef CONFIG_ROCKCHIP_EXTERNAL_TPL
+			rockchip-tpl {
+			};
+#elif defined(CONFIG_TPL)
+			u-boot-tpl {
+			};
+#endif
+			u-boot-spl {

arch/arm/dts/rockchip-u-boot.dtsi line 180

Quoted 10 lines
arch/arm/dts/rockchip-u-boot.dtsi +7 -0
+			};
+		};
+
+#ifdef HAS_FIT
+		fit {
+			offset = <CONFIG_SPL_PAD_TO>;
+			insert-template = <&common_part>;
 		};
 #else
 		u-boot-img {

This looks fine in theory, but we should probably also fix the possible abuse of following in simple-bin-spi and rk3399-u-boot.dtsi rom images.

  fit {
  	type = "blob";
  	filename = "u-boot.itb";
  };

Regards,
Jonas

#26 lore raw

PATCH 10/29 rockchip: dts: Un-indent the FIT template

In reply to Simon Glass

Fix the indentation on the template. This is done in a separate patch so that it is easier to review.

---

 arch/arm/dts/rockchip-u-boot.dtsi | 178 +++++++++++++++---------------
 1 file changed, 89 insertions(+), 89 deletions(-)
arch/arm/dts/rockchip-u-boot.dtsi +89 -89
index 8418635ed84..4cf7c49a74c 100644
@@ -33,121 +33,121 @@
 &binman {
 #ifdef HAS_FIT
 	common_part: template-1 {
-			type = "fit";
+		type = "fit";
 #ifdef CONFIG_ARM64
-			description = "FIT image for U-Boot with bl31 (TF-A)";
+		description = "FIT image for U-Boot with bl31 (TF-A)";
 #else
-			description = "FIT image with OP-TEE";
+		description = "FIT image with OP-TEE";
 #endif
-			#address-cells = <1>;
-			fit,fdt-list = "of-list";
-			filename = "u-boot.itb";
-			fit,external-offset = <CONFIG_FIT_EXTERNAL_OFFSET>;
-			fit,align = <512>;
-			images {
-				u-boot {
-					description = "U-Boot";
-					type = "standalone";
-					os = "U-Boot";
-					arch = ARCH;
-					compression = COMP;
-					load = <CONFIG_TEXT_BASE>;
-					entry = <CONFIG_TEXT_BASE>;
-					u-boot-nodtb {
+		#address-cells = <1>;
+		fit,fdt-list = "of-list";
+		filename = "u-boot.itb";
+		fit,external-offset = <CONFIG_FIT_EXTERNAL_OFFSET>;
+		fit,align = <512>;
+		images {
+			u-boot {
+				description = "U-Boot";
+				type = "standalone";
+				os = "U-Boot";
+				arch = ARCH;
+				compression = COMP;
+				load = <CONFIG_TEXT_BASE>;
+				entry = <CONFIG_TEXT_BASE>;
+				u-boot-nodtb {
 					compress = COMP;
-					};
+				};
 #ifdef CONFIG_SPL_FIT_SIGNATURE
-					hash {
-						algo = "sha256";
-					};
-#endif
+				hash {
+					algo = "sha256";
 				};
+#endif
+			};
 
 #ifdef CONFIG_ARM64
-				@atf-SEQ {
-					fit,operation = "split-elf";
-					description = "ARM Trusted Firmware";
-					type = "firmware";
-					arch = ARCH;
-					os = "arm-trusted-firmware";
-					compression = "none";
-					fit,load;
-					fit,entry;
-					fit,data;
-
-					atf-bl31 {
-					};
+			@atf-SEQ {
+				fit,operation = "split-elf";
+				description = "ARM Trusted Firmware";
+				type = "firmware";
+				arch = ARCH;
+				os = "arm-trusted-firmware";
+				compression = "none";
+				fit,load;
+				fit,entry;
+				fit,data;
+
+				atf-bl31 {
+				};
 #ifdef CONFIG_SPL_FIT_SIGNATURE
-					hash {
-						algo = "sha256";
-					};
+				hash {
+					algo = "sha256";
+				};
 #endif
+			};
+			@tee-SEQ {
+				fit,operation = "split-elf";
+				description = "TEE";
+				type = "tee";
+				arch = ARCH;
+				os = "tee";
+				compression = "none";
+				fit,load;
+				fit,entry;
+				fit,data;
+
+				tee-os {
+					optional;
 				};
-				@tee-SEQ {
-					fit,operation = "split-elf";
-					description = "TEE";
-					type = "tee";
-					arch = ARCH;
-					os = "tee";
-					compression = "none";
-					fit,load;
-					fit,entry;
-					fit,data;
-
-					tee-os {
-						optional;
-					};
 #ifdef CONFIG_SPL_FIT_SIGNATURE
-					hash {
-						algo = "sha256";
-					};
-#endif
+				hash {
+					algo = "sha256";
 				};
+#endif
+			};
 #else /* !CONFIG_ARM64 */
-				op-tee {
-					description = "OP-TEE";
-					type = "tee";
-					arch = ARCH;
-					os = "tee";
-					compression = "none";
-					load = <(CFG_SYS_SDRAM_BASE + 0x8400000)>;
-					entry = <(CFG_SYS_SDRAM_BASE + 0x8400000)>;
-
-					tee-os {
-					};
+			op-tee {
+				description = "OP-TEE";
+				type = "tee";
+				arch = ARCH;
+				os = "tee";
+				compression = "none";
+				load = <(CFG_SYS_SDRAM_BASE + 0x8400000)>;
+				entry = <(CFG_SYS_SDRAM_BASE + 0x8400000)>;
+
+				tee-os {
+				};
 #ifdef CONFIG_SPL_FIT_SIGNATURE
-					hash {
-						algo = "sha256";
-					};
-#endif
+				hash {
+					algo = "sha256";
 				};
+#endif
+			};
 #endif /* CONFIG_ARM64 */
 
-				@fdt-SEQ {
-					description = "fdt-NAME";
-					compression = "none";
-					type = "flat_dt";
+			@fdt-SEQ {
+				description = "fdt-NAME";
+				compression = "none";
+				type = "flat_dt";
 #ifdef CONFIG_SPL_FIT_SIGNATURE
-					hash {
-						algo = "sha256";
-					};
-#endif
+				hash {
+					algo = "sha256";
 				};
+#endif
 			};
+		};
 
-			configurations {
-				default = "@config-DEFAULT-SEQ";
-				@config-SEQ {
-					description = "NAME.dtb";
-					fdt = "fdt-SEQ";
+		configurations {
+			default = "@config-DEFAULT-SEQ";
+			@config-SEQ {
+				description = "NAME.dtb";
+				fdt = "fdt-SEQ";
 #ifdef CONFIG_ARM64
-					fit,firmware = "atf-1", "u-boot";
+				fit,firmware = "atf-1", "u-boot";
 #else
-					fit,firmware = "op-tee", "u-boot";
+				fit,firmware = "op-tee", "u-boot";
 #endif
-					fit,loadables;
-				};
+				fit,loadables;
 			};
+		};
 	};
 #endif /* HAS_FIT */
 
Signature · 1 line
2.43.0
#27 lore raw

PATCH 11/29 rockchip: dts: Correct the OS for U-Boot

In reply to Simon Glass

The U-Boot section is currently getting an invalid OS. Use the correct value to fix this.

---

 arch/arm/dts/rockchip-u-boot.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/dts/rockchip-u-boot.dtsi +1 -1
index 4cf7c49a74c..281119a53d3 100644
@@ -48,7 +48,7 @@
 			u-boot {
 				description = "U-Boot";
 				type = "standalone";
-				os = "U-Boot";
+				os = "u-boot";
 				arch = ARCH;
 				compression = COMP;
 				load = <CONFIG_TEXT_BASE>;
Signature · 1 line
2.43.0
Reviewed-by on v1 11/29
#28 lore raw

Re: [PATCH 11/29] rockchip: dts: Correct the OS for U-Boot

Hi Simon,

Quoted 4 lines · Simon Glass

The U-Boot section is currently getting an invalid OS. Use the correct value to fix this.

This should happen earlier in the series or as a standalone fix, with that fixed this is:

Regards,
Jonas

Quoted 18 lines

---

 arch/arm/dts/rockchip-u-boot.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/dts/rockchip-u-boot.dtsi +1 -1
index 4cf7c49a74c..281119a53d3 100644
@@ -48,7 +48,7 @@
 			u-boot {
 				description = "U-Boot";
 				type = "standalone";
-				os = "U-Boot";
+				os = "u-boot";
 				arch = ARCH;
 				compression = COMP;
 				load = <CONFIG_TEXT_BASE>;
#29 lore raw

PATCH 12/29 rockchip: Specify the phase in the image

In reply to Simon Glass

Add 'u-boot' as the phase for the images intended for use with U-Boot proper.

---

 arch/arm/dts/rockchip-u-boot.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/dts/rockchip-u-boot.dtsi +4 -0
index 281119a53d3..8c6e62398a4 100644
@@ -53,6 +53,7 @@
 				compression = COMP;
 				load = <CONFIG_TEXT_BASE>;
 				entry = <CONFIG_TEXT_BASE>;
+				phase = "u-boot";
 				u-boot-nodtb {
 					compress = COMP;
 				};
@@ -71,6 +72,7 @@
 				arch = ARCH;
 				os = "arm-trusted-firmware";
 				compression = "none";
+				phase = "u-boot";
 				fit,load;
 				fit,entry;
 				fit,data;
@@ -90,6 +92,7 @@
 				arch = ARCH;
 				os = "tee";
 				compression = "none";
+				phase = "u-boot";
 				fit,load;
 				fit,entry;
 				fit,data;
@@ -112,6 +115,7 @@
 				compression = "none";
 				load = <(CFG_SYS_SDRAM_BASE + 0x8400000)>;
 				entry = <(CFG_SYS_SDRAM_BASE + 0x8400000)>;
+				phase = "u-boot";
 
 				tee-os {
 				};
Signature · 1 line
2.43.0
#30 lore raw

PATCH 13/29 rockchip: Provide a bootstd configuration

In reply to Simon Glass

Add bootstd information for VBE.

---

 arch/arm/dts/rockchip-u-boot.dtsi | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
arch/arm/dts/rockchip-u-boot.dtsi +27 -0
index 8c6e62398a4..7cce213c32e 100644
@@ -27,6 +27,33 @@
 	binman: binman {
 		multiple-images;
 	};
+
+#ifdef CONFIG_VPL
+	bootstd {
+		bootph-verify;
+		compatible = "u-boot,boot-std";
+
+		/*
+		 * This is used for the VBE OS-request tests. A FAT filesystem
+		 * created in a partition with the VBE information appearing
+		 * before the partition starts.
+		 *
+		 * Offsets are aligned to the media block-size, typically 0x200
+		 */
+		firmware0 {
+			bootph-verify;
+			compatible = "fwupd,vbe-simple";
+			storage = "mmc0";
+			skip-offset = <0x8000>;
+			area-start = <CONFIG_SPL_PAD_TO>;
+			area-size = <0x800000>;
+			state-offset = <(CONFIG_SPL_PAD_TO - 0x400)>;
+			state-size = <0x40>;
+			version-offset = <(CONFIG_SPL_PAD_TO - 0x200)>;
+			version-size = <0x100>;
+		};
+	};
+#endif
 };
 
 #ifdef CONFIG_SPL
Signature · 1 line
2.43.0
#31 lore raw

PATCH 14/29 rockchip: Add SPL into the main FIT

In reply to Simon Glass

VBE may want to load the SPL image from the same FIT as contains U-Boot, if there is enough memory, so add it.

---

 arch/arm/dts/rockchip-u-boot.dtsi | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
arch/arm/dts/rockchip-u-boot.dtsi +23 -0
index 7cce213c32e..39908495894 100644
@@ -72,6 +72,25 @@
 		fit,external-offset = <CONFIG_FIT_EXTERNAL_OFFSET>;
 		fit,align = <512>;
 		images {
+#ifdef CONFIG_VPL
+			spl {
+				description = "U-Boot SPL";
+				type = "firmware";
+				os = "u-boot";
+				arch = ARCH;
+				compression = "lz4";
+				load = <CONFIG_SPL_TEXT_BASE>;
+				entry = <CONFIG_SPL_TEXT_BASE>;
+				phase = "spl";
+				section {
+					compress = "lz4";
+					u-boot-spl-nodtb {
+					};
+					u-boot-spl-bss-pad {
+					};
+				};
+			};
+#endif /* VPL */
 			u-boot {
 				description = "U-Boot";
 				type = "standalone";
@@ -172,7 +191,11 @@
 				description = "NAME.dtb";
 				fdt = "fdt-SEQ";
 #ifdef CONFIG_ARM64
+# ifdef CONFIG_VPL
+				fit,firmware = "atf-1", "u-boot", "spl";
+# else
 				fit,firmware = "atf-1", "u-boot";
+# endif
 #else
 				fit,firmware = "op-tee", "u-boot";
 #endif
Signature · 1 line
2.43.0
#32 lore raw

Re: [PATCH 14/29] rockchip: Add SPL into the main FIT

Hi Simon,

Quoted 14 lines · Simon Glass

VBE may want to load the SPL image from the same FIT as contains U-Boot, if there is enough memory, so add it.

---

 arch/arm/dts/rockchip-u-boot.dtsi | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
arch/arm/dts/rockchip-u-boot.dtsi +0 -0
index 7cce213c32e..39908495894 100644

arch/arm/dts/rockchip-u-boot.dtsi line 75

Quoted 4 lines
arch/arm/dts/rockchip-u-boot.dtsi +1 -0
@@ -72,6 +72,25 @@
 		fit,external-offset = <CONFIG_FIT_EXTERNAL_OFFSET>;
 		fit,align = <512>;
 		images {
+#ifdef CONFIG_VPL

Is VPL intended to be exclusive to VBE? This (and others) should possible test for another Kconfig symbol?

Quoted 7 lines
arch/arm/dts/rockchip-u-boot.dtsi +7 -0
+			spl {
+				description = "U-Boot SPL";
+				type = "firmware";
+				os = "u-boot";
+				arch = ARCH;
+				compression = "lz4";
+				load = <CONFIG_SPL_TEXT_BASE>;

arch/arm/dts/rockchip-u-boot.dtsi line 92

Quoted 10 lines
arch/arm/dts/rockchip-u-boot.dtsi +10 -0
+				entry = <CONFIG_SPL_TEXT_BASE>;
+				phase = "spl";
+				section {
+					compress = "lz4";
+					u-boot-spl-nodtb {
+					};
+					u-boot-spl-bss-pad {
+					};
+				};
+			};

Is this spl part really used for anything? Later you are adding a spl template and using that for other vbe parts, it is not clear for what or when this is intended to be used.

Regards,
Jonas

Quoted 16 lines
arch/arm/dts/rockchip-u-boot.dtsi +5 -0
+#endif /* VPL */
 			u-boot {
 				description = "U-Boot";
 				type = "standalone";
@@ -172,7 +191,11 @@
 				description = "NAME.dtb";
 				fdt = "fdt-SEQ";
 #ifdef CONFIG_ARM64
+# ifdef CONFIG_VPL
+				fit,firmware = "atf-1", "u-boot", "spl";
+# else
 				fit,firmware = "atf-1", "u-boot";
+# endif
 #else
 				fit,firmware = "op-tee", "u-boot";
 #endif
#33 lore raw

Re: [PATCH 14/29] rockchip: Add SPL into the main FIT

Hi Jonas,

Quoted 13 lines · Jonas Karlman

Hi Simon,

Quoted 9 lines · Simon Glass

VBE may want to load the SPL image from the same FIT as contains U-Boot, if there is enough memory, so add it.

---

 arch/arm/dts/rockchip-u-boot.dtsi | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
Quoted 12 lines

arch/arm/dts/rockchip-u-boot.dtsi line 75

Quoted 9 lines
arch/arm/dts/rockchip-u-boot.dtsi +1 -0
index 7cce213c32e..39908495894 100644
@@ -72,6 +72,25 @@
              fit,external-offset = <CONFIG_FIT_EXTERNAL_OFFSET>;
              fit,align = <512>;
              images {
+#ifdef CONFIG_VPL

Is VPL intended to be exclusive to VBE? This (and others) should possible test for another Kconfig symbol?

For now, yes. In the unlikely event that EFI adopts earlier update, we could look at what else to do.

Quoted 19 lines
Quoted 8 lines
arch/arm/dts/rockchip-u-boot.dtsi +7 -0
+                     spl {
+                             description = "U-Boot SPL";
+                             type = "firmware";
+                             os = "u-boot";
+                             arch = ARCH;
+                             compression = "lz4";
+                             load = <CONFIG_SPL_TEXT_BASE>;

arch/arm/dts/rockchip-u-boot.dtsi line 92

Quoted 10 lines
arch/arm/dts/rockchip-u-boot.dtsi +10 -0
+                             entry = <CONFIG_SPL_TEXT_BASE>;
+                             phase = "spl";
+                             section {
+                                     compress = "lz4";
+                                     u-boot-spl-nodtb {
+                                     };
+                                     u-boot-spl-bss-pad {
+                                     };
+                             };
+                     };
Quoted 3 lines

Is this spl part really used for anything? Later you are adding a spl template and using that for other vbe parts, it is not clear for what or when this is intended to be used.

No, it isn't used, but only due to SRAM-size limitations. I suspect with the RK3288 we can use it. I left it in so that it is clear that the phase selected by the code, not which FIT is loaded.

Quoted 4 lines

Regards,
Jonas

Quoted 17 lines
Quoted 6 lines
arch/arm/dts/rockchip-u-boot.dtsi +1 -0
+#endif /* VPL */
                      u-boot {
                              description = "U-Boot";
                              type = "standalone";
@@ -172,7 +191,11 @@
                              description = "NAME.dtb";

arch/arm/dts/rockchip-u-boot.dtsi line 201

Quoted 10 lines
arch/arm/dts/rockchip-u-boot.dtsi +4 -0
                              fdt = "fdt-SEQ";
 #ifdef CONFIG_ARM64
+# ifdef CONFIG_VPL
+                             fit,firmware = "atf-1", "u-boot", "spl";
+# else
                              fit,firmware = "atf-1", "u-boot";
+# endif
 #else
                              fit,firmware = "op-tee", "u-boot";
 #endif

Regards,
Simon

#34 lore raw

PATCH 15/29 rockchip: Include a compatible string in each configuration

In reply to Simon Glass

Provide a compatible string so that U-Boot can decide which configuration to use.

---

 arch/arm/dts/rockchip-u-boot.dtsi | 1 +
 1 file changed, 1 insertion(+)
arch/arm/dts/rockchip-u-boot.dtsi +1 -0
index 39908495894..67cb2c3d165 100644
@@ -200,6 +200,7 @@
 				fit,firmware = "op-tee", "u-boot";
 #endif
 				fit,loadables;
+				fit,compatible;
 			};
 		};
 	};
Signature · 1 line
2.43.0
#35 lore raw

PATCH 16/29 rockchip: Set the skip-at-start property correctly

In reply to Simon Glass

The rockchip image is written to the media at block 64, which is a 32K offset, so set the skip-at-start property to 0x8000

Update CONFIG_SPL_PAD_TO to point to the offset in the image, since Binman is dealing with the 'missing' 32K now.

---

 arch/arm/dts/rockchip-u-boot.dtsi             | 2 ++
 configs/anbernic-rgxx3-rk3566_defconfig       | 2 +-
 configs/bpi-r2-pro-rk3568_defconfig           | 2 +-
 configs/chromebit_mickey_defconfig            | 2 +-
 configs/chromebook_bob_defconfig              | 2 +-
 configs/chromebook_jerry_defconfig            | 2 +-
 configs/chromebook_kevin_defconfig            | 2 +-
 configs/chromebook_minnie_defconfig           | 2 +-
 configs/chromebook_speedy_defconfig           | 2 +-
 configs/cm3588-nas-rk3588_defconfig           | 2 +-
 configs/coolpi-4b-rk3588s_defconfig           | 2 +-
 configs/coolpi-cm5-evb-rk3588_defconfig       | 2 +-
 configs/coolpi-cm5-genbook-rk3588_defconfig   | 2 +-
 configs/eaidk-610-rk3399_defconfig            | 2 +-
 configs/evb-px30_defconfig                    | 2 +-
 configs/evb-px5_defconfig                     | 2 +-
 configs/evb-rk3036_defconfig                  | 2 +-
 configs/evb-rk3229_defconfig                  | 2 +-
 configs/evb-rk3288_defconfig                  | 2 +-
 configs/evb-rk3308_defconfig                  | 2 +-
 configs/evb-rk3328_defconfig                  | 2 +-
 configs/evb-rk3399_defconfig                  | 2 +-
 configs/evb-rk3568_defconfig                  | 2 +-
 configs/evb-rk3588_defconfig                  | 2 +-
 configs/ficus-rk3399_defconfig                | 2 +-
 configs/firefly-px30_defconfig                | 2 +-
 configs/firefly-rk3288_defconfig              | 2 +-
 configs/firefly-rk3399_defconfig              | 2 +-
 configs/generic-rk3568_defconfig              | 2 +-
 configs/generic-rk3588_defconfig              | 2 +-
 configs/jaguar-rk3588_defconfig               | 2 +-
 configs/khadas-edge-captain-rk3399_defconfig  | 2 +-
 configs/khadas-edge-rk3399_defconfig          | 2 +-
 configs/khadas-edge-v-rk3399_defconfig        | 2 +-
 configs/kylin-rk3036_defconfig                | 2 +-
 configs/leez-rk3399_defconfig                 | 2 +-
 configs/lubancat-2-rk3568_defconfig           | 2 +-
 configs/miqi-rk3288_defconfig                 | 2 +-
 configs/mk808_defconfig                       | 2 +-
 configs/nanopc-t4-rk3399_defconfig            | 2 +-
 configs/nanopc-t6-rk3588_defconfig            | 2 +-
 configs/nanopi-m4-2gb-rk3399_defconfig        | 2 +-
 configs/nanopi-m4-rk3399_defconfig            | 2 +-
 configs/nanopi-m4b-rk3399_defconfig           | 2 +-
 configs/nanopi-neo4-rk3399_defconfig          | 2 +-
 configs/nanopi-r2c-plus-rk3328_defconfig      | 2 +-
 configs/nanopi-r2c-rk3328_defconfig           | 2 +-
 configs/nanopi-r2s-plus-rk3328_defconfig      | 2 +-
 configs/nanopi-r2s-rk3328_defconfig           | 2 +-
 configs/nanopi-r4s-rk3399_defconfig           | 2 +-
 configs/nanopi-r5c-rk3568_defconfig           | 2 +-
 configs/nanopi-r5s-rk3568_defconfig           | 2 +-
 configs/nanopi-r6c-rk3588s_defconfig          | 2 +-
 configs/nanopi-r6s-rk3588s_defconfig          | 2 +-
 configs/neu2-io-rv1126_defconfig              | 2 +-
 configs/neu6a-io-rk3588_defconfig             | 2 +-
 configs/neu6b-io-rk3588_defconfig             | 2 +-
 configs/nova-rk3588s_defconfig                | 2 +-
 configs/odroid-go2_defconfig                  | 2 +-
 configs/odroid-m1-rk3568_defconfig            | 2 +-
 configs/odroid-m1s-rk3566_defconfig           | 2 +-
 configs/odroid-m2-rk3588s_defconfig           | 2 +-
 configs/orangepi-3b-rk3566_defconfig          | 2 +-
 configs/orangepi-5-plus-rk3588_defconfig      | 2 +-
 configs/orangepi-5-rk3588s_defconfig          | 2 +-
 configs/orangepi-r1-plus-lts-rk3328_defconfig | 2 +-
 configs/orangepi-r1-plus-rk3328_defconfig     | 2 +-
 configs/orangepi-rk3399_defconfig             | 2 +-
 configs/phycore-rk3288_defconfig              | 2 +-
 configs/pinebook-pro-rk3399_defconfig         | 2 +-
 configs/pinephone-pro-rk3399_defconfig        | 2 +-
 configs/pinetab2-rk3566_defconfig             | 2 +-
 configs/popmetal-rk3288_defconfig             | 2 +-
 configs/powkiddy-x55-rk3566_defconfig         | 2 +-
 configs/puma-rk3399_defconfig                 | 2 +-
 configs/px30-core-ctouch2-of10-px30_defconfig | 2 +-
 configs/px30-core-ctouch2-px30_defconfig      | 2 +-
 configs/px30-core-edimm2.2-px30_defconfig     | 2 +-
 configs/qnap-ts433-rk3568_defconfig           | 2 +-
 configs/quartz64-a-rk3566_defconfig           | 2 +-
 configs/quartz64-b-rk3566_defconfig           | 2 +-
 configs/quartzpro64-rk3588_defconfig          | 2 +-
 configs/radxa-cm3-io-rk3566_defconfig         | 2 +-
 configs/radxa-e25-rk3568_defconfig            | 2 +-
 configs/radxa-zero-3-rk3566_defconfig         | 2 +-
 configs/roc-cc-rk3308_defconfig               | 2 +-
 configs/roc-cc-rk3328_defconfig               | 2 +-
 configs/roc-pc-mezzanine-rk3399_defconfig     | 2 +-
 configs/roc-pc-rk3399_defconfig               | 2 +-
 configs/rock-3a-rk3568_defconfig              | 2 +-
 configs/rock-3b-rk3568_defconfig              | 2 +-
 configs/rock-3c-rk3566_defconfig              | 2 +-
 configs/rock-4c-plus-rk3399_defconfig         | 2 +-
 configs/rock-4se-rk3399_defconfig             | 2 +-
 configs/rock-5-itx-rk3588_defconfig           | 2 +-
 configs/rock-pi-4-rk3399_defconfig            | 2 +-
 configs/rock-pi-4c-rk3399_defconfig           | 2 +-
 configs/rock-pi-e-rk3328_defconfig            | 2 +-
 configs/rock-pi-e-v3-rk3328_defconfig         | 2 +-
 configs/rock-pi-n10-rk3399pro_defconfig       | 2 +-
 configs/rock-pi-n8-rk3288_defconfig           | 2 +-
 configs/rock-pi-s-rk3308_defconfig            | 2 +-
 configs/rock-s0-rk3308_defconfig              | 2 +-
 configs/rock2_defconfig                       | 2 +-
 configs/rock5a-rk3588s_defconfig              | 2 +-
 configs/rock5b-rk3588_defconfig               | 2 +-
 configs/rock64-rk3328_defconfig               | 2 +-
 configs/rock960-rk3399_defconfig              | 2 +-
 configs/rock_defconfig                        | 2 +-
 configs/rockpro64-rk3399_defconfig            | 2 +-
 configs/sige7-rk3588_defconfig                | 2 +-
 configs/sonoff-ihost-rv1126_defconfig         | 2 +-
 configs/soquartz-blade-rk3566_defconfig       | 2 +-
 configs/soquartz-cm4-rk3566_defconfig         | 2 +-
 configs/soquartz-model-a-rk3566_defconfig     | 2 +-
 configs/tiger-rk3588_defconfig                | 2 +-
 configs/tinker-rk3288_defconfig               | 2 +-
 configs/tinker-s-rk3288_defconfig             | 2 +-
 configs/toybrick-rk3588_defconfig             | 2 +-
 configs/turing-rk1-rk3588_defconfig           | 2 +-
 configs/vyasa-rk3288_defconfig                | 2 +-
 121 files changed, 122 insertions(+), 120 deletions(-)
arch/arm/dts/rockchip-u-boot.dtsi +2 -0
index 67cb2c3d165..6871260574d 100644
@@ -209,6 +209,7 @@
 	simple-bin {
 		filename = "u-boot-rockchip.bin";
 		pad-byte = <0xff>;
+		skip-at-start = <0x8000>;
 
 		mkimage {
 			filename = "idbloader.img";
@@ -244,6 +245,7 @@
 	simple-bin-spi {
 		filename = "u-boot-rockchip-spi.bin";
 		pad-byte = <0xff>;
+		skip-at-start = <0x8000>;
 
 		mkimage {
 			filename = "idbloader-spi.img";
configs/anbernic-rgxx3-rk3566_defconfig +1 -1
index 14c97b4c5bf..972d4c71b14 100644
@@ -28,7 +28,7 @@ CONFIG_BOARD_TYPES=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_BOARD_RNG_SEED=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 CONFIG_SPL_BOARD_INIT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_POWER=y
configs/bpi-r2-pro-rk3568_defconfig +1 -1
index d84ea2f955f..e5eaf7f6449 100644
@@ -19,7 +19,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3568-bpi-r2-pro.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
 CONFIG_SYS_PROMPT="BPI-R2PRO> "
configs/chromebit_mickey_defconfig +1 -1
index 874f266dad1..b727db9eefe 100644
@@ -35,7 +35,7 @@ CONFIG_LOG=y
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_BOARD_EARLY_INIT_R=y
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 CONFIG_SPL_NO_BSS_LIMIT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
configs/chromebook_bob_defconfig +1 -1
index 2f08cff41e6..5cf9f8d266a 100644
@@ -39,7 +39,7 @@ CONFIG_BLOBLIST=y
 CONFIG_BLOBLIST_ADDR=0x100000
 CONFIG_BLOBLIST_SIZE=0x1000
 CONFIG_SPL_MAX_SIZE=0x1e000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 CONFIG_HANDOFF=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
configs/chromebook_jerry_defconfig +1 -1
index f40b8e84e39..59d213835ef 100644
@@ -34,7 +34,7 @@ CONFIG_LOG=y
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_BOARD_EARLY_INIT_R=y
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 CONFIG_SPL_NO_BSS_LIMIT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
configs/chromebook_kevin_defconfig +1 -1
index 8959d397256..3ad3e580ec6 100644
@@ -40,7 +40,7 @@ CONFIG_BLOBLIST=y
 CONFIG_BLOBLIST_ADDR=0x100000
 CONFIG_BLOBLIST_SIZE=0x1000
 CONFIG_SPL_MAX_SIZE=0x1e000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 CONFIG_HANDOFF=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
configs/chromebook_minnie_defconfig +1 -1
index 2f125ba12ad..c8b00869230 100644
@@ -35,7 +35,7 @@ CONFIG_LOG=y
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_BOARD_EARLY_INIT_R=y
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 CONFIG_SPL_NO_BSS_LIMIT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
configs/chromebook_speedy_defconfig +1 -1
index c19b0905d5c..bf70f35f4d2 100644
@@ -35,7 +35,7 @@ CONFIG_LOG=y
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_BOARD_EARLY_INIT_R=y
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 CONFIG_SPL_NO_BSS_LIMIT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
configs/cm3588-nas-rk3588_defconfig +1 -1
index fd0a32d6d79..abd60abc177 100644
@@ -21,7 +21,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588-friendlyelec-cm3588-nas.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
 CONFIG_CMD_GPIO=y
configs/coolpi-4b-rk3588s_defconfig +1 -1
index ea985b81670..7b90bc59afb 100644
@@ -27,7 +27,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588s-coolpi-4b.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000
configs/coolpi-cm5-evb-rk3588_defconfig +1 -1
index 58ffe7baf5f..10d07332ad6 100644
@@ -27,7 +27,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588-coolpi-cm5-evb.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000
configs/coolpi-cm5-genbook-rk3588_defconfig +1 -1
index 3eb5dc968af..ab867e758cc 100644
@@ -28,7 +28,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588-coolpi-cm5-genbook.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000
configs/eaidk-610-rk3399_defconfig +1 -1
index 8f9a76157f1..7f3215628a4 100644
@@ -15,7 +15,7 @@ CONFIG_DEBUG_UART=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-eaidk-610.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
 CONFIG_TPL=y
configs/evb-px30_defconfig +1 -1
index 50dd29fcb01..9335dfd1dad 100644
@@ -25,7 +25,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/px30-evb.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_MISC_INIT_R=y
 CONFIG_SPL_MAX_SIZE=0x20000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 CONFIG_SPL_BOOTROM_SUPPORT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
configs/evb-px5_defconfig +1 -1
index b08714437fd..cab6b23bc0d 100644
@@ -40,7 +40,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3368-px5-evb.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 CONFIG_SPL_BOOTROM_SUPPORT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
configs/evb-rk3036_defconfig +1 -1
index ba79960495e..23e8d00a4df 100644
@@ -27,7 +27,7 @@ CONFIG_DEFAULT_FDT_FILE="rk3036-evb.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 # CONFIG_SPL_FRAMEWORK is not set
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 CONFIG_SPL_NO_BSS_LIMIT=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
configs/evb-rk3229_defconfig +1 -1
index 3cbc22662a6..030abfc6b6e 100644
@@ -28,7 +28,7 @@ CONFIG_DEFAULT_FDT_FILE="rk3229-evb.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x100000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 CONFIG_SPL_NO_BSS_LIMIT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_CMD_GPT=y
configs/evb-rk3288_defconfig +1 -1
index ae79efebf57..3a606f387c8 100644
@@ -32,7 +32,7 @@ CONFIG_USE_PREBOOT=y
 CONFIG_DEFAULT_FDT_FILE="rk3288-evb-rk808.dtb"
 CONFIG_SILENT_CONSOLE=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 CONFIG_SPL_NO_BSS_LIMIT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
configs/evb-rk3308_defconfig +1 -1
index c8e1753b281..f07234a5024 100644
@@ -17,7 +17,7 @@ CONFIG_FIT_VERBOSE=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3308-evb.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
configs/evb-rk3328_defconfig +1 -1
index fd528535838..cb4a5386033 100644
@@ -22,7 +22,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3328-evb.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
 CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
configs/evb-rk3399_defconfig +1 -1
index 9481dfae7e4..8f1b7570a35 100644
@@ -16,7 +16,7 @@ CONFIG_DEBUG_UART=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-evb.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
 CONFIG_TPL=y
configs/evb-rk3568_defconfig +1 -1
index a068bc6846c..9ab3583b4a0 100644
@@ -18,7 +18,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3568-evb1-v10.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
 CONFIG_CMD_GPIO=y
configs/evb-rk3588_defconfig +1 -1
index 3d4d2747145..9ea4ea1c6ab 100644
@@ -19,7 +19,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588-evb1-v10.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
 CONFIG_CMD_GPIO=y
configs/ficus-rk3399_defconfig +1 -1
index b32ca726b6c..b750df55e68 100644
@@ -17,7 +17,7 @@ CONFIG_AHCI=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-ficus.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
 CONFIG_TPL=y
configs/firefly-px30_defconfig +1 -1
index 7398d06274f..eab55f669cf 100644
@@ -26,7 +26,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/px30-firefly.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_MISC_INIT_R=y
 CONFIG_SPL_MAX_SIZE=0x20000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 CONFIG_SPL_BOOTROM_SUPPORT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
configs/firefly-rk3288_defconfig +1 -1
index 00f23174210..8d59431831c 100644
@@ -29,7 +29,7 @@ CONFIG_USE_PREBOOT=y
 CONFIG_DEFAULT_FDT_FILE="rk3288-firefly.dtb"
 CONFIG_SILENT_CONSOLE=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 CONFIG_SPL_NO_BSS_LIMIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_CMD_GPIO=y
configs/firefly-rk3399_defconfig +1 -1
index 3871627318b..aaea58b6b4a 100644
@@ -17,7 +17,7 @@ CONFIG_DEBUG_UART=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-firefly.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
 CONFIG_TPL=y
configs/generic-rk3568_defconfig +1 -1
index f79f0e84400..10d7616296f 100644
@@ -23,7 +23,7 @@ CONFIG_LEGACY_IMAGE_FORMAT=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3568-generic.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000
configs/generic-rk3588_defconfig +1 -1
index 51e31dce3a9..b77f2a76dd6 100644
@@ -19,7 +19,7 @@ CONFIG_LEGACY_IMAGE_FORMAT=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588-generic.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
 CONFIG_CMD_GPIO=y
configs/jaguar-rk3588_defconfig +1 -1
index 6e853991d1d..01cf1bb90c9 100644
@@ -27,7 +27,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588-jaguar.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_CYCLIC=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
 # CONFIG_BOOTM_NETBSD is not set
configs/khadas-edge-captain-rk3399_defconfig +1 -1
index 89611a0535e..0cac100784f 100644
@@ -22,7 +22,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-khadas-edge-captain.dtb"
 CONFIG_SYS_PBSIZE=1048
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0xE0000
configs/khadas-edge-rk3399_defconfig +1 -1
index 3816f4327a6..5b5e39d8306 100644
@@ -21,7 +21,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-khadas-edge.dtb"
 CONFIG_SYS_PBSIZE=1048
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0xE0000
configs/khadas-edge-v-rk3399_defconfig +1 -1
index 35e20942572..07bf6bc595d 100644
@@ -22,7 +22,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-khadas-edge-v.dtb"
 CONFIG_SYS_PBSIZE=1048
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0xE0000
configs/kylin-rk3036_defconfig +1 -1
index dd25fd60107..ed7bd37b9bf 100644
@@ -29,7 +29,7 @@ CONFIG_DEFAULT_FDT_FILE="rk3036-kylin.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 # CONFIG_SPL_FRAMEWORK is not set
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 CONFIG_SPL_NO_BSS_LIMIT=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
configs/leez-rk3399_defconfig +1 -1
index 57b097377fa..ac4c8b06f2f 100644
@@ -15,7 +15,7 @@ CONFIG_DEBUG_UART=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-leez-p710.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
 CONFIG_TPL=y
configs/lubancat-2-rk3568_defconfig +1 -1
index 46cc3c03fff..51f1f6ad5f8 100644
@@ -19,7 +19,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3568-lubancat-2.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
 CONFIG_CMD_GPIO=y
configs/miqi-rk3288_defconfig +1 -1
index 420a8bd1e79..41b97f381c7 100644
@@ -29,7 +29,7 @@ CONFIG_USE_PREBOOT=y
 CONFIG_DEFAULT_FDT_FILE="rk3288-miqi.dtb"
 CONFIG_SILENT_CONSOLE=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 CONFIG_SPL_NO_BSS_LIMIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_CMD_GPIO=y
configs/mk808_defconfig +1 -1
index 12a37054b4d..b63f8fa9e30 100644
@@ -42,7 +42,7 @@ CONFIG_SYS_PBSIZE=276
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_BOARD_LATE_INIT=y
 CONFIG_SPL_MAX_SIZE=0x32000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 CONFIG_SPL_NO_BSS_LIMIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_SPL_SEPARATE_BSS=y
configs/nanopc-t4-rk3399_defconfig +1 -1
index 26c12c51078..95276602a42 100644
@@ -17,7 +17,7 @@ CONFIG_DEBUG_UART=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-nanopc-t4.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
 CONFIG_TPL=y
configs/nanopc-t6-rk3588_defconfig +1 -1
index 772b7df1555..31be93dc2e8 100644
@@ -27,7 +27,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588-nanopc-t6.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000
configs/nanopi-m4-2gb-rk3399_defconfig +1 -1
index d24b7bc6d17..fa1839baa96 100644
@@ -18,7 +18,7 @@ CONFIG_AHCI=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-nanopi-m4-2gb.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
 CONFIG_TPL=y
configs/nanopi-m4-rk3399_defconfig +1 -1
index da3e44af841..ae84be9f5b9 100644
@@ -18,7 +18,7 @@ CONFIG_AHCI=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-nanopi-m4.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
 CONFIG_TPL=y
configs/nanopi-m4b-rk3399_defconfig +1 -1
index 247056ab58b..0815534618b 100644
@@ -18,7 +18,7 @@ CONFIG_AHCI=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-nanopi-m4b.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
 CONFIG_TPL=y
configs/nanopi-neo4-rk3399_defconfig +1 -1
index 305877d2079..5ac47919e0a 100644
@@ -16,7 +16,7 @@ CONFIG_DEBUG_UART=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-nanopi-neo4.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
 CONFIG_TPL=y
configs/nanopi-r2c-plus-rk3328_defconfig +1 -1
index bef1e22d644..c867c044b0a 100644
@@ -23,7 +23,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3328-nanopi-r2c-plus.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_POWER=y
 CONFIG_SPL_ATF=y
configs/nanopi-r2c-rk3328_defconfig +1 -1
index 4d66a76c7dc..37648c87e87 100644
@@ -23,7 +23,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3328-nanopi-r2c.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_POWER=y
 CONFIG_SPL_ATF=y
configs/nanopi-r2s-plus-rk3328_defconfig +1 -1
index 3a75566ed4d..05a3e51dfb6 100644
@@ -23,7 +23,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3328-nanopi-r2s-plus.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_POWER=y
 CONFIG_SPL_ATF=y
configs/nanopi-r2s-rk3328_defconfig +1 -1
index 2b9193d1ff5..ef458b221be 100644
@@ -23,7 +23,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3328-nanopi-r2s.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_POWER=y
 CONFIG_SPL_ATF=y
configs/nanopi-r4s-rk3399_defconfig +1 -1
index a6dafe3d9eb..e60888a529f 100644
@@ -16,7 +16,7 @@ CONFIG_DEBUG_UART=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-nanopi-r4s.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
 CONFIG_TPL=y
configs/nanopi-r5c-rk3568_defconfig +1 -1
index 4a43b17ccb1..036e9158929 100644
@@ -20,7 +20,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3568-nanopi-r5c.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
 CONFIG_CMD_GPIO=y
configs/nanopi-r5s-rk3568_defconfig +1 -1
index a60d229fbbf..8abd77879f7 100644
@@ -20,7 +20,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3568-nanopi-r5s.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
 CONFIG_CMD_GPIO=y
configs/nanopi-r6c-rk3588s_defconfig +1 -1
index c4de5518a72..eaef4d23a33 100644
@@ -21,7 +21,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588s-nanopi-r6c.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
 CONFIG_CMD_GPIO=y
configs/nanopi-r6s-rk3588s_defconfig +1 -1
index 2726729b9ac..3318b07736f 100644
@@ -21,7 +21,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588s-nanopi-r6s.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
 CONFIG_CMD_GPIO=y
configs/neu2-io-rv1126_defconfig +1 -1
index 18230859b18..431803e1e64 100644
@@ -18,7 +18,7 @@ CONFIG_FIT_VERBOSE=y
 CONFIG_DEFAULT_FDT_FILE="rv1126-edgeble-neu2-io.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 CONFIG_SPL_NO_BSS_LIMIT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
configs/neu6a-io-rk3588_defconfig +1 -1
index 291e0d26d42..cbcf1434d5e 100644
@@ -19,7 +19,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588-edgeble-neu6a-io.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
 CONFIG_CMD_GPT=y
configs/neu6b-io-rk3588_defconfig +1 -1
index 4e22852f23c..6f4b35510a6 100644
@@ -19,7 +19,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588-edgeble-neu6b-io.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
 CONFIG_CMD_GPT=y
configs/nova-rk3588s_defconfig +1 -1
index fb30dfd1db8..d25405fbb72 100644
@@ -20,7 +20,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588s-indiedroid-nova.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
 CONFIG_CMD_GPIO=y
configs/odroid-go2_defconfig +1 -1
index 492802dddae..69bd559c5a9 100644
@@ -29,7 +29,7 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_BOARD_LATE_INIT=y
 CONFIG_MISC_INIT_R=y
 CONFIG_SPL_MAX_SIZE=0x20000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 CONFIG_SPL_BOOTROM_SUPPORT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_I2C=y
configs/odroid-m1-rk3568_defconfig +1 -1
index a8e8a8781e1..8e0e2353bf6 100644
@@ -27,7 +27,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3568-odroid-m1.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x100000
configs/odroid-m1s-rk3566_defconfig +1 -1
index 39e815ad317..0078a33dbc7 100644
@@ -21,7 +21,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3566-odroid-m1s.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
 CONFIG_CMD_GPIO=y
configs/odroid-m2-rk3588s_defconfig +1 -1
index 4c3fa8500d8..0bdc262bad0 100644
@@ -21,7 +21,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588s-odroid-m2.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
 CONFIG_CMD_GPIO=y
configs/orangepi-3b-rk3566_defconfig +1 -1
index 2181c9caf58..83ca7bb27b5 100644
@@ -28,7 +28,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3566-orangepi-3b.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000
configs/orangepi-5-plus-rk3588_defconfig +1 -1
index 9050fceda45..214d8363313 100644
@@ -28,7 +28,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588-orangepi-5-plus.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000
configs/orangepi-5-rk3588s_defconfig +1 -1
index 6e2ff7d338a..844dd22a1a8 100644
@@ -27,7 +27,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588s-orangepi-5.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000
configs/orangepi-r1-plus-lts-rk3328_defconfig +1 -1
index 6d5d8b9dcc9..0874a013046 100644
@@ -26,7 +26,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3328-orangepi-r1-plus-lts.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_POWER=y
 CONFIG_SPL_SPI_LOAD=y
configs/orangepi-r1-plus-rk3328_defconfig +1 -1
index b382f9b9f18..1bd51675cc4 100644
@@ -26,7 +26,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3328-orangepi-r1-plus.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_POWER=y
 CONFIG_SPL_SPI_LOAD=y
configs/orangepi-rk3399_defconfig +1 -1
index fdf3d698939..1d1cf412b43 100644
@@ -16,7 +16,7 @@ CONFIG_DEBUG_UART=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-orangepi.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
 CONFIG_TPL=y
configs/phycore-rk3288_defconfig +1 -1
index 0f8e999ee3f..23ae464cb27 100644
@@ -30,7 +30,7 @@ CONFIG_DEFAULT_FDT_FILE="rk3288-phycore-rdk.dtb"
 CONFIG_SILENT_CONSOLE=y
 CONFIG_CONSOLE_MUX=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 CONFIG_SPL_NO_BSS_LIMIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_CMD_GPIO=y
configs/pinebook-pro-rk3399_defconfig +1 -1
index dfa927ccb17..195bc01152f 100644
@@ -25,7 +25,7 @@ CONFIG_USE_PREBOOT=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-pinebook-pro.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0xE0000
configs/pinephone-pro-rk3399_defconfig +1 -1
index 5e16749ba7d..d5a70015ed6 100644
@@ -23,7 +23,7 @@ CONFIG_USE_PREBOOT=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-pinephone-pro.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0xE0000
configs/pinetab2-rk3566_defconfig +1 -1
index 45e63b42d19..cf10abc4c8f 100644
@@ -27,7 +27,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3566-pinetab2-v2.0.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_I2C=y
 CONFIG_SPL_POWER=y
configs/popmetal-rk3288_defconfig +1 -1
index 1b2fb4a38cd..a958ffe435c 100644
@@ -29,7 +29,7 @@ CONFIG_DEFAULT_FDT_FILE="rk3288-popmetal.dtb"
 CONFIG_SILENT_CONSOLE=y
 CONFIG_CONSOLE_MUX=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 CONFIG_SPL_NO_BSS_LIMIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_CMD_GPIO=y
configs/powkiddy-x55-rk3566_defconfig +1 -1
index 85280839889..3b96c8d3c07 100644
@@ -18,7 +18,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3566-powkiddy-x55.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
 CONFIG_CMD_GPIO=y
configs/puma-rk3399_defconfig +1 -1
index 7a180b14130..55e15612260 100644
@@ -23,7 +23,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-puma-haikou.dtb"
 CONFIG_CONSOLE_MUX=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x2e000
-CONFIG_SPL_PAD_TO=0x38000
+CONFIG_SPL_PAD_TO=0x40000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x200
 CONFIG_SPL_I2C=y
configs/px30-core-ctouch2-of10-px30_defconfig +1 -1
index 97a6d45f39b..23743683aa8 100644
@@ -25,7 +25,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/px30-engicam-px30-core-ctouch2-of10.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_MISC_INIT_R=y
 CONFIG_SPL_MAX_SIZE=0x20000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 CONFIG_SPL_BOOTROM_SUPPORT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
configs/px30-core-ctouch2-px30_defconfig +1 -1
index 0d20546a746..c3870f70d67 100644
@@ -25,7 +25,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/px30-engicam-px30-core-ctouch2.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_MISC_INIT_R=y
 CONFIG_SPL_MAX_SIZE=0x20000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 CONFIG_SPL_BOOTROM_SUPPORT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
configs/px30-core-edimm2.2-px30_defconfig +1 -1
index 6d7ec8f3598..1c0a1c63488 100644
@@ -25,7 +25,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/px30-engicam-px30-core-edimm2.2.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_MISC_INIT_R=y
 CONFIG_SPL_MAX_SIZE=0x20000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 CONFIG_SPL_BOOTROM_SUPPORT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
configs/qnap-ts433-rk3568_defconfig +1 -1
index ceef0d25dc0..cb70e2bcdaf 100644
@@ -22,7 +22,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3568-qnap-ts433.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
 CONFIG_CMD_GPIO=y
configs/quartz64-a-rk3566_defconfig +1 -1
index fe3fa37611a..2578b5d65a0 100644
@@ -28,7 +28,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3566-quartz64-a.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_POWER=y
 CONFIG_SPL_SPI_LOAD=y
configs/quartz64-b-rk3566_defconfig +1 -1
index 929736f76af..d8e7e3036a8 100644
@@ -27,7 +27,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3566-quartz64-b.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000
configs/quartzpro64-rk3588_defconfig +1 -1
index ade7be27e92..40dd6ff84bf 100644
@@ -22,7 +22,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588-quartzpro64.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
 CONFIG_CMD_GPIO=y
configs/radxa-cm3-io-rk3566_defconfig +1 -1
index 2655fdc3170..690c56ec3b2 100644
@@ -18,7 +18,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3566-radxa-cm3-io.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
 CONFIG_CMD_GPIO=y
configs/radxa-e25-rk3568_defconfig +1 -1
index 4df594ddc01..9d63d04034c 100644
@@ -21,7 +21,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3568-radxa-e25.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
 CONFIG_CMD_GPIO=y
configs/radxa-zero-3-rk3566_defconfig +1 -1
index 5989b07ad79..d75ae675b93 100644
@@ -20,7 +20,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3566-radxa-zero-3w.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_POWER=y
 CONFIG_SPL_ATF=y
configs/roc-cc-rk3308_defconfig +1 -1
index fb81d3bccfb..b08d0a4c1fb 100644
@@ -17,7 +17,7 @@ CONFIG_FIT_VERBOSE=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3308-roc-cc.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
configs/roc-cc-rk3328_defconfig +1 -1
index 183332ab7ce..80a44449328 100644
@@ -22,7 +22,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3328-roc-cc.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_POWER=y
 CONFIG_SPL_ATF=y
configs/roc-pc-mezzanine-rk3399_defconfig +1 -1
index 3ab5fd69c62..bac62d3b8a0 100644
@@ -25,7 +25,7 @@ CONFIG_DEBUG_UART=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-roc-pc-mezzanine.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ENV_SUPPORT=y
 CONFIG_SPL_SPI_LOAD=y
configs/roc-pc-rk3399_defconfig +1 -1
index 0ef86748778..dad038e6020 100644
@@ -24,7 +24,7 @@ CONFIG_DEBUG_UART=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-roc-pc.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ENV_SUPPORT=y
 CONFIG_SPL_SPI_LOAD=y
configs/rock-3a-rk3568_defconfig +1 -1
index 733ce631457..ebb24491205 100644
@@ -26,7 +26,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3568-rock-3a.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000
configs/rock-3b-rk3568_defconfig +1 -1
index 2023feb36c2..349a20349b0 100644
@@ -26,7 +26,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3568-rock-3b.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000
configs/rock-3c-rk3566_defconfig +1 -1
index 2528c7c639c..db8f6163627 100644
@@ -26,7 +26,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3566-rock-3c.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000
configs/rock-4c-plus-rk3399_defconfig +1 -1
index 0c73a212ea1..97ad1c52c92 100644
@@ -23,7 +23,7 @@ CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rock-4c-plus.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0xE0000
configs/rock-4se-rk3399_defconfig +1 -1
index 3ae19692155..ed128429c8a 100644
@@ -25,7 +25,7 @@ CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rock-4se.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0xE0000
configs/rock-5-itx-rk3588_defconfig +1 -1
index d0dd1c20ece..47817435f67 100644
@@ -28,7 +28,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588-rock-5-itx.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000
configs/rock-pi-4-rk3399_defconfig +1 -1
index f3a5c2c45f3..cb01181c651 100644
@@ -25,7 +25,7 @@ CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rock-pi-4a.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0xE0000
configs/rock-pi-4c-rk3399_defconfig +1 -1
index 9bda50c8c77..1cbd5972463 100644
@@ -25,7 +25,7 @@ CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rock-pi-4c.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0xE0000
configs/rock-pi-e-rk3328_defconfig +1 -1
index 52dad765a8a..532f420e544 100644
@@ -22,7 +22,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3328-rock-pi-e.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_POWER=y
 CONFIG_SPL_ATF=y
configs/rock-pi-e-v3-rk3328_defconfig +1 -1
index 518ea4ebe51..fb2bc8cc9c9 100644
@@ -22,7 +22,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3328-rock-pi-e.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_POWER=y
 CONFIG_SPL_ATF=y
configs/rock-pi-n10-rk3399pro_defconfig +1 -1
index a9c6d8a907a..4ae0ddd3059 100644
@@ -18,7 +18,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399pro-rock-pi-n10.dtb"
 # CONFIG_CONSOLE_MUX is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
 CONFIG_TPL=y
configs/rock-pi-n8-rk3288_defconfig +1 -1
index dde0b81eee4..93f572c7fb6 100644
@@ -28,7 +28,7 @@ CONFIG_DEBUG_UART=y
 CONFIG_USE_PREBOOT=y
 CONFIG_SILENT_CONSOLE=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 CONFIG_SPL_NO_BSS_LIMIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_CMD_SPL=y
configs/rock-pi-s-rk3308_defconfig +1 -1
index 4b08af309b1..3c357b5cec6 100644
@@ -17,7 +17,7 @@ CONFIG_FIT_VERBOSE=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3308-rock-pi-s.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
configs/rock-s0-rk3308_defconfig +1 -1
index 0a46e7bb187..8d7ed5d1434 100644
@@ -17,7 +17,7 @@ CONFIG_FIT_VERBOSE=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3308-rock-s0.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
configs/rock2_defconfig +1 -1
index bff65d1fc41..79f66b8c694 100644
@@ -29,7 +29,7 @@ CONFIG_DEFAULT_FDT_FILE="rk3288-rock2-square.dtb"
 CONFIG_SILENT_CONSOLE=y
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 CONFIG_SPL_NO_BSS_LIMIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_CMD_GPIO=y
configs/rock5a-rk3588s_defconfig +1 -1
index 9618d590009..2449f33abc5 100644
@@ -19,7 +19,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588s-rock-5a.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
 CONFIG_CMD_GPIO=y
configs/rock5b-rk3588_defconfig +1 -1
index 47ee2109f8e..80781eef2d1 100644
@@ -29,7 +29,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588-rock-5b.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000
configs/rock64-rk3328_defconfig +1 -1
index 6d00b52e62f..12e248c05c1 100644
@@ -25,7 +25,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3328-rock64.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_POWER=y
 CONFIG_SPL_SPI_LOAD=y
configs/rock960-rk3399_defconfig +1 -1
index aebfa73459c..1c361b019b7 100644
@@ -16,7 +16,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rock960.dtb"
 CONFIG_SYS_PBSIZE=1052
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
 CONFIG_TPL=y
configs/rock_defconfig +1 -1
index d7f11310cba..fbadfc4c1a1 100644
@@ -29,7 +29,7 @@ CONFIG_DEFAULT_FDT_FILE="rk3188-radxarock.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x7800
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 CONFIG_SPL_NO_BSS_LIMIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_CMD_I2C=y
configs/rockpro64-rk3399_defconfig +1 -1
index 08b7e2784e9..e536ccfdb6f 100644
@@ -25,7 +25,7 @@ CONFIG_BOOTSTAGE_REPORT=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rockpro64.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0xE0000
configs/sige7-rk3588_defconfig +1 -1
index 8b033e22b84..c374ff8d337 100644
@@ -23,7 +23,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588-armsom-sige7.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
 CONFIG_CMD_GPIO=y
configs/sonoff-ihost-rv1126_defconfig +1 -1
index 78ca7a3859e..74deef49737 100644
@@ -19,7 +19,7 @@ CONFIG_SPL_LOAD_FIT=y
 CONFIG_DEFAULT_FDT_FILE="rv1126-sonoff-ihost.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 CONFIG_SPL_NO_BSS_LIMIT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
configs/soquartz-blade-rk3566_defconfig +1 -1
index a1a51b2c657..a29310ede62 100644
@@ -21,7 +21,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3566-soquartz-blade.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
 CONFIG_CMD_GPIO=y
configs/soquartz-cm4-rk3566_defconfig +1 -1
index a8bca0eaccc..4652879be6c 100644
@@ -21,7 +21,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3566-soquartz-cm4.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
 CONFIG_CMD_GPIO=y
configs/soquartz-model-a-rk3566_defconfig +1 -1
index f080d2e36d2..913cb87b12d 100644
@@ -21,7 +21,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3566-soquartz-model-a.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
 CONFIG_CMD_GPIO=y
configs/tiger-rk3588_defconfig +1 -1
index f962ac416f3..a3952ff55da 100644
@@ -28,7 +28,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588-tiger-haikou.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_CYCLIC=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
 # CONFIG_BOOTM_NETBSD is not set
configs/tinker-rk3288_defconfig +1 -1
index 42dbef9c2c3..0cf6a91e426 100644
@@ -30,7 +30,7 @@ CONFIG_USE_PREBOOT=y
 CONFIG_DEFAULT_FDT_FILE="rk3288-tinker.dtb"
 CONFIG_SILENT_CONSOLE=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 CONFIG_SPL_NO_BSS_LIMIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_SPL_I2C=y
configs/tinker-s-rk3288_defconfig +1 -1
index e62a03e066c..eecfd1a4caf 100644
@@ -30,7 +30,7 @@ CONFIG_USE_PREBOOT=y
 CONFIG_DEFAULT_FDT_FILE="rk3288-tinker-s.dtb"
 CONFIG_SILENT_CONSOLE=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 CONFIG_SPL_NO_BSS_LIMIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_SPL_I2C=y
configs/toybrick-rk3588_defconfig +1 -1
index 5e70341c987..7da1b5cbc3b 100644
@@ -19,7 +19,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588-toybrick-x0.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
 CONFIG_CMD_GPIO=y
configs/turing-rk1-rk3588_defconfig +1 -1
index 0eddf15833c..73d7b32e300 100644
@@ -22,7 +22,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588-turing-rk1.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_ATF=y
 CONFIG_CMD_GPIO=y
configs/vyasa-rk3288_defconfig +1 -1
index e75466c1cad..31a7cf0b273 100644
@@ -29,7 +29,7 @@ CONFIG_USE_PREBOOT=y
 CONFIG_DEFAULT_FDT_FILE="rk3288-vyasa.dtb"
 CONFIG_SILENT_CONSOLE=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_PAD_TO=0x800000
 CONFIG_SPL_NO_BSS_LIMIT=y
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_SPL_OS_BOOT=y
Signature · 1 line
2.43.0
#36 lore raw

Re: [PATCH 16/29] rockchip: Set the skip-at-start property correctly

Hi Simon,

Quoted 5 lines · Simon Glass

The rockchip image is written to the media at block 64, which is a 32K offset, so set the skip-at-start property to 0x8000

Update CONFIG_SPL_PAD_TO to point to the offset in the image, since Binman is dealing with the 'missing' 32K now.

I see lots of calculation with +/- 0x8000 in your new VPL binman images, are they there to counteract this change?

Please drop this mass change and use a <(CONFIG_SPL_PAD_TO + 0x8000)> or similar for binman, and if needed do a mass change at the end or in a separate follow-up patch/series.

Quoted 140 lines

---

 arch/arm/dts/rockchip-u-boot.dtsi             | 2 ++
 configs/anbernic-rgxx3-rk3566_defconfig       | 2 +-
 configs/bpi-r2-pro-rk3568_defconfig           | 2 +-
 configs/chromebit_mickey_defconfig            | 2 +-
 configs/chromebook_bob_defconfig              | 2 +-
 configs/chromebook_jerry_defconfig            | 2 +-
 configs/chromebook_kevin_defconfig            | 2 +-
 configs/chromebook_minnie_defconfig           | 2 +-
 configs/chromebook_speedy_defconfig           | 2 +-
 configs/cm3588-nas-rk3588_defconfig           | 2 +-
 configs/coolpi-4b-rk3588s_defconfig           | 2 +-
 configs/coolpi-cm5-evb-rk3588_defconfig       | 2 +-
 configs/coolpi-cm5-genbook-rk3588_defconfig   | 2 +-
 configs/eaidk-610-rk3399_defconfig            | 2 +-
 configs/evb-px30_defconfig                    | 2 +-
 configs/evb-px5_defconfig                     | 2 +-
 configs/evb-rk3036_defconfig                  | 2 +-
 configs/evb-rk3229_defconfig                  | 2 +-
 configs/evb-rk3288_defconfig                  | 2 +-
 configs/evb-rk3308_defconfig                  | 2 +-
 configs/evb-rk3328_defconfig                  | 2 +-
 configs/evb-rk3399_defconfig                  | 2 +-
 configs/evb-rk3568_defconfig                  | 2 +-
 configs/evb-rk3588_defconfig                  | 2 +-
 configs/ficus-rk3399_defconfig                | 2 +-
 configs/firefly-px30_defconfig                | 2 +-
 configs/firefly-rk3288_defconfig              | 2 +-
 configs/firefly-rk3399_defconfig              | 2 +-
 configs/generic-rk3568_defconfig              | 2 +-
 configs/generic-rk3588_defconfig              | 2 +-
 configs/jaguar-rk3588_defconfig               | 2 +-
 configs/khadas-edge-captain-rk3399_defconfig  | 2 +-
 configs/khadas-edge-rk3399_defconfig          | 2 +-
 configs/khadas-edge-v-rk3399_defconfig        | 2 +-
 configs/kylin-rk3036_defconfig                | 2 +-
 configs/leez-rk3399_defconfig                 | 2 +-
 configs/lubancat-2-rk3568_defconfig           | 2 +-
 configs/miqi-rk3288_defconfig                 | 2 +-
 configs/mk808_defconfig                       | 2 +-
 configs/nanopc-t4-rk3399_defconfig            | 2 +-
 configs/nanopc-t6-rk3588_defconfig            | 2 +-
 configs/nanopi-m4-2gb-rk3399_defconfig        | 2 +-
 configs/nanopi-m4-rk3399_defconfig            | 2 +-
 configs/nanopi-m4b-rk3399_defconfig           | 2 +-
 configs/nanopi-neo4-rk3399_defconfig          | 2 +-
 configs/nanopi-r2c-plus-rk3328_defconfig      | 2 +-
 configs/nanopi-r2c-rk3328_defconfig           | 2 +-
 configs/nanopi-r2s-plus-rk3328_defconfig      | 2 +-
 configs/nanopi-r2s-rk3328_defconfig           | 2 +-
 configs/nanopi-r4s-rk3399_defconfig           | 2 +-
 configs/nanopi-r5c-rk3568_defconfig           | 2 +-
 configs/nanopi-r5s-rk3568_defconfig           | 2 +-
 configs/nanopi-r6c-rk3588s_defconfig          | 2 +-
 configs/nanopi-r6s-rk3588s_defconfig          | 2 +-
 configs/neu2-io-rv1126_defconfig              | 2 +-
 configs/neu6a-io-rk3588_defconfig             | 2 +-
 configs/neu6b-io-rk3588_defconfig             | 2 +-
 configs/nova-rk3588s_defconfig                | 2 +-
 configs/odroid-go2_defconfig                  | 2 +-
 configs/odroid-m1-rk3568_defconfig            | 2 +-
 configs/odroid-m1s-rk3566_defconfig           | 2 +-
 configs/odroid-m2-rk3588s_defconfig           | 2 +-
 configs/orangepi-3b-rk3566_defconfig          | 2 +-
 configs/orangepi-5-plus-rk3588_defconfig      | 2 +-
 configs/orangepi-5-rk3588s_defconfig          | 2 +-
 configs/orangepi-r1-plus-lts-rk3328_defconfig | 2 +-
 configs/orangepi-r1-plus-rk3328_defconfig     | 2 +-
 configs/orangepi-rk3399_defconfig             | 2 +-
 configs/phycore-rk3288_defconfig              | 2 +-
 configs/pinebook-pro-rk3399_defconfig         | 2 +-
 configs/pinephone-pro-rk3399_defconfig        | 2 +-
 configs/pinetab2-rk3566_defconfig             | 2 +-
 configs/popmetal-rk3288_defconfig             | 2 +-
 configs/powkiddy-x55-rk3566_defconfig         | 2 +-
 configs/puma-rk3399_defconfig                 | 2 +-
 configs/px30-core-ctouch2-of10-px30_defconfig | 2 +-
 configs/px30-core-ctouch2-px30_defconfig      | 2 +-
 configs/px30-core-edimm2.2-px30_defconfig     | 2 +-
 configs/qnap-ts433-rk3568_defconfig           | 2 +-
 configs/quartz64-a-rk3566_defconfig           | 2 +-
 configs/quartz64-b-rk3566_defconfig           | 2 +-
 configs/quartzpro64-rk3588_defconfig          | 2 +-
 configs/radxa-cm3-io-rk3566_defconfig         | 2 +-
 configs/radxa-e25-rk3568_defconfig            | 2 +-
 configs/radxa-zero-3-rk3566_defconfig         | 2 +-
 configs/roc-cc-rk3308_defconfig               | 2 +-
 configs/roc-cc-rk3328_defconfig               | 2 +-
 configs/roc-pc-mezzanine-rk3399_defconfig     | 2 +-
 configs/roc-pc-rk3399_defconfig               | 2 +-
 configs/rock-3a-rk3568_defconfig              | 2 +-
 configs/rock-3b-rk3568_defconfig              | 2 +-
 configs/rock-3c-rk3566_defconfig              | 2 +-
 configs/rock-4c-plus-rk3399_defconfig         | 2 +-
 configs/rock-4se-rk3399_defconfig             | 2 +-
 configs/rock-5-itx-rk3588_defconfig           | 2 +-
 configs/rock-pi-4-rk3399_defconfig            | 2 +-
 configs/rock-pi-4c-rk3399_defconfig           | 2 +-
 configs/rock-pi-e-rk3328_defconfig            | 2 +-
 configs/rock-pi-e-v3-rk3328_defconfig         | 2 +-
 configs/rock-pi-n10-rk3399pro_defconfig       | 2 +-
 configs/rock-pi-n8-rk3288_defconfig           | 2 +-
 configs/rock-pi-s-rk3308_defconfig            | 2 +-
 configs/rock-s0-rk3308_defconfig              | 2 +-
 configs/rock2_defconfig                       | 2 +-
 configs/rock5a-rk3588s_defconfig              | 2 +-
 configs/rock5b-rk3588_defconfig               | 2 +-
 configs/rock64-rk3328_defconfig               | 2 +-
 configs/rock960-rk3399_defconfig              | 2 +-
 configs/rock_defconfig                        | 2 +-
 configs/rockpro64-rk3399_defconfig            | 2 +-
 configs/sige7-rk3588_defconfig                | 2 +-
 configs/sonoff-ihost-rv1126_defconfig         | 2 +-
 configs/soquartz-blade-rk3566_defconfig       | 2 +-
 configs/soquartz-cm4-rk3566_defconfig         | 2 +-
 configs/soquartz-model-a-rk3566_defconfig     | 2 +-
 configs/tiger-rk3588_defconfig                | 2 +-
 configs/tinker-rk3288_defconfig               | 2 +-
 configs/tinker-s-rk3288_defconfig             | 2 +-
 configs/toybrick-rk3588_defconfig             | 2 +-
 configs/turing-rk1-rk3588_defconfig           | 2 +-
 configs/vyasa-rk3288_defconfig                | 2 +-
 121 files changed, 122 insertions(+), 120 deletions(-)
arch/arm/dts/rockchip-u-boot.dtsi +1 -0
index 67cb2c3d165..6871260574d 100644
@@ -209,6 +209,7 @@
 	simple-bin {
 		filename = "u-boot-rockchip.bin";
 		pad-byte = <0xff>;
+		skip-at-start = <0x8000>;
 
 		mkimage {
 			filename = "idbloader.img";

arch/arm/dts/rockchip-u-boot.dtsi line 248

Quoted 4 lines
arch/arm/dts/rockchip-u-boot.dtsi +1 -0
@@ -244,6 +245,7 @@
 	simple-bin-spi {
 		filename = "u-boot-rockchip-spi.bin";
 		pad-byte = <0xff>;
+		skip-at-start = <0x8000>;

This is not correct, as stated in the documentation [1]:

Write u-boot-rockchip-spi.bin to offset 0 of SPI flash.

[1] https://docs.u-boot.org/en/latest/board/rockchip/rockchip.html#spi

Regards,
Jonas

Quoted 3 lines
arch/arm/dts/rockchip-u-boot.dtsi +0 -0
 		mkimage {
 			filename = "idbloader-spi.img";

[snip]

#37 lore raw

Re: [PATCH 16/29] rockchip: Set the skip-at-start property correctly

Hi Jonas,

Quoted 4 lines · Jonas Karlman

Hi Simon,

On 2025-02-05 02:55, Simon Glass wrote:

Quoted 8 lines
Quoted 5 lines

The rockchip image is written to the media at block 64, which is a 32K offset, so set the skip-at-start property to 0x8000

Update CONFIG_SPL_PAD_TO to point to the offset in the image, since Binman is dealing with the 'missing' 32K now.

I see lots of calculation with +/- 0x8000 in your new VPL binman images, are they there to counteract this change?

I count two (for A and B) and no, they are not related.

Quoted 4 lines

Please drop this mass change and use a <(CONFIG_SPL_PAD_TO + 0x8000)> or similar for binman, and if needed do a mass change at the end or in a separate follow-up patch/series.

OK, I'll move this to later and separate out the clean-ups so you can see the impact.

Quoted 148 lines
Quoted 141 lines

---

 arch/arm/dts/rockchip-u-boot.dtsi             | 2 ++
 configs/anbernic-rgxx3-rk3566_defconfig       | 2 +-
 configs/bpi-r2-pro-rk3568_defconfig           | 2 +-
 configs/chromebit_mickey_defconfig            | 2 +-
 configs/chromebook_bob_defconfig              | 2 +-
 configs/chromebook_jerry_defconfig            | 2 +-
 configs/chromebook_kevin_defconfig            | 2 +-
 configs/chromebook_minnie_defconfig           | 2 +-
 configs/chromebook_speedy_defconfig           | 2 +-
 configs/cm3588-nas-rk3588_defconfig           | 2 +-
 configs/coolpi-4b-rk3588s_defconfig           | 2 +-
 configs/coolpi-cm5-evb-rk3588_defconfig       | 2 +-
 configs/coolpi-cm5-genbook-rk3588_defconfig   | 2 +-
 configs/eaidk-610-rk3399_defconfig            | 2 +-
 configs/evb-px30_defconfig                    | 2 +-
 configs/evb-px5_defconfig                     | 2 +-
 configs/evb-rk3036_defconfig                  | 2 +-
 configs/evb-rk3229_defconfig                  | 2 +-
 configs/evb-rk3288_defconfig                  | 2 +-
 configs/evb-rk3308_defconfig                  | 2 +-
 configs/evb-rk3328_defconfig                  | 2 +-
 configs/evb-rk3399_defconfig                  | 2 +-
 configs/evb-rk3568_defconfig                  | 2 +-
 configs/evb-rk3588_defconfig                  | 2 +-
 configs/ficus-rk3399_defconfig                | 2 +-
 configs/firefly-px30_defconfig                | 2 +-
 configs/firefly-rk3288_defconfig              | 2 +-
 configs/firefly-rk3399_defconfig              | 2 +-
 configs/generic-rk3568_defconfig              | 2 +-
 configs/generic-rk3588_defconfig              | 2 +-
 configs/jaguar-rk3588_defconfig               | 2 +-
 configs/khadas-edge-captain-rk3399_defconfig  | 2 +-
 configs/khadas-edge-rk3399_defconfig          | 2 +-
 configs/khadas-edge-v-rk3399_defconfig        | 2 +-
 configs/kylin-rk3036_defconfig                | 2 +-
 configs/leez-rk3399_defconfig                 | 2 +-
 configs/lubancat-2-rk3568_defconfig           | 2 +-
 configs/miqi-rk3288_defconfig                 | 2 +-
 configs/mk808_defconfig                       | 2 +-
 configs/nanopc-t4-rk3399_defconfig            | 2 +-
 configs/nanopc-t6-rk3588_defconfig            | 2 +-
 configs/nanopi-m4-2gb-rk3399_defconfig        | 2 +-
 configs/nanopi-m4-rk3399_defconfig            | 2 +-
 configs/nanopi-m4b-rk3399_defconfig           | 2 +-
 configs/nanopi-neo4-rk3399_defconfig          | 2 +-
 configs/nanopi-r2c-plus-rk3328_defconfig      | 2 +-
 configs/nanopi-r2c-rk3328_defconfig           | 2 +-
 configs/nanopi-r2s-plus-rk3328_defconfig      | 2 +-
 configs/nanopi-r2s-rk3328_defconfig           | 2 +-
 configs/nanopi-r4s-rk3399_defconfig           | 2 +-
 configs/nanopi-r5c-rk3568_defconfig           | 2 +-
 configs/nanopi-r5s-rk3568_defconfig           | 2 +-
 configs/nanopi-r6c-rk3588s_defconfig          | 2 +-
 configs/nanopi-r6s-rk3588s_defconfig          | 2 +-
 configs/neu2-io-rv1126_defconfig              | 2 +-
 configs/neu6a-io-rk3588_defconfig             | 2 +-
 configs/neu6b-io-rk3588_defconfig             | 2 +-
 configs/nova-rk3588s_defconfig                | 2 +-
 configs/odroid-go2_defconfig                  | 2 +-
 configs/odroid-m1-rk3568_defconfig            | 2 +-
 configs/odroid-m1s-rk3566_defconfig           | 2 +-
 configs/odroid-m2-rk3588s_defconfig           | 2 +-
 configs/orangepi-3b-rk3566_defconfig          | 2 +-
 configs/orangepi-5-plus-rk3588_defconfig      | 2 +-
 configs/orangepi-5-rk3588s_defconfig          | 2 +-
 configs/orangepi-r1-plus-lts-rk3328_defconfig | 2 +-
 configs/orangepi-r1-plus-rk3328_defconfig     | 2 +-
 configs/orangepi-rk3399_defconfig             | 2 +-
 configs/phycore-rk3288_defconfig              | 2 +-
 configs/pinebook-pro-rk3399_defconfig         | 2 +-
 configs/pinephone-pro-rk3399_defconfig        | 2 +-
 configs/pinetab2-rk3566_defconfig             | 2 +-
 configs/popmetal-rk3288_defconfig             | 2 +-
 configs/powkiddy-x55-rk3566_defconfig         | 2 +-
 configs/puma-rk3399_defconfig                 | 2 +-
 configs/px30-core-ctouch2-of10-px30_defconfig | 2 +-
 configs/px30-core-ctouch2-px30_defconfig      | 2 +-
 configs/px30-core-edimm2.2-px30_defconfig     | 2 +-
 configs/qnap-ts433-rk3568_defconfig           | 2 +-
 configs/quartz64-a-rk3566_defconfig           | 2 +-
 configs/quartz64-b-rk3566_defconfig           | 2 +-
 configs/quartzpro64-rk3588_defconfig          | 2 +-
 configs/radxa-cm3-io-rk3566_defconfig         | 2 +-
 configs/radxa-e25-rk3568_defconfig            | 2 +-
 configs/radxa-zero-3-rk3566_defconfig         | 2 +-
 configs/roc-cc-rk3308_defconfig               | 2 +-
 configs/roc-cc-rk3328_defconfig               | 2 +-
 configs/roc-pc-mezzanine-rk3399_defconfig     | 2 +-
 configs/roc-pc-rk3399_defconfig               | 2 +-
 configs/rock-3a-rk3568_defconfig              | 2 +-
 configs/rock-3b-rk3568_defconfig              | 2 +-
 configs/rock-3c-rk3566_defconfig              | 2 +-
 configs/rock-4c-plus-rk3399_defconfig         | 2 +-
 configs/rock-4se-rk3399_defconfig             | 2 +-
 configs/rock-5-itx-rk3588_defconfig           | 2 +-
 configs/rock-pi-4-rk3399_defconfig            | 2 +-
 configs/rock-pi-4c-rk3399_defconfig           | 2 +-
 configs/rock-pi-e-rk3328_defconfig            | 2 +-
 configs/rock-pi-e-v3-rk3328_defconfig         | 2 +-
 configs/rock-pi-n10-rk3399pro_defconfig       | 2 +-
 configs/rock-pi-n8-rk3288_defconfig           | 2 +-
 configs/rock-pi-s-rk3308_defconfig            | 2 +-
 configs/rock-s0-rk3308_defconfig              | 2 +-
 configs/rock2_defconfig                       | 2 +-
 configs/rock5a-rk3588s_defconfig              | 2 +-
 configs/rock5b-rk3588_defconfig               | 2 +-
 configs/rock64-rk3328_defconfig               | 2 +-
 configs/rock960-rk3399_defconfig              | 2 +-
 configs/rock_defconfig                        | 2 +-
 configs/rockpro64-rk3399_defconfig            | 2 +-
 configs/sige7-rk3588_defconfig                | 2 +-
 configs/sonoff-ihost-rv1126_defconfig         | 2 +-
 configs/soquartz-blade-rk3566_defconfig       | 2 +-
 configs/soquartz-cm4-rk3566_defconfig         | 2 +-
 configs/soquartz-model-a-rk3566_defconfig     | 2 +-
 configs/tiger-rk3588_defconfig                | 2 +-
 configs/tinker-rk3288_defconfig               | 2 +-
 configs/tinker-s-rk3288_defconfig             | 2 +-
 configs/toybrick-rk3588_defconfig             | 2 +-
 configs/turing-rk1-rk3588_defconfig           | 2 +-
 configs/vyasa-rk3288_defconfig                | 2 +-
 121 files changed, 122 insertions(+), 120 deletions(-)
arch/arm/dts/rockchip-u-boot.dtsi +1 -0
index 67cb2c3d165..6871260574d 100644
@@ -209,6 +209,7 @@
      simple-bin {
              filename = "u-boot-rockchip.bin";
              pad-byte = <0xff>;
+             skip-at-start = <0x8000>;
 
              mkimage {
                      filename = "idbloader.img";

arch/arm/dts/rockchip-u-boot.dtsi line 248

Quoted 4 lines
arch/arm/dts/rockchip-u-boot.dtsi +1 -0
@@ -244,6 +245,7 @@
      simple-bin-spi {
              filename = "u-boot-rockchip-spi.bin";
              pad-byte = <0xff>;
+             skip-at-start = <0x8000>;

This is not correct, as stated in the documentation [1]:

Quoted 3 lines

Write u-boot-rockchip-spi.bin to offset 0 of SPI flash.

[1] https://docs.u-boot.org/en/latest/board/rockchip/rockchip.html#spi

OK, thanks, will fix.

Quoted 9 lines

Regards,
Jonas

Quoted 3 lines
arch/arm/dts/rockchip-u-boot.dtsi +0 -0
              mkimage {
                      filename = "idbloader-spi.img";

[snip]

Regards,
Simon

#38 lore raw

PATCH 17/29 rockchip: Add a template for SPL

In reply to Simon Glass

The SPL phase has a single SPL binary plus a devicetree for each board we need to support.

The devicetree is run through fdtgrep to remove unwanted nodes and properties and reduce its size.

While it would be nicer to just have a single FIT holding both the SPL and U-Boot images, there may not be enough SRAM to support that. So we end up providing this special image just for SPL.

---

 arch/arm/dts/rockchip-u-boot.dtsi | 43 +++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
arch/arm/dts/rockchip-u-boot.dtsi +43 -0
index 6871260574d..c87d17db00e 100644
@@ -204,6 +204,49 @@
 			};
 		};
 	};
+
+	spl_template: template-2 {
+		type = "fit";
+		description = "FIT image for U-Boot SPL";
+		#address-cells = <1>;
+		fit,fdt-list = "of-list";
+		fit,align = <512>;
+		fit,external-offset = <0>;
+		images {
+			spl {
+				description = "U-Boot SPL";
+				type = "firmware";
+				os = "u-boot";
+				arch = ARCH;
+				compression = "lz4";
+				load = <CONFIG_SPL_TEXT_BASE>;
+				entry = <CONFIG_SPL_TEXT_BASE>;
+				section {
+					compress = "lz4";
+					u-boot-spl-nodtb {
+					};
+					u-boot-spl-bss-pad {
+					};
+				};
+			};
+			@fdt-SEQ {
+				description = "fdt-NAME";
+				compression = "none";
+				type = "flat_dt";
+				fit,fdt-phase = "spl";
+			};
+		};
+		configurations {
+			default = "@config-DEFAULT-SEQ";
+			@config-SEQ {
+				description = "NAME.dtb";
+				fdt = "fdt-SEQ";
+				fit,firmware = "spl";
+				fit,loadables;
+				fit,compatible;
+			};
+		};
+	};
 #endif /* HAS_FIT */
 
 	simple-bin {
Signature · 1 line
2.43.0
#39 lore raw

PATCH 18/29 rockchip: Add a VPL image

In reply to Simon Glass

The VPL image is immutable and has a single VPL binary plus a devicetree for each board we need to support.

The devicetree is run through fdtgrep to remove unwanted nodes and properties and reduce its size.

---

 arch/arm/dts/rockchip-u-boot.dtsi | 94 ++++++++++++++++++++++++++++++-
 1 file changed, 93 insertions(+), 1 deletion(-)
arch/arm/dts/rockchip-u-boot.dtsi +93 -1
index c87d17db00e..0611533a310 100644
@@ -270,6 +270,97 @@
 			};
 		};
 
+#ifdef CONFIG_VPL
+		vpl {
+			type = "fit";
+			offset = <(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 0x200 + 0x8000)>;
+			description = "FIT image for U-Boot TPL";
+			#address-cells = <1>;
+			fit,fdt-list = "of-list";
+			fit,align = <512>;
+			fit,external-offset = <0>;
+			images {
+				image-vpl {
+					description = "U-Boot VPL";
+					type = "firmware";
+					os = "u-boot";
+					arch = ARCH;
+					compression = "lz4";
+					load = <CONFIG_VPL_TEXT_BASE>;
+					entry = <CONFIG_VPL_TEXT_BASE>;
+					section {
+						compress = "lz4";
+						u-boot-vpl-nodtb {
+							symbols-base = <0>;
+						};
+						u-boot-vpl-bss-pad {
+						};
+					};
+				};
+				@fdt-SEQ {
+					description = "fdt-NAME";
+					compression = "none";
+					type = "flat_dt";
+					fit,fdt-phase = "vpl";
+				};
+			};
+			configurations {
+				default = "@config-DEFAULT-SEQ";
+				@config-SEQ {
+					description = "NAME.dtb";
+					fdt = "fdt-SEQ";
+					fit,firmware = "image-vpl";
+					fit,loadables;
+					fit,compatible;
+				};
+			};
+		};
+# ifdef CONFIG_BOOTMETH_VBE_ABREC
+		vbe-a {
+			type = "section";
+			offset = <(CONFIG_SPL_PAD_TO + 0x8000)>;
+			spl-a {
+				insert-template = <&spl_template>;
+				size = <0x100000>;
+			};
+
+			u-boot-a {
+				insert-template = <&common_part>;
+			};
+		};
+		vbe-b {
+			type = "section";
+			offset = <(0x1000000)>;
+			spl-b {
+				insert-template = <&spl_template>;
+				size = <0x100000>;
+			};
+
+			u-boot-b {
+				insert-template = <&common_part>;
+			};
+		};
+		vbe-recovery {
+			type = "section";
+			offset = <0x1800000>;
+			spl-recovery {
+				insert-template = <&spl_template>;
+				size = <0x100000>;
+			};
+
+			u-boot-recovery {
+				insert-template = <&common_part>;
+			};
+		};
+# else /* CONFIG_BOOTMETH_VBE_SIMPLE */
+		vbe {
+			type = "fit";
+			offset = <(CONFIG_SPL_PAD_TO + 0x8000)>;
+			insert-template = <&common_part>;
+		};
+# endif /* VBE method */
+#else /* !VPL */
+
 #ifdef HAS_FIT
 		fit {
 			offset = <CONFIG_SPL_PAD_TO>;
@@ -279,7 +370,8 @@
 		u-boot-img {
 			offset = <CONFIG_SPL_PAD_TO>;
 		};
-#endif
+#endif /* HAS_FIT */
+#endif /* VPL */
 		fdtmap {
 		};
 	};
Signature · 1 line
2.43.0
#40 lore raw

PATCH 19/29 rockchip: Add TPL alternatives

In reply to Simon Glass

The TPL image must be built for each board we need to support. It is the only part of the image which is board-specific.

This helps to save space and reduce the size of TPL, so that it can fit within the internal 192K IRAM.

As with other phases, the TPL devicetree is run through fdtgrep to remove unwanted nodes and properties and reduce its size.

---

 arch/arm/dts/rockchip-u-boot.dtsi | 42 +++++++++++++++++++++----------
 1 file changed, 29 insertions(+), 13 deletions(-)
arch/arm/dts/rockchip-u-boot.dtsi +29 -13
index 0611533a310..f6348c532a4 100644
@@ -254,23 +254,23 @@
 		pad-byte = <0xff>;
 		skip-at-start = <0x8000>;
 
-		mkimage {
-			filename = "idbloader.img";
-			args = "-n", CONFIG_SYS_SOC, "-T", "rksd";
-			multiple-data-files;
+#ifdef CONFIG_VPL
+		alternates-fdt {
+			fdt-list-dir = "dts/upstream/src/arm64/rockchip";
+			filename-pattern = "alt-NAME.bin";
+			fdt-phase = "tpl";
 
-#ifdef CONFIG_ROCKCHIP_EXTERNAL_TPL
-			rockchip-tpl {
-			};
-#elif defined(CONFIG_TPL)
-			u-boot-tpl {
-			};
-#endif
-			u-boot-spl {
+			mkimage {
+				filename = "idbloader.img";
+				args = "-n", CONFIG_SYS_SOC, "-T", "rksd";
+				multiple-data-files;
+
+				u-boot-tpl {
+					symbols-base = <0>;
+				};
 			};
 		};
 
-#ifdef CONFIG_VPL
 		vpl {
 			type = "fit";
 			offset = <(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 0x200 + 0x8000)>;
@@ -361,6 +361,22 @@
 # endif /* VBE method */
 #else /* !VPL */
 
+		mkimage {
+			filename = "idbloader.img";
+			args = "-n", CONFIG_SYS_SOC, "-T", "rksd";
+			multiple-data-files;
+
+#ifdef CONFIG_ROCKCHIP_EXTERNAL_TPL
+			rockchip-tpl {
+			};
+#elif defined(CONFIG_TPL)
+			u-boot-tpl {
+			};
+#endif
+			u-boot-spl {
+			};
+		};
+
 #ifdef HAS_FIT
 		fit {
 			offset = <CONFIG_SPL_PAD_TO>;
Signature · 1 line
2.43.0
#41 lore raw

Re: [PATCH 19/29] rockchip: Add TPL alternatives

Hi Simon,

Quoted 2 lines · Simon Glass

The TPL image must be built for each board we need to support. It is the only part of the image which is board-specific.

Is this building for multiple targets required for A, B or recovery?, the main topic for this series? If not it should be added later in the series or possible in a follow-up series.

Quoted 3 lines

This helps to save space and reduce the size of TPL, so that it can fit within the internal 192K IRAM.

This should probably mention something about RK3399 here, Rockchip SoCs have different amount of usable SRAM.

Regards,
Jonas

Quoted 74 lines

As with other phases, the TPL devicetree is run through fdtgrep to remove unwanted nodes and properties and reduce its size.

---

 arch/arm/dts/rockchip-u-boot.dtsi | 42 +++++++++++++++++++++----------
 1 file changed, 29 insertions(+), 13 deletions(-)
arch/arm/dts/rockchip-u-boot.dtsi +29 -13
index 0611533a310..f6348c532a4 100644
@@ -254,23 +254,23 @@
 		pad-byte = <0xff>;
 		skip-at-start = <0x8000>;
 
-		mkimage {
-			filename = "idbloader.img";
-			args = "-n", CONFIG_SYS_SOC, "-T", "rksd";
-			multiple-data-files;
+#ifdef CONFIG_VPL
+		alternates-fdt {
+			fdt-list-dir = "dts/upstream/src/arm64/rockchip";
+			filename-pattern = "alt-NAME.bin";
+			fdt-phase = "tpl";
 
-#ifdef CONFIG_ROCKCHIP_EXTERNAL_TPL
-			rockchip-tpl {
-			};
-#elif defined(CONFIG_TPL)
-			u-boot-tpl {
-			};
-#endif
-			u-boot-spl {
+			mkimage {
+				filename = "idbloader.img";
+				args = "-n", CONFIG_SYS_SOC, "-T", "rksd";
+				multiple-data-files;
+
+				u-boot-tpl {
+					symbols-base = <0>;
+				};
 			};
 		};
 
-#ifdef CONFIG_VPL
 		vpl {
 			type = "fit";
 			offset = <(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 0x200 + 0x8000)>;
@@ -361,6 +361,22 @@
 # endif /* VBE method */
 #else /* !VPL */
 
+		mkimage {
+			filename = "idbloader.img";
+			args = "-n", CONFIG_SYS_SOC, "-T", "rksd";
+			multiple-data-files;
+
+#ifdef CONFIG_ROCKCHIP_EXTERNAL_TPL
+			rockchip-tpl {
+			};
+#elif defined(CONFIG_TPL)
+			u-boot-tpl {
+			};
+#endif
+			u-boot-spl {
+			};
+		};
+
 #ifdef HAS_FIT
 		fit {
 			offset = <CONFIG_SPL_PAD_TO>;
#42 lore raw

Re: [PATCH 19/29] rockchip: Add TPL alternatives

Hi Jonas,

Quoted 10 lines · Jonas Karlman

Hi Simon,

Quoted 2 lines · Simon Glass

The TPL image must be built for each board we need to support. It is the only part of the image which is board-specific.

Is this building for multiple targets required for A, B or recovery?, the main topic for this series? If not it should be added later in the series or possible in a follow-up series.

It's really a main topic for this series. See the 'alternatives' part where you swap in the correct TPL for the board you want to run on. VBE is designed to minimise the amount of separate binaries which are built.

Quoted 7 lines
Quoted 4 lines

This helps to save space and reduce the size of TPL, so that it can fit within the internal 192K IRAM.

This should probably mention something about RK3399 here, Rockchip SoCs have different amount of usable SRAM.

OK

Quoted 70 lines

Regards,
Jonas

Quoted 66 lines

As with other phases, the TPL devicetree is run through fdtgrep to remove unwanted nodes and properties and reduce its size.

---

 arch/arm/dts/rockchip-u-boot.dtsi | 42 +++++++++++++++++++++----------
 1 file changed, 29 insertions(+), 13 deletions(-)
arch/arm/dts/rockchip-u-boot.dtsi +24 -13
index 0611533a310..f6348c532a4 100644
@@ -254,23 +254,23 @@
              pad-byte = <0xff>;
              skip-at-start = <0x8000>;
 
-             mkimage {
-                     filename = "idbloader.img";
-                     args = "-n", CONFIG_SYS_SOC, "-T", "rksd";
-                     multiple-data-files;
+#ifdef CONFIG_VPL
+             alternates-fdt {
+                     fdt-list-dir = "dts/upstream/src/arm64/rockchip";
+                     filename-pattern = "alt-NAME.bin";
+                     fdt-phase = "tpl";
 
-#ifdef CONFIG_ROCKCHIP_EXTERNAL_TPL
-                     rockchip-tpl {
-                     };
-#elif defined(CONFIG_TPL)
-                     u-boot-tpl {
-                     };
-#endif
-                     u-boot-spl {
+                     mkimage {
+                             filename = "idbloader.img";
+                             args = "-n", CONFIG_SYS_SOC, "-T", "rksd";
+                             multiple-data-files;
+
+                             u-boot-tpl {
+                                     symbols-base = <0>;
+                             };
                      };
              };
 
-#ifdef CONFIG_VPL
              vpl {
                      type = "fit";
                      offset = <(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 0x200 + 0x8000)>;
@@ -361,6 +361,22 @@
 # endif /* VBE method */
 #else /* !VPL */
 
+             mkimage {
+                     filename = "idbloader.img";
+                     args = "-n", CONFIG_SYS_SOC, "-T", "rksd";
+                     multiple-data-files;
+
+#ifdef CONFIG_ROCKCHIP_EXTERNAL_TPL
+                     rockchip-tpl {
+                     };
+#elif defined(CONFIG_TPL)
+                     u-boot-tpl {
+                     };
Quoted 9 lines

arch/arm/dts/rockchip-u-boot.dtsi line 382

Quoted 8 lines
arch/arm/dts/rockchip-u-boot.dtsi +5 -0
+#endif
+                     u-boot-spl {
+                     };
+             };
+
 #ifdef HAS_FIT
              fit {
                      offset = <CONFIG_SPL_PAD_TO>;

Regards,
Simon

#43 lore raw

PATCH 20/29 rockchip: Update rk3399 bootph-tags for VPL

In reply to Simon Glass

When VPL is in use, memory init happens in SPL, so there is no need to include the DMC device before that. Adjust the tags to save space.

---

 arch/arm/dts/rk3399-u-boot.dtsi | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
arch/arm/dts/rk3399-u-boot.dtsi +8 -1
index 2bec139d833..76efd703902 100644
@@ -71,7 +71,12 @@
 	       0x0 0xffa88800 0x0 0x1800
 	       0x0 0xffa8a000 0x0 0x2000
 	       0x0 0xffa8c000 0x0 0x1000>;
-	bootph-all;
+#ifdef CONFIG_VPL
+		bootph-pre-ram;
+		bootph-some-ram;
+#else
+		bootph-all;
+#endif
 	status = "okay";
 };
 
@@ -118,8 +123,10 @@
 };
 
 &sdmmc {
+	bootph-pre-sram;
 	bootph-pre-ram;
 	bootph-some-ram;
+	bootph-verify;
 
 	/* mmc to sram can't do dma, prevent aborts transferring TF-A parts */
 	u-boot,spl-fifo-mode;
Signature · 1 line
2.43.0
#44 lore raw

Re: [PATCH 20/29] rockchip: Update rk3399 bootph-tags for VPL

Hi Simon,

Quoted 28 lines · Simon Glass

When VPL is in use, memory init happens in SPL, so there is no need to include the DMC device before that. Adjust the tags to save space.

---

 arch/arm/dts/rk3399-u-boot.dtsi | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
arch/arm/dts/rk3399-u-boot.dtsi +6 -1
index 2bec139d833..76efd703902 100644
@@ -71,7 +71,12 @@
 	       0x0 0xffa88800 0x0 0x1800
 	       0x0 0xffa8a000 0x0 0x2000
 	       0x0 0xffa8c000 0x0 0x1000>;
-	bootph-all;
+#ifdef CONFIG_VPL
+		bootph-pre-ram;
+		bootph-some-ram;
+#else
+		bootph-all;
+#endif
 	status = "okay";
 };
 

arch/arm/dts/rk3399-u-boot.dtsi line 129

Quoted 7 lines
arch/arm/dts/rk3399-u-boot.dtsi +2 -0
@@ -118,8 +123,10 @@
 };
 
 &sdmmc {
+	bootph-pre-sram;
 	bootph-pre-ram;
 	bootph-some-ram;
+	bootph-verify;

The addition to include sdmmc in TPL and VPL should also be limited to VPL=y. All Rockchip AArch64 targets are now using BootROM to load SPL after DRAM is initialized in TPL, so there is no need for sdmmc node.

The sdmmc node was changed from bootph-all in commit 100f489f58a6 ("rockchip: rk3399: Fix loading FIT from SD-card when booting from eMMC") for similar reason as this patch, remove unneeded/unused nodes to save space.

Regards,
Jonas

Quoted 3 lines
arch/arm/dts/rk3399-u-boot.dtsi +0 -0
 	/* mmc to sram can't do dma, prevent aborts transferring TF-A parts */
 	u-boot,spl-fifo-mode;
#45 lore raw

PATCH 21/29 rockchip: Provide a VPL phase on rk3399

In reply to Simon Glass

Add support for this new phase, which runs after TPL. It determines the state of the machine, then selects which SPL image to use. SDRAM init is then done in SPL, so that it is updatable.

---

 arch/arm/include/asm/spl.h               |   1 +
 arch/arm/mach-rockchip/Kconfig           |  25 +++++-
 arch/arm/mach-rockchip/Makefile          |   6 +-
 arch/arm/mach-rockchip/rk3399/Kconfig    |   9 ++
 arch/arm/mach-rockchip/spl-boot-order.c  |   3 +-
 arch/arm/mach-rockchip/spl.c             |   3 +
 arch/arm/mach-rockchip/tpl.c             |   2 +-
 arch/arm/mach-rockchip/u-boot-vpl-v8.lds | 107 +++++++++++++++++++++++
 arch/arm/mach-rockchip/vpl.c             |  53 +++++++++++
 common/spl/Kconfig                       |   1 +
 10 files changed, 203 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/mach-rockchip/u-boot-vpl-v8.lds
 create mode 100644 arch/arm/mach-rockchip/vpl.c
arch/arm/include/asm/spl.h +1 -0
index ee79a19c05c..62844d64cab 100644
@@ -30,6 +30,7 @@ enum {
 	BOOT_DEVICE_XIP,
 	BOOT_DEVICE_BOOTROM,
 	BOOT_DEVICE_SMH,
+	BOOT_DEVICE_VBE,
 	BOOT_DEVICE_NONE
 };
 #endif
arch/arm/mach-rockchip/Kconfig +21 -4
index 269c219a6f8..7e6e9411e79 100644
@@ -250,13 +250,15 @@ config ROCKCHIP_RK3399
 	select SPL_ATF
 	select SPL_BOARD_INIT if SPL
 	select SPL_LOAD_FIT
-	select SPL_CLK if SPL
+	select SPL_CLK if SPL && !VPL
 	select SPL_PINCTRL if SPL
 	select SPL_RAM if SPL
 	select SPL_REGMAP if SPL
 	select SPL_SYSCON if SPL
 	select TPL_NEEDS_SEPARATE_STACK if TPL
-	select SPL_SEPARATE_BSS
+	select VPL_NEEDS_SEPARATE_STACK if VPL
+	select SPL_SEPARATE_BSS if !VPL
+	select SPL_RAW_IMAGE_SUPPORT if VPL
 	select CLK
 	select FIT
 	select PINCTRL
@@ -266,6 +268,7 @@ config ROCKCHIP_RK3399
 	select DM_PMIC
 	select DM_REGULATOR_FIXED
 	select BOARD_LATE_INIT
+	select SUPPORT_VPL
 	imply ARMV8_CRYPTO
 	imply ARMV8_SET_SMPEN
 	imply BOOTSTD_FULL
@@ -294,13 +297,14 @@ config ROCKCHIP_RK3399
 	imply TPL_LIBCOMMON_SUPPORT
 	imply TPL_LIBGENERIC_SUPPORT
 	imply TPL_OF_CONTROL
-	imply TPL_RAM
+	imply TPL_RAM if !VPL
 	imply TPL_REGMAP
 	imply TPL_ROCKCHIP_COMMON_BOARD
 	imply TPL_SERIAL
 	imply TPL_SYS_MALLOC_SIMPLE
 	imply TPL_SYSCON
 	imply TPL_TINY_MEMSET
+	imply TPL_DM_MMC if VPL
 	help
 	  The Rockchip RK3399 is a ARM-based SoC with a dual-core Cortex-A72
 	  and quad-core Cortex-A53.
@@ -455,7 +459,7 @@ config SPL_ROCKCHIP_BACK_TO_BROM
 
 config TPL_ROCKCHIP_BACK_TO_BROM
 	bool "TPL returns to bootrom"
-	default y
+	default y if !VPL
 	select ROCKCHIP_BROM_HELPER if !ROCKCHIP_RK3066
 	select TPL_BOOTROM_SUPPORT
 	depends on TPL
@@ -496,6 +500,16 @@ config ROCKCHIP_EXTERNAL_TPL
 	  Enable this option and build with ROCKCHIP_TPL=/path/to/ddr.bin to
 	  include the external TPL in the image built by binman.
 
+config VPL_ROCKCHIP_COMMON_BOARD
+	bool "Rockchip VPL common board file"
+	depends on VPL
+	default y
+	help
+	  Rockchip SoCs have similar boot process, prefer to use TPL to start
+	  VPL, then ATF for DRAM init and back to bootrom, and SPL as Trust
+	  ATF/U-Boot loader. VPL common board is a basic VPL board init which
+	  can be shared for most SoCs to avoid copy-paste for different SoCs.
+
 config ROCKCHIP_BOOT_MODE_REG
 	hex "Rockchip boot mode flag register address"
 	help
@@ -587,6 +601,9 @@ config TPL_ROCKCHIP_EARLYRETURN_TO_BROM
 config SPL_MMC
 	default y if !SPL_ROCKCHIP_BACK_TO_BROM
 
+config TPL_MMC
+	default y if !TPL_ROCKCHIP_BACK_TO_BROM
+
 config ROCKCHIP_SPI_IMAGE
 	bool "Build a SPI image for rockchip"
 	help
arch/arm/mach-rockchip/Makefile +5 -1
index 5e7edc99cdc..c878f2d3e8d 100644
@@ -13,6 +13,8 @@ obj-tpl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o
 obj-tpl-$(CONFIG_TPL_ROCKCHIP_COMMON_BOARD) += tpl.o spl_common.o
 obj-tpl-$(CONFIG_ROCKCHIP_PX30) += px30-board-tpl.o
 
+obj-vpl-$(CONFIG_VPL_ROCKCHIP_COMMON_BOARD) += vpl.o
+
 obj-spl-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board-spl.o
 
 ifeq ($(CONFIG_XPL_BUILD)$(CONFIG_TPL_BUILD),)
@@ -47,9 +49,11 @@ obj-$(CONFIG_ROCKCHIP_RK3588) += rk3588/
 obj-$(CONFIG_ROCKCHIP_RV1108) += rv1108/
 obj-$(CONFIG_ROCKCHIP_RV1126) += rv1126/
 
-# Clear out SPL objects, in case this is a TPL build
+# Clear out SPL objects, in case this is a TPL or VPL build
 obj-spl-$(CONFIG_TPL_BUILD) =
+obj-spl-$(CONFIG_VPL_BUILD) =
 
 # Now add SPL/TPL objects back into the main build
 obj-$(CONFIG_XPL_BUILD) += $(obj-spl-y)
 obj-$(CONFIG_TPL_BUILD) += $(obj-tpl-y)
+obj-$(CONFIG_VPL_BUILD) += $(obj-vpl-y)
arch/arm/mach-rockchip/rk3399/Kconfig +9 -0
index 04a84e2f6a0..fc55b498111 100644
@@ -164,6 +164,15 @@ config TPL_STACK
 config TPL_TEXT_BASE
         default 0xff8c2000
 
+config VPL_STACK
+        default 0xff8eff00
+
+config VPL_TEXT_BASE
+        default 0xff8c2000
+
+config VPL_LDSCRIPT
+	default "arch/arm/mach-rockchip/u-boot-vpl-v8.lds"
+
 config SPL_STACK_R_ADDR
 	default 0x04000000 if !SPL_SHARES_INIT_SP_ADDR
 
arch/arm/mach-rockchip/spl-boot-order.c +2 -1
index 3dce9b30898..d580d4fc84c 100644
@@ -99,7 +99,8 @@ __weak const char *board_spl_was_booted_from(void)
 void board_boot_order(u32 *spl_boot_list)
 {
 	/* In case of no fdt (or only plat), use spl_boot_device() */
-	if (!CONFIG_IS_ENABLED(OF_CONTROL) || CONFIG_IS_ENABLED(OF_PLATDATA)) {
+	if (IS_ENABLED(CONFIG_VPL) || !CONFIG_IS_ENABLED(OF_CONTROL) ||
+	    CONFIG_IS_ENABLED(OF_PLATDATA)) {
 		spl_boot_list[0] = spl_boot_device();
 		return;
 	}
arch/arm/mach-rockchip/spl.c +3 -0
index f4d29bbdd17..305373a161c 100644
@@ -61,6 +61,9 @@ u32 spl_boot_device(void)
 {
 	u32 boot_device = BOOT_DEVICE_MMC1;
 
+	if (IS_ENABLED(CONFIG_VPL))
+		return BOOT_DEVICE_VBE;
+
 #if defined(CONFIG_TARGET_CHROMEBOOK_JERRY) || \
 		defined(CONFIG_TARGET_CHROMEBIT_MICKEY) || \
 		defined(CONFIG_TARGET_CHROMEBOOK_MINNIE) || \
arch/arm/mach-rockchip/tpl.c +1 -1
index 6b880f19f84..cc794a7dca2 100644
@@ -84,5 +84,5 @@ int board_return_to_bootrom(struct spl_image_info *spl_image,
 
 u32 spl_boot_device(void)
 {
-	return BOOT_DEVICE_BOOTROM;
+	return IS_ENABLED(CONFIG_VPL) ? BOOT_DEVICE_VBE : BOOT_DEVICE_BOOTROM;
 }
arch/arm/mach-rockchip/u-boot-vpl-v8.lds new file +107 -0

107 lines not on this page · raw message

arch/arm/mach-rockchip/vpl.c new file +53 -0

53 lines not on this page · raw message

common/spl/Kconfig +1 -0
index a250bde779f..92cc83be436 100644
@@ -554,6 +554,7 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR
 	default 0x200 if ARCH_SOCFPGA || ARCH_AT91
 	default 0x300 if ARCH_ZYNQ || ARCH_KEYSTONE || OMAP34XX || \
 		         OMAP54XX || AM33XX || AM43XX || ARCH_K3
+	default 0x800 if ARCH_ROCKCHIP && VPL
 	default 0x4000 if ARCH_ROCKCHIP
 	default 0x822 if TARGET_SIFIVE_UNLEASHED || TARGET_SIFIVE_UNMATCHED
 	help
Signature · 1 line
2.43.0
#46 lore raw

Re: [PATCH 21/29] rockchip: Provide a VPL phase on rk3399

Hi Simon,

Quoted 3 lines · Simon Glass

Add support for this new phase, which runs after TPL. It determines the state of the machine, then selects which SPL image to use. SDRAM init is then done in SPL, so that it is updatable.

I am still unsure how this makes it more updatable, what happen when DRAM init fails and board freezes? Are we relying on e.g. a watchdog to properly reset a frozen board and try next image?

Quoted 18 lines

---

 arch/arm/include/asm/spl.h               |   1 +
 arch/arm/mach-rockchip/Kconfig           |  25 +++++-
 arch/arm/mach-rockchip/Makefile          |   6 +-
 arch/arm/mach-rockchip/rk3399/Kconfig    |   9 ++
 arch/arm/mach-rockchip/spl-boot-order.c  |   3 +-
 arch/arm/mach-rockchip/spl.c             |   3 +
 arch/arm/mach-rockchip/tpl.c             |   2 +-
 arch/arm/mach-rockchip/u-boot-vpl-v8.lds | 107 +++++++++++++++++++++++
 arch/arm/mach-rockchip/vpl.c             |  53 +++++++++++
 common/spl/Kconfig                       |   1 +
 10 files changed, 203 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/mach-rockchip/u-boot-vpl-v8.lds
 create mode 100644 arch/arm/mach-rockchip/vpl.c

[snip]

Quoted 4 lines
arch/arm/mach-rockchip/Kconfig +0 -0
index 269c219a6f8..7e6e9411e79 100644

[snip]

Quoted 12 lines
arch/arm/mach-rockchip/Kconfig +1 -1
@@ -455,7 +459,7 @@ config SPL_ROCKCHIP_BACK_TO_BROM
 
 config TPL_ROCKCHIP_BACK_TO_BROM
 	bool "TPL returns to bootrom"
-	default y
+	default y if !VPL
 	select ROCKCHIP_BROM_HELPER if !ROCKCHIP_RK3066
 	select TPL_BOOTROM_SUPPORT
 	depends on TPL
@@ -496,6 +500,16 @@ config ROCKCHIP_EXTERNAL_TPL
 	  Enable this option and build with ROCKCHIP_TPL=/path/to/ddr.bin to
 	  include the external TPL in the image built by binman.

arch/arm/mach-rockchip/Kconfig config ROCKCHIP_EXTERNAL_TPL · line 511

Quoted 10 lines
arch/arm/mach-rockchip/Kconfig +9 -0
 
+config VPL_ROCKCHIP_COMMON_BOARD
+	bool "Rockchip VPL common board file"
+	depends on VPL
+	default y
+	help
+	  Rockchip SoCs have similar boot process, prefer to use TPL to start
+	  VPL, then ATF for DRAM init and back to bootrom, and SPL as Trust
+	  ATF/U-Boot loader. VPL common board is a basic VPL board init which
+	  can be shared for most SoCs to avoid copy-paste for different SoCs.

This help text is not correct, with VPL=y back to bootrom is not used and TF-A is never used for DRAM init, only TPL/SPL or Rockchip TPL.

Quoted 4 lines
arch/arm/mach-rockchip/Kconfig +1 -0
+
 config ROCKCHIP_BOOT_MODE_REG
 	hex "Rockchip boot mode flag register address"
 	help

[snip]

Quoted 5 lines
arch/arm/mach-rockchip/spl-boot-order.c +0 -0
index 3dce9b30898..d580d4fc84c 100644

arch/arm/mach-rockchip/spl-boot-order.c __weak const char *board_spl_was_booted_from(void) · line 106

Quoted 9 lines
arch/arm/mach-rockchip/spl-boot-order.c +2 -1
@@ -99,7 +99,8 @@ __weak const char *board_spl_was_booted_from(void)
 void board_boot_order(u32 *spl_boot_list)
 {
 	/* In case of no fdt (or only plat), use spl_boot_device() */
-	if (!CONFIG_IS_ENABLED(OF_CONTROL) || CONFIG_IS_ENABLED(OF_PLATDATA)) {
+	if (IS_ENABLED(CONFIG_VPL) || !CONFIG_IS_ENABLED(OF_CONTROL) ||
+	    CONFIG_IS_ENABLED(OF_PLATDATA)) {
 		spl_boot_list[0] = spl_boot_device();
 		return;
 	}

Another option could be to just skip spl-boot-order.o for VPL, the default implementation should work as-is, not sure what is best.

Regards,
Jonas

Quoted 25 lines
arch/arm/mach-rockchip/spl.c +3 -0
index f4d29bbdd17..305373a161c 100644
@@ -61,6 +61,9 @@ u32 spl_boot_device(void)
 {
 	u32 boot_device = BOOT_DEVICE_MMC1;
 
+	if (IS_ENABLED(CONFIG_VPL))
+		return BOOT_DEVICE_VBE;
+
 #if defined(CONFIG_TARGET_CHROMEBOOK_JERRY) || \
 		defined(CONFIG_TARGET_CHROMEBIT_MICKEY) || \
 		defined(CONFIG_TARGET_CHROMEBOOK_MINNIE) || \
arch/arm/mach-rockchip/tpl.c +1 -1
index 6b880f19f84..cc794a7dca2 100644
@@ -84,5 +84,5 @@ int board_return_to_bootrom(struct spl_image_info *spl_image,
 
 u32 spl_boot_device(void)
 {
-	return BOOT_DEVICE_BOOTROM;
+	return IS_ENABLED(CONFIG_VPL) ? BOOT_DEVICE_VBE : BOOT_DEVICE_BOOTROM;
 }

[snip]

#47 lore raw

Re: [PATCH 21/29] rockchip: Provide a VPL phase on rk3399

Hi Jonas,

Quoted 11 lines · Jonas Karlman

Hi Simon,

Quoted 3 lines · Simon Glass

Add support for this new phase, which runs after TPL. It determines the state of the machine, then selects which SPL image to use. SDRAM init is then done in SPL, so that it is updatable.

I am still unsure how this makes it more updatable, what happen when DRAM init fails and board freezes? Are we relying on e.g. a watchdog to properly reset a frozen board and try next image?

Yes, that's right. Also, when you do an upgrade you are not changing the only copy, thus avoiding bricking devices with a bad or partial update.

Quoted 42 lines
Quoted 19 lines

---

 arch/arm/include/asm/spl.h               |   1 +
 arch/arm/mach-rockchip/Kconfig           |  25 +++++-
 arch/arm/mach-rockchip/Makefile          |   6 +-
 arch/arm/mach-rockchip/rk3399/Kconfig    |   9 ++
 arch/arm/mach-rockchip/spl-boot-order.c  |   3 +-
 arch/arm/mach-rockchip/spl.c             |   3 +
 arch/arm/mach-rockchip/tpl.c             |   2 +-
 arch/arm/mach-rockchip/u-boot-vpl-v8.lds | 107 +++++++++++++++++++++++
 arch/arm/mach-rockchip/vpl.c             |  53 +++++++++++
 common/spl/Kconfig                       |   1 +
 10 files changed, 203 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/mach-rockchip/u-boot-vpl-v8.lds
 create mode 100644 arch/arm/mach-rockchip/vpl.c

[snip]

Quoted 4 lines
arch/arm/mach-rockchip/Kconfig +0 -0
index 269c219a6f8..7e6e9411e79 100644

[snip]

Quoted 13 lines
arch/arm/mach-rockchip/Kconfig +1 -1
@@ -455,7 +459,7 @@ config SPL_ROCKCHIP_BACK_TO_BROM
 
 config TPL_ROCKCHIP_BACK_TO_BROM
      bool "TPL returns to bootrom"
-     default y
+     default y if !VPL
      select ROCKCHIP_BROM_HELPER if !ROCKCHIP_RK3066
      select TPL_BOOTROM_SUPPORT
      depends on TPL
@@ -496,6 +500,16 @@ config ROCKCHIP_EXTERNAL_TPL
        Enable this option and build with ROCKCHIP_TPL=/path/to/ddr.bin to
        include the external TPL in the image built by binman.
 
Quoted 12 lines

arch/arm/mach-rockchip/Kconfig config ROCKCHIP_EXTERNAL_TPL · line 511

Quoted 9 lines
arch/arm/mach-rockchip/Kconfig +9 -0
+config VPL_ROCKCHIP_COMMON_BOARD
+     bool "Rockchip VPL common board file"
+     depends on VPL
+     default y
+     help
+       Rockchip SoCs have similar boot process, prefer to use TPL to start
+       VPL, then ATF for DRAM init and back to bootrom, and SPL as Trust
+       ATF/U-Boot loader. VPL common board is a basic VPL board init which
+       can be shared for most SoCs to avoid copy-paste for different SoCs.

This help text is not correct, with VPL=y back to bootrom is not used and TF-A is never used for DRAM init, only TPL/SPL or Rockchip TPL.

OK I copied it from above. I'll rewrite it.

Quoted 17 lines
Quoted 5 lines
arch/arm/mach-rockchip/Kconfig +1 -0
+
 config ROCKCHIP_BOOT_MODE_REG
      hex "Rockchip boot mode flag register address"
      help

[snip]

Quoted 9 lines
arch/arm/mach-rockchip/spl-boot-order.c +0 -1
index 3dce9b30898..d580d4fc84c 100644
@@ -99,7 +99,8 @@ __weak const char *board_spl_was_booted_from(void)
 void board_boot_order(u32 *spl_boot_list)
 {
      /* In case of no fdt (or only plat), use spl_boot_device() */
-     if (!CONFIG_IS_ENABLED(OF_CONTROL) || CONFIG_IS_ENABLED(OF_PLATDATA)) {
Quoted 8 lines

arch/arm/mach-rockchip/spl-boot-order.c __weak const char *board_spl_was_booted_from(void) · line 106

Quoted 5 lines
arch/arm/mach-rockchip/spl-boot-order.c +2 -0
+     if (IS_ENABLED(CONFIG_VPL) || !CONFIG_IS_ENABLED(OF_CONTROL) ||
+         CONFIG_IS_ENABLED(OF_PLATDATA)) {
              spl_boot_list[0] = spl_boot_device();
              return;
      }

Another option could be to just skip spl-boot-order.o for VPL, the default implementation should work as-is, not sure what is best.

OK, I'll do that, thanks.

Regards,
Simon

#48 lore raw

Re: [PATCH 21/29] rockchip: Provide a VPL phase on rk3399

Hi Simon,

Quoted 11 lines · Simon Glass

Hi Jonas,

Quoted 8 lines · Jonas Karlman

Hi Simon,

Quoted 3 lines · Simon Glass

Add support for this new phase, which runs after TPL. It determines the state of the machine, then selects which SPL image to use. SDRAM init is then done in SPL, so that it is updatable.

Quoted 7 lines
Quoted 3 lines

I am still unsure how this makes it more updatable, what happen when DRAM init fails and board freezes? Are we relying on e.g. a watchdog to properly reset a frozen board and try next image?

Yes, that's right. Also, when you do an upgrade you are not changing the only copy, thus avoiding bricking devices with a bad or partial update.

Yes, it is unfortunate that the older Rockchip SoCs BootROM does not do hash/checksum validation, thankfully the newer SoCs does, so for newer SoCs it is more likely that bad code brick your device instead of a bad or partial update.

Also, Rockchips "Flash Open Source Solution Developer Guide" even recommend to write multiple idblock headers to flash storage, this may be something that we should consider. Typically, Rockchip BootROM will check 5 positions in MMC for a valid idblock.

Is there some code that configures a watchdog or similar that can help unfreeze due to a bad code update using this?

Regards,
Jonas

Quoted 88 lines
Quoted 43 lines
Quoted 20 lines

---

 arch/arm/include/asm/spl.h               |   1 +
 arch/arm/mach-rockchip/Kconfig           |  25 +++++-
 arch/arm/mach-rockchip/Makefile          |   6 +-
 arch/arm/mach-rockchip/rk3399/Kconfig    |   9 ++
 arch/arm/mach-rockchip/spl-boot-order.c  |   3 +-
 arch/arm/mach-rockchip/spl.c             |   3 +
 arch/arm/mach-rockchip/tpl.c             |   2 +-
 arch/arm/mach-rockchip/u-boot-vpl-v8.lds | 107 +++++++++++++++++++++++
 arch/arm/mach-rockchip/vpl.c             |  53 +++++++++++
 common/spl/Kconfig                       |   1 +
 10 files changed, 203 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/mach-rockchip/u-boot-vpl-v8.lds
 create mode 100644 arch/arm/mach-rockchip/vpl.c

[snip]

Quoted 4 lines
arch/arm/mach-rockchip/Kconfig +0 -0
index 269c219a6f8..7e6e9411e79 100644

[snip]

Quoted 13 lines
arch/arm/mach-rockchip/Kconfig +1 -1
@@ -455,7 +459,7 @@ config SPL_ROCKCHIP_BACK_TO_BROM
 
 config TPL_ROCKCHIP_BACK_TO_BROM
      bool "TPL returns to bootrom"
-     default y
+     default y if !VPL
      select ROCKCHIP_BROM_HELPER if !ROCKCHIP_RK3066
      select TPL_BOOTROM_SUPPORT
      depends on TPL
@@ -496,6 +500,16 @@ config ROCKCHIP_EXTERNAL_TPL
        Enable this option and build with ROCKCHIP_TPL=/path/to/ddr.bin to
        include the external TPL in the image built by binman.
 
Quoted 12 lines

arch/arm/mach-rockchip/Kconfig config ROCKCHIP_EXTERNAL_TPL · line 511

Quoted 9 lines
arch/arm/mach-rockchip/Kconfig +9 -0
+config VPL_ROCKCHIP_COMMON_BOARD
+     bool "Rockchip VPL common board file"
+     depends on VPL
+     default y
+     help
+       Rockchip SoCs have similar boot process, prefer to use TPL to start
+       VPL, then ATF for DRAM init and back to bootrom, and SPL as Trust
+       ATF/U-Boot loader. VPL common board is a basic VPL board init which
+       can be shared for most SoCs to avoid copy-paste for different SoCs.

This help text is not correct, with VPL=y back to bootrom is not used and TF-A is never used for DRAM init, only TPL/SPL or Rockchip TPL.

OK I copied it from above. I'll rewrite it.

Quoted 17 lines
Quoted 5 lines
arch/arm/mach-rockchip/Kconfig +1 -0
+
 config ROCKCHIP_BOOT_MODE_REG
      hex "Rockchip boot mode flag register address"
      help

[snip]

Quoted 9 lines
arch/arm/mach-rockchip/spl-boot-order.c +0 -1
index 3dce9b30898..d580d4fc84c 100644
@@ -99,7 +99,8 @@ __weak const char *board_spl_was_booted_from(void)
 void board_boot_order(u32 *spl_boot_list)
 {
      /* In case of no fdt (or only plat), use spl_boot_device() */
-     if (!CONFIG_IS_ENABLED(OF_CONTROL) || CONFIG_IS_ENABLED(OF_PLATDATA)) {
Quoted 8 lines

arch/arm/mach-rockchip/spl-boot-order.c __weak const char *board_spl_was_booted_from(void) · line 106

Quoted 5 lines
arch/arm/mach-rockchip/spl-boot-order.c +2 -0
+     if (IS_ENABLED(CONFIG_VPL) || !CONFIG_IS_ENABLED(OF_CONTROL) ||
+         CONFIG_IS_ENABLED(OF_PLATDATA)) {
              spl_boot_list[0] = spl_boot_device();
              return;
      }

Another option could be to just skip spl-boot-order.o for VPL, the default implementation should work as-is, not sure what is best.

OK, I'll do that, thanks.

Regards,
Simon

#49 lore raw

Re: [PATCH 21/29] rockchip: Provide a VPL phase on rk3399

Hi Jonas,

Quoted 28 lines · Jonas Karlman

Hi Simon,

Quoted 11 lines · Simon Glass

Hi Jonas,

Quoted 8 lines · Jonas Karlman

Hi Simon,

Quoted 3 lines · Simon Glass

Add support for this new phase, which runs after TPL. It determines the state of the machine, then selects which SPL image to use. SDRAM init is then done in SPL, so that it is updatable.

Quoted 7 lines
Quoted 3 lines

I am still unsure how this makes it more updatable, what happen when DRAM init fails and board freezes? Are we relying on e.g. a watchdog to properly reset a frozen board and try next image?

Yes, that's right. Also, when you do an upgrade you are not changing the only copy, thus avoiding bricking devices with a bad or partial update.

Yes, it is unfortunate that the older Rockchip SoCs BootROM does not do hash/checksum validation, thankfully the newer SoCs does, so for newer SoCs it is more likely that bad code brick your device instead of a bad or partial update.

Quoted 7 lines

Also, Rockchips "Flash Open Source Solution Developer Guide" even recommend to write multiple idblock headers to flash storage, this may be something that we should consider. Typically, Rockchip BootROM will check 5 positions in MMC for a valid idblock.

Is there some code that configures a watchdog or similar that can help unfreeze due to a bad code update using this?

Not yet, but it would be nice to have.

[..]

Regards,
Simon

#50 lore raw

PATCH 22/29 rockchip: Add symbols for spl_reloc

In reply to Simon Glass

Add various symbols so that this feature works as intended. This allows xPL to copy the relocating-jump code up to the top of memory, then use it to decompress and start the next phase.

---

 arch/arm/mach-rockchip/u-boot-tpl-v8.lds | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm/mach-rockchip/u-boot-tpl-v8.lds +13 -0
index 958a1b70aef..842bd4eb07f 100644
@@ -25,10 +25,21 @@ SECTIONS
 	__image_copy_start = ADDR(.text);
 	.text : {
 		. = ALIGN(8);
+		__image_copy_start = .;
 		CPUDIR/start.o (.text*)
+
+		/* put relocation code all together */
+		//. = . + 0xc0;
+		_rcode_start = .;
+		*(.text.rcode)
+		*(.text.rdata)
+		_rcode_end = .;
+
 		*(.text*)
 	}
 
+	_rcode_size = _rcode_end - _rcode_start;
+
 	.rodata : {
 		. = ALIGN(8);
 		*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))
@@ -48,6 +59,7 @@ SECTIONS
 	__image_copy_end = .;
 	_end = .;
 	_image_binary_end = .;
+	__image_copy_end = .;
 
 	.bss ALIGN(8) : {
 		__bss_start = .;
@@ -55,6 +67,7 @@ SECTIONS
 		. = ALIGN(8);
 		__bss_end = .;
 	}
+	__bss_size = __bss_end - __bss_start;
 
 	/DISCARD/ : { *(.dynsym) }
 	/DISCARD/ : { *(.dynstr*) }
Signature · 1 line
2.43.0
#51 lore raw

PATCH 23/29 rockchip: Adjust rk3399 TPL-stack to the same as SPL

In reply to Simon Glass

There doesn't seem to be a good reason to use a different value for TPL than SPL. Change the TPL value, since it allows a 256-byte bloblist to be safely located above the stack in all phases.

---

 arch/arm/mach-rockchip/rk3399/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-rockchip/rk3399/Kconfig +1 -1
index fc55b498111..8064b6286fc 100644
@@ -159,7 +159,7 @@ config TPL_LDSCRIPT
 	default "arch/arm/mach-rockchip/u-boot-tpl-v8.lds"
 
 config TPL_STACK
-        default 0xff8effff
+        default 0xff8eff00
 
 config TPL_TEXT_BASE
         default 0xff8c2000
Signature · 1 line
2.43.0
#52 lore raw

Re: [PATCH 23/29] rockchip: Adjust rk3399 TPL-stack to the same as SPL

Hi Simon,

Quoted 3 lines · Simon Glass

There doesn't seem to be a good reason to use a different value for TPL than SPL. Change the TPL value, since it allows a 256-byte bloblist to be safely located above the stack in all phases.

SPL is currently using DRAM memory as stack on all Rockchip AArch64 boards, so this commit subject and message does not make much sense.

Regards,
Jonas

Quoted 20 lines

---

 arch/arm/mach-rockchip/rk3399/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-rockchip/rk3399/Kconfig +1 -1
index fc55b498111..8064b6286fc 100644
@@ -159,7 +159,7 @@ config TPL_LDSCRIPT
 	default "arch/arm/mach-rockchip/u-boot-tpl-v8.lds"
 
 config TPL_STACK
-        default 0xff8effff
+        default 0xff8eff00
 
 config TPL_TEXT_BASE
         default 0xff8c2000
#53 lore raw

PATCH 24/29 rockchip: Allow SPL to set up SDRAM

In reply to Simon Glass

The current logic assumes that if TPL exists then it must be setting up the SDRAM. This is not true with VBE, so allow this to be controlled by whether CONFIG_TPL_RAM is enabled, or not.

---

 arch/arm/mach-rockchip/tpl.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
arch/arm/mach-rockchip/tpl.c +6 -4
index cc794a7dca2..2a261199179 100644
@@ -60,10 +60,12 @@ void board_init_f(ulong dummy)
 
 	tpl_board_init();
 
-	ret = uclass_get_device(UCLASS_RAM, 0, &dev);
-	if (ret) {
-		printf("DRAM init failed: %d\n", ret);
-		return;
+	if (CONFIG_IS_ENABLED(RAM)) {
+		ret = uclass_get_device(UCLASS_RAM, 0, &dev);
+		if (ret) {
+			printf("DRAM init failed: %d\n", ret);
+			return;
+		}
 	}
 }
 
Signature · 1 line
2.43.0
#54 lore raw

PATCH 25/29 rockchip: Add a generic rk3399 board

In reply to Simon Glass

This build-target is used to build an image which can run on multiple rk3399 boards, using VBE to boot.

To use it, the TPL binary for a particular board must be placed into the first part of the image. The rest of the image (i.e. VPL, SPL and U-Boot) are largely generic and can work on any supported board.

With VBE, memory-init happens in SPL so that this code is updatable in the field. Due to size constraints, the type of memory on the board is defined at build-time. So it is not possible to use the same VBE image on boards with different SDRAM (DDR3 vs LPDDR4 for example). This may become possible with newer boards with more SRAM.

---

 arch/arm/dts/rk3399-generic-u-boot.dtsi |  32 ++++++
 arch/arm/dts/rk3399-generic.dts         |  30 ++++++
 board/rockchip/evb_rk3399/MAINTAINERS   |   5 +
 configs/rk3399-generic_defconfig        | 133 ++++++++++++++++++++++++
 4 files changed, 200 insertions(+)
 create mode 100644 arch/arm/dts/rk3399-generic-u-boot.dtsi
 create mode 100644 arch/arm/dts/rk3399-generic.dts
 create mode 100644 configs/rk3399-generic_defconfig
arch/arm/dts/rk3399-generic-u-boot.dtsi new file +32 -0
new file mode 100644
index 00000000000..732727d9b03
@@ -0,0 +1,32 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Jagan Teki <[email protected]>
+ */
+
+#include "rk3399-u-boot.dtsi"
+#include "rk3399-sdram-lpddr4-100.dtsi"
+/ {
+	chosen {
+		u-boot,spl-boot-order = "same-as-spl", &spi_flash, &sdmmc, &sdhci;
+	};
+};
+
+&sdhci {
+	cap-mmc-highspeed;
+	mmc-ddr-1_8v;
+};
+
+&spi1 {
+	spi_flash: flash@0 {
+		bootph-all;
+	};
+};
+
+&vdd_center {
+	regulator-min-microvolt = <950000>;
+	regulator-max-microvolt = <950000>;
+};
+
+&vdd_log {
+	regulator-init-microvolt = <950000>;
+};
arch/arm/dts/rk3399-generic.dts new file +30 -0
new file mode 100644
index 00000000000..f13bb7f6b4b
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2017 Fuzhou Rockchip Electronics Co., Ltd.
+ * Copyright (c) 2018 Akash Gajjar <[email protected]>
+ * Copyright (c) 2019 Katsuhiro Suzuki <[email protected]>
+ */
+
+/dts-v1/;
+#include "rk3399-rockpro64.dtsi"
+
+/ {
+	model = "RK3399 Generic";
+	compatible = "pine64,rockpro64-v2.1", "pine64,rockpro64", "rockchip,rk3399";
+};
+
+&i2c1 {
+	es8316: codec@11 {
+		compatible = "everest,es8316";
+		reg = <0x11>;
+		clocks = <&cru SCLK_I2S_8CH_OUT>;
+		clock-names = "mclk";
+		#sound-dai-cells = <0>;
+
+		port {
+			es8316_p0_0: endpoint {
+				remote-endpoint = <&i2s1_p0_0>;
+			};
+		};
+	};
+};
board/rockchip/evb_rk3399/MAINTAINERS +5 -0
index 8dab3fa70f5..5f7c92230fb 100644
@@ -89,3 +89,8 @@ M:	Jagan Teki <[email protected]>
 S:	Maintained
 F:	configs/rock-pi-n10-rk3399pro_defconfig
 F:	arch/arm/dts/rk3399pro-rock-pi-n10*
+
+RK3399-GENERIC
+M:	Simon Glass <[email protected]>
+S:	Maintained
+F:	configs/rk3399-generic_defconfig
configs/rk3399-generic_defconfig new file +133 -0

133 lines not on this page · raw message

Signature · 1 line
2.43.0
#55 lore raw

Re: [PATCH 25/29] rockchip: Add a generic rk3399 board

Hi Simon,

Quoted 2 lines · Simon Glass

This build-target is used to build an image which can run on multiple rk3399 boards, using VBE to boot.

Since this target is intended to be used with VBE on LPDDR4 boards, can you use a different target name, maybe rk3399-vbe-lpddr4 or similar?

Quoted 4 lines

To use it, the TPL binary for a particular board must be placed into the first part of the image. The rest of the image (i.e. VPL, SPL and U-Boot) are largely generic and can work on any supported board.

I like the concept of this and I also think this can be supported using current "traditional" TPL+SPL and FIT separation with fit,compatible and FIT_BEST_MATCH, I will run some tests using that :-)

Also think with some cleanup work we should even be able to build a generic Rockchip AArch64 U-Boot proper FIT, for now there is parts that is too SoC dependent.

Quoted 25 lines

With VBE, memory-init happens in SPL so that this code is updatable in the field. Due to size constraints, the type of memory on the board is defined at build-time. So it is not possible to use the same VBE image on boards with different SDRAM (DDR3 vs LPDDR4 for example). This may become possible with newer boards with more SRAM.

---

 arch/arm/dts/rk3399-generic-u-boot.dtsi |  32 ++++++
 arch/arm/dts/rk3399-generic.dts         |  30 ++++++
 board/rockchip/evb_rk3399/MAINTAINERS   |   5 +
 configs/rk3399-generic_defconfig        | 133 ++++++++++++++++++++++++
 4 files changed, 200 insertions(+)
 create mode 100644 arch/arm/dts/rk3399-generic-u-boot.dtsi
 create mode 100644 arch/arm/dts/rk3399-generic.dts
 create mode 100644 configs/rk3399-generic_defconfig
arch/arm/dts/rk3399-generic-u-boot.dtsi new file +0 -0
new file mode 100644
index 00000000000..732727d9b03

arch/arm/dts/rk3399-generic-u-boot.dtsi line 7

Quoted 7 lines
arch/arm/dts/rk3399-generic-u-boot.dtsi new file +7 -0
@@ -0,0 +1,32 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Jagan Teki <[email protected]>
+ */
+
+#include "rk3399-u-boot.dtsi"
+#include "rk3399-sdram-lpddr4-100.dtsi"

This is not generic and limits this to lpddr4 boards.

Quoted 31 lines
arch/arm/dts/rk3399-generic-u-boot.dtsi new file +25 -0
+/ {
+	chosen {
+		u-boot,spl-boot-order = "same-as-spl", &spi_flash, &sdmmc, &sdhci;
+	};
+};
+
+&sdhci {
+	cap-mmc-highspeed;
+	mmc-ddr-1_8v;
+};
+
+&spi1 {
+	spi_flash: flash@0 {
+		bootph-all;
+	};
+};
+
+&vdd_center {
+	regulator-min-microvolt = <950000>;
+	regulator-max-microvolt = <950000>;
+};
+
+&vdd_log {
+	regulator-init-microvolt = <950000>;
+};
arch/arm/dts/rk3399-generic.dts new file +0 -0
new file mode 100644
index 00000000000..f13bb7f6b4b

arch/arm/dts/rk3399-generic.dts line 9

Quoted 9 lines
arch/arm/dts/rk3399-generic.dts new file +9 -0
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2017 Fuzhou Rockchip Electronics Co., Ltd.
+ * Copyright (c) 2018 Akash Gajjar <[email protected]>
+ * Copyright (c) 2019 Katsuhiro Suzuki <[email protected]>
+ */
+
+/dts-v1/;
+#include "rk3399-rockpro64.dtsi"

This is far from generic, please see my minimal generic dts at [1]. You can possible build something using that and a vbe-lpddr4-rk3399 defconfig or similar?

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

Regards,
Jonas

Quoted 21 lines
arch/arm/dts/rk3399-generic.dts new file +21 -0
+
+/ {
+	model = "RK3399 Generic";
+	compatible = "pine64,rockpro64-v2.1", "pine64,rockpro64", "rockchip,rk3399";
+};
+
+&i2c1 {
+	es8316: codec@11 {
+		compatible = "everest,es8316";
+		reg = <0x11>;
+		clocks = <&cru SCLK_I2S_8CH_OUT>;
+		clock-names = "mclk";
+		#sound-dai-cells = <0>;
+
+		port {
+			es8316_p0_0: endpoint {
+				remote-endpoint = <&i2s1_p0_0>;
+			};
+		};
+	};
+};

[snip]

#56 lore raw

Re: [PATCH 25/29] rockchip: Add a generic rk3399 board

Hi Jonas,

Quoted 11 lines · Jonas Karlman

Hi Simon,

Quoted 2 lines · Simon Glass

This build-target is used to build an image which can run on multiple rk3399 boards, using VBE to boot.

Since this target is intended to be used with VBE on LPDDR4 boards, can you use a different target name, maybe rk3399-vbe-lpddr4 or similar?

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

To use it, the TPL binary for a particular board must be placed into the first part of the image. The rest of the image (i.e. VPL, SPL and U-Boot) are largely generic and can work on any supported board.

I like the concept of this and I also think this can be supported using current "traditional" TPL+SPL and FIT separation with fit,compatible and FIT_BEST_MATCH, I will run some tests using that :-)

Yes, it should work.

Quoted 4 lines

Also think with some cleanup work we should even be able to build a generic Rockchip AArch64 U-Boot proper FIT, for now there is parts that is too SoC dependent.

Yes, I hope that all SoCs eventually go this way.

Quoted 20 lines
Quoted 20 lines

With VBE, memory-init happens in SPL so that this code is updatable in the field. Due to size constraints, the type of memory on the board is defined at build-time. So it is not possible to use the same VBE image on boards with different SDRAM (DDR3 vs LPDDR4 for example). This may become possible with newer boards with more SRAM.

---

 arch/arm/dts/rk3399-generic-u-boot.dtsi |  32 ++++++
 arch/arm/dts/rk3399-generic.dts         |  30 ++++++
 board/rockchip/evb_rk3399/MAINTAINERS   |   5 +
 configs/rk3399-generic_defconfig        | 133 ++++++++++++++++++++++++
 4 files changed, 200 insertions(+)
 create mode 100644 arch/arm/dts/rk3399-generic-u-boot.dtsi
 create mode 100644 arch/arm/dts/rk3399-generic.dts
 create mode 100644 configs/rk3399-generic_defconfig
Quoted 15 lines

arch/arm/dts/rk3399-generic-u-boot.dtsi line 7

Quoted 13 lines
arch/arm/dts/rk3399-generic-u-boot.dtsi new file +7 -0
new file mode 100644
index 00000000000..732727d9b03
@@ -0,0 +1,32 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Jagan Teki <[email protected]>
+ */
+
+#include "rk3399-u-boot.dtsi"
+#include "rk3399-sdram-lpddr4-100.dtsi"

This is not generic and limits this to lpddr4 boards.

In fact this isn't what I intended, so I'm going to change this file.

Quoted 37 lines
Quoted 37 lines
arch/arm/dts/rk3399-generic-u-boot.dtsi new file +25 -0
+/ {
+     chosen {
+             u-boot,spl-boot-order = "same-as-spl", &spi_flash, &sdmmc, &sdhci;
+     };
+};
+
+&sdhci {
+     cap-mmc-highspeed;
+     mmc-ddr-1_8v;
+};
+
+&spi1 {
+     spi_flash: flash@0 {
+             bootph-all;
+     };
+};
+
+&vdd_center {
+     regulator-min-microvolt = <950000>;
+     regulator-max-microvolt = <950000>;
+};
+
+&vdd_log {
+     regulator-init-microvolt = <950000>;
+};
arch/arm/dts/rk3399-generic.dts new file +5 -0
new file mode 100644
index 00000000000..f13bb7f6b4b
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2017 Fuzhou Rockchip Electronics Co., Ltd.
+ * Copyright (c) 2018 Akash Gajjar <[email protected]>
+ * Copyright (c) 2019 Katsuhiro Suzuki <[email protected]>
Quoted 8 lines

arch/arm/dts/rk3399-generic.dts line 9

Quoted 4 lines
arch/arm/dts/rk3399-generic.dts new file +4 -0
+ */
+
+/dts-v1/;
+#include "rk3399-rockpro64.dtsi"

This is far from generic, please see my minimal generic dts at [1]. You can possible build something using that and a vbe-lpddr4-rk3399 defconfig or similar?

Just a note on this...I like putting the SoC first (rk3399-generic) since it matches the devicetree naming. Also, if (as I hope) we end up with generic boards for all modern SoCs, we'll avoid having a directory full of 'generic-xxx' files. The differentiating piece is the SoC name, not that it is generic, so I think it should be first.

Regards,
Simon

Quoted 29 lines

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

Regards,
Jonas

Quoted 21 lines
arch/arm/dts/rk3399-generic.dts new file +21 -0
+
+/ {
+     model = "RK3399 Generic";
+     compatible = "pine64,rockpro64-v2.1", "pine64,rockpro64", "rockchip,rk3399";
+};
+
+&i2c1 {
+     es8316: codec@11 {
+             compatible = "everest,es8316";
+             reg = <0x11>;
+             clocks = <&cru SCLK_I2S_8CH_OUT>;
+             clock-names = "mclk";
+             #sound-dai-cells = <0>;
+
+             port {
+                     es8316_p0_0: endpoint {
+                             remote-endpoint = <&i2s1_p0_0>;
+                     };
+             };
+     };
+};

[snip]

#57 lore raw

PATCH 26/29 rockchip: Add documentation for VBE

In reply to Simon Glass

Now that VBE is running at a basic level on rk3399, add mention of it in the documentation.

---

 doc/board/rockchip/rockchip.rst | 13 +++++++++++++
 1 file changed, 13 insertions(+)
doc/board/rockchip/rockchip.rst +13 -0
index 9bab86d2347..97c2bf04b6d 100644
@@ -487,6 +487,19 @@ config-flash.ini:
         [OUTPUT]
         PATH=RK30xxLoader_uboot.bin
 
+Verified Boot for Embedded (VBE)
+--------------------------------
+
+VBE is supported on rk3399 at present, with SDRAM being set up in SPL. The full
+A/B/recovery flow is supported in U-Boot.
+
+To build this, use the rk3399-generic board, setting CONFIG_OF_LIST to the list
+of boards you want to support. All boards must use the same SDRAM type.
+
+VBE uses internal SRAM (IRAM) for the TPL, VPL and early SPL phases. The stack
+stop is near the top of this (0xff8eff00) with the 256-byte bloblist immediately
+following.
+
 TODO
 ----
 
Signature · 1 line
2.43.0
#58 lore raw

PATCH 27/29 gitlab: Add an VBE board to the sjg lab

In reply to Simon Glass

Add a rockchip rk3399 board which runs Verified Boot for Embedded.

---

 .gitlab-ci.yml | 6 ++++++
 1 file changed, 6 insertions(+)
.gitlab-ci.yml +6 -0
index 3487ad7e579..813db4df98c 100644
@@ -740,3 +740,9 @@ rpi5:
   variables:
     ROLE: rpi5
   <<: *lab_dfn
+
+# Firefly-RK3399 board running the rk3399-generic build
+vbe:
+  variables:
+    ROLE: vbe
+  <<: *lab_dfn
Signature · 1 line
2.43.0
#59 lore raw

PATCH 28/29 Revert "bloblist: Load the bloblist from the previous loader"

In reply to Simon Glass

The logic of this has become too confusing.

The primary issue with the patch is that U-Boot needs to set up a bloblist in the first phase where BLOBLIST is enabled. Subsequent phases can then use that bloblist.

But the first phase of U-Boot cannot assume that one exists.

Reverting this commit seems like a better starting point for getting things working for all use-cases.

This reverts commit 66131310d8ff1ba228f989b41bd8812f43be41c3.

https://lore.kernel.org/u-boot/CAPnjgZ3hMHtiH=f5ZKXNniOfV_-vFryq1Gn7QZ5hKU8Wjo8igw@mail.gmail.com/

---

 common/bloblist.c  | 64 ++++++++++++++--------------------------------
 include/bloblist.h | 10 --------
 2 files changed, 19 insertions(+), 55 deletions(-)
common/bloblist.c +19 -45
index e8acfc74331..7eda94ecdf9 100644
@@ -487,57 +487,37 @@ int bloblist_reloc(void *to, uint to_size)
 	return 0;
 }
 
-/*
- * Weak default function for getting bloblist from boot args.
- */
-int __weak xferlist_from_boot_arg(ulong __always_unused addr,
-				  ulong __always_unused size)
-{
-	return -ENOENT;
-}
-
 int bloblist_init(void)
 {
 	bool fixed = IS_ENABLED(CONFIG_BLOBLIST_FIXED);
 	int ret = -ENOENT;
-	ulong addr = 0, size;
-	/*
-	 * If U-Boot is not in the first phase, an existing bloblist must be
-	 * at a fixed address.
-	 */
-	bool from_addr = fixed && !xpl_is_first_phase();
-	/*
-	 * If U-Boot is in the first phase that an arch custom routine should
-	 * install the bloblist passed from previous loader to this fixed
+	ulong addr, size;
+	bool expected;
+
+	/**
+	 * We don't expect to find an existing bloblist in the first phase of
+	 * U-Boot that runs. Also we have no way to receive the address of an
+	 * allocated bloblist from a previous stage, so it must be at a fixed
 	 * address.
 	 */
-	bool from_boot_arg = fixed && xpl_is_first_phase();
-
+	expected = fixed && !xpl_is_first_phase();
 	if (xpl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST))
-		from_addr = false;
+		expected = false;
 	if (fixed)
 		addr = IF_ENABLED_INT(CONFIG_BLOBLIST_FIXED,
 				      CONFIG_BLOBLIST_ADDR);
 	size = CONFIG_BLOBLIST_SIZE;
-
-	if (from_boot_arg)
-		ret = xferlist_from_boot_arg(addr, size);
-	else if (from_addr)
+	if (expected) {
 		ret = bloblist_check(addr, size);
-
-	if (ret)
-		log_warning("Bloblist at %lx not found (err=%d)\n",
-			    addr, ret);
-	else
-		/* Get the real size */
-		size = gd->bloblist->total_size;
-
+		if (ret) {
+			log_warning("Expected bloblist at %lx not found (err=%d)\n",
+				    addr, ret);
+		} else {
+			/* Get the real size, if it is not what we expected */
+			size = gd->bloblist->total_size;
+		}
+	}
 	if (ret) {
-		/*
-		 * If we don't have a bloblist from a fixed address, or the one
-		 * in the fixed address is not valid. we must allocate the
-		 * memory for it now.
-		 */
 		if (CONFIG_IS_ENABLED(BLOBLIST_ALLOC)) {
 			void *ptr = memalign(BLOBLIST_ALIGN, size);
 
@@ -545,8 +525,7 @@ int bloblist_init(void)
 				return log_msg_ret("alloc", -ENOMEM);
 			addr = map_to_sysmem(ptr);
 		} else if (!fixed) {
-			return log_msg_ret("BLOBLIST_FIXED is not enabled",
-					   ret);
+			return log_msg_ret("!fixed", ret);
 		}
 		log_debug("Creating new bloblist size %lx at %lx\n", size,
 			  addr);
@@ -559,11 +538,6 @@ int bloblist_init(void)
 		return log_msg_ret("ini", ret);
 	gd->flags |= GD_FLG_BLOBLIST_READY;
 
-#ifdef DEBUG
-	bloblist_show_stats();
-	bloblist_show_list();
-#endif
-
 	return 0;
 }
 
include/bloblist.h +0 -10
index 1e1ca34aa92..5063ab66e4a 100644
@@ -482,14 +482,4 @@ static inline int bloblist_maybe_init(void)
  */
 int bloblist_check_reg_conv(ulong rfdt, ulong rzero, ulong rsig);
 
-/**
- * xferlist_from_boot_arg() - Get bloblist from the boot args and relocate it
- *			      to the specified address.
- *
- * @addr: Address for the bloblist
- * @size: Size of space reserved for the bloblist
- * Return: 0 if OK, else on error
- */
-int xferlist_from_boot_arg(ulong addr, ulong size);
-
 #endif /* __BLOBLIST_H */
Signature · 1 line
2.43.0
#60 lore raw

Re: [PATCH 28/29] Revert "bloblist: Load the bloblist from the previous loader"

Quoted 8 lines · Simon Glass

The logic of this has become too confusing.

The primary issue with the patch is that U-Boot needs to set up a bloblist in the first phase where BLOBLIST is enabled. Subsequent phases can then use that bloblist.

But the first phase of U-Boot cannot assume that one exists.

Quoted 7 lines

Reverting this commit seems like a better starting point for getting things working for all use-cases.

This reverts commit 66131310d8ff1ba228f989b41bd8812f43be41c3.

https://lore.kernel.org/u-boot/CAPnjgZ3hMHtiH=f5ZKXNniOfV_-vFryq1Gn7QZ5hKU8Wjo8igw@mail.gmail.com/

Perhaps the answer is to untie "do we have a bloblist / standard passage handoff" from "allocate and create one". As with your series here you're no longer declaring one at a fixed address yes?

Signature · 1 line
Tom
#61 lore raw

Re: [PATCH 28/29] Revert "bloblist: Load the bloblist from the previous loader"

In reply to Simon Glass

+CC Ilias,

Hi Simon,

Quoted 9 lines · Simon Glass

The logic of this has become too confusing.

The primary issue with the patch is that U-Boot needs to set up a bloblist in the first phase where BLOBLIST is enabled. Subsequent phases can then use that bloblist.

But the first phase of U-Boot cannot assume that one exists.

Quoted 9 lines

Reverting this commit seems like a better starting point for getting things working for all use-cases.

This reverts commit 66131310d8ff1ba228f989b41bd8812f43be41c3.

https://lore.kernel.org/u-boot/CAPnjgZ3hMHtiH=f5ZKXNniOfV_-vFryq1Gn7QZ5hKU8Wjo8igw@mail.gmail.com/

---

If my understanding is correct, you want to add some logic to control when the U-Boot should or should not get the bloblist from the existing register argument.
But xferlist_from_boot_arg() should be called when a valid register argument is there, I didn't see this in your patch.
Maybe you plan to do this with other patch series, but simply reverting this results in a breaking of handoff policy and the firmware handoff won't work.

Regards,
Raymond

Quoted 128 lines
 common/bloblist.c  | 64 ++++++++++++++--------------------------------
 include/bloblist.h | 10 --------
 2 files changed, 19 insertions(+), 55 deletions(-)
common/bloblist.c +19 -45
index e8acfc74331..7eda94ecdf9 100644
@@ -487,57 +487,37 @@ int bloblist_reloc(void *to, uint to_size)
        return 0;
 }
 
-/*
- * Weak default function for getting bloblist from boot args.
- */
-int __weak xferlist_from_boot_arg(ulong __always_unused addr,
-                                 ulong __always_unused size)
-{
-       return -ENOENT;
-}
-
 int bloblist_init(void)
 {
        bool fixed = IS_ENABLED(CONFIG_BLOBLIST_FIXED);
        int ret = -ENOENT;
-       ulong addr = 0, size;
-       /*
-        * If U-Boot is not in the first phase, an existing bloblist must be
-        * at a fixed address.
-        */
-       bool from_addr = fixed && !xpl_is_first_phase();
-       /*
-        * If U-Boot is in the first phase that an arch custom routine should
-        * install the bloblist passed from previous loader to this fixed
+       ulong addr, size;
+       bool expected;
+
+       /**
+        * We don't expect to find an existing bloblist in the first phase of
+        * U-Boot that runs. Also we have no way to receive the address of an
+        * allocated bloblist from a previous stage, so it must be at a fixed
         * address.
         */
-       bool from_boot_arg = fixed && xpl_is_first_phase();
-
+       expected = fixed && !xpl_is_first_phase();
        if (xpl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST))
-               from_addr = false;
+               expected = false;
        if (fixed)
                addr = IF_ENABLED_INT(CONFIG_BLOBLIST_FIXED,
                                      CONFIG_BLOBLIST_ADDR);
        size = CONFIG_BLOBLIST_SIZE;
-
-       if (from_boot_arg)
-               ret = xferlist_from_boot_arg(addr, size);
-       else if (from_addr)
+       if (expected) {
                ret = bloblist_check(addr, size);
-
-       if (ret)
-               log_warning("Bloblist at %lx not found (err=%d)\n",
-                           addr, ret);
-       else
-               /* Get the real size */
-               size = gd->bloblist->total_size;
-
+               if (ret) {
+                       log_warning("Expected bloblist at %lx not found (err=%d)\n",
+                                   addr, ret);
+               } else {
+                       /* Get the real size, if it is not what we expected */
+                       size = gd->bloblist->total_size;
+               }
+       }
        if (ret) {
-               /*
-                * If we don't have a bloblist from a fixed address, or the one
-                * in the fixed address is not valid. we must allocate the
-                * memory for it now.
-                */
                if (CONFIG_IS_ENABLED(BLOBLIST_ALLOC)) {
                        void *ptr = memalign(BLOBLIST_ALIGN, size);
 
@@ -545,8 +525,7 @@ int bloblist_init(void)
                                return log_msg_ret("alloc", -ENOMEM);
                        addr = map_to_sysmem(ptr);
                } else if (!fixed) {
-                       return log_msg_ret("BLOBLIST_FIXED is not enabled",
-                                          ret);
+                       return log_msg_ret("!fixed", ret);
                }
                log_debug("Creating new bloblist size %lx at %lx\n", size,
                          addr);
@@ -559,11 +538,6 @@ int bloblist_init(void)
                return log_msg_ret("ini", ret);
        gd->flags |= GD_FLG_BLOBLIST_READY;
 
-#ifdef DEBUG
-       bloblist_show_stats();
-       bloblist_show_list();
-#endif
-
        return 0;
 }
 
include/bloblist.h +0 -11
index 1e1ca34aa92..5063ab66e4a 100644
@@ -482,14 +482,4 @@ static inline int bloblist_maybe_init(void)
  */
 int bloblist_check_reg_conv(ulong rfdt, ulong rzero, ulong rsig);
 
-/**
- * xferlist_from_boot_arg() - Get bloblist from the boot args and relocate it
- *                           to the specified address.
- *
- * @addr: Address for the bloblist
- * @size: Size of space reserved for the bloblist
- * Return: 0 if OK, else on error
- */
-int xferlist_from_boot_arg(ulong addr, ulong size);
-
 #endif /* __BLOBLIST_H */
--

2.43.0

#62 lore raw

Re: [PATCH 28/29] Revert "bloblist: Load the bloblist from the previous loader"

Hi Raymond,

Quoted 25 lines · Raymond Mao

+CC Ilias,

Hi Simon,

Quoted 9 lines · Simon Glass

The logic of this has become too confusing.

The primary issue with the patch is that U-Boot needs to set up a bloblist in the first phase where BLOBLIST is enabled. Subsequent phases can then use that bloblist.

But the first phase of U-Boot cannot assume that one exists.

Quoted 9 lines

Reverting this commit seems like a better starting point for getting things working for all use-cases.

This reverts commit 66131310d8ff1ba228f989b41bd8812f43be41c3.

https://lore.kernel.org/u-boot/CAPnjgZ3hMHtiH=f5ZKXNniOfV_-vFryq1Gn7QZ5hKU8Wjo8igw@mail.gmail.com/

---

Quoted 8 lines

If my understanding is correct, you want to add some logic to control when the U-Boot should or should not get the bloblist from the existing register argument.
But xferlist_from_boot_arg() should be called when a valid register argument is there, I didn't see this in your patch.
Maybe you plan to do this with other patch series, but simply reverting this results in a breaking of handoff policy and the firmware handoff won't work.

Yes, I certainly did not want to revert it, but the current code is too hard to understand and I did not look at it at the time it went in. I've had three tries at working with what you have here, but each turns to spaghetti.

I would like to build on this and get something running in CI which uses standard passage. As Tom suggests, perhaps we should disconnect bloblist and standard passage?

On the CI point, is there a board we could add that uses the xferlist_from_boot_arg() call?

Regards,
Simon

Quoted 132 lines

Regards,
Raymond

Quoted 128 lines
 common/bloblist.c  | 64 ++++++++++++++--------------------------------
 include/bloblist.h | 10 --------
 2 files changed, 19 insertions(+), 55 deletions(-)
common/bloblist.c +19 -45
index e8acfc74331..7eda94ecdf9 100644
@@ -487,57 +487,37 @@ int bloblist_reloc(void *to, uint to_size)
        return 0;
 }
 
-/*
- * Weak default function for getting bloblist from boot args.
- */
-int __weak xferlist_from_boot_arg(ulong __always_unused addr,
-                                 ulong __always_unused size)
-{
-       return -ENOENT;
-}
-
 int bloblist_init(void)
 {
        bool fixed = IS_ENABLED(CONFIG_BLOBLIST_FIXED);
        int ret = -ENOENT;
-       ulong addr = 0, size;
-       /*
-        * If U-Boot is not in the first phase, an existing bloblist must be
-        * at a fixed address.
-        */
-       bool from_addr = fixed && !xpl_is_first_phase();
-       /*
-        * If U-Boot is in the first phase that an arch custom routine should
-        * install the bloblist passed from previous loader to this fixed
+       ulong addr, size;
+       bool expected;
+
+       /**
+        * We don't expect to find an existing bloblist in the first phase of
+        * U-Boot that runs. Also we have no way to receive the address of an
+        * allocated bloblist from a previous stage, so it must be at a fixed
         * address.
         */
-       bool from_boot_arg = fixed && xpl_is_first_phase();
-
+       expected = fixed && !xpl_is_first_phase();
        if (xpl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST))
-               from_addr = false;
+               expected = false;
        if (fixed)
                addr = IF_ENABLED_INT(CONFIG_BLOBLIST_FIXED,
                                      CONFIG_BLOBLIST_ADDR);
        size = CONFIG_BLOBLIST_SIZE;
-
-       if (from_boot_arg)
-               ret = xferlist_from_boot_arg(addr, size);
-       else if (from_addr)
+       if (expected) {
                ret = bloblist_check(addr, size);
-
-       if (ret)
-               log_warning("Bloblist at %lx not found (err=%d)\n",
-                           addr, ret);
-       else
-               /* Get the real size */
-               size = gd->bloblist->total_size;
-
+               if (ret) {
+                       log_warning("Expected bloblist at %lx not found (err=%d)\n",
+                                   addr, ret);
+               } else {
+                       /* Get the real size, if it is not what we expected */
+                       size = gd->bloblist->total_size;
+               }
+       }
        if (ret) {
-               /*
-                * If we don't have a bloblist from a fixed address, or the one
-                * in the fixed address is not valid. we must allocate the
-                * memory for it now.
-                */
                if (CONFIG_IS_ENABLED(BLOBLIST_ALLOC)) {
                        void *ptr = memalign(BLOBLIST_ALIGN, size);
 
@@ -545,8 +525,7 @@ int bloblist_init(void)
                                return log_msg_ret("alloc", -ENOMEM);
                        addr = map_to_sysmem(ptr);
                } else if (!fixed) {
-                       return log_msg_ret("BLOBLIST_FIXED is not enabled",
-                                          ret);
+                       return log_msg_ret("!fixed", ret);
                }
                log_debug("Creating new bloblist size %lx at %lx\n", size,
                          addr);
@@ -559,11 +538,6 @@ int bloblist_init(void)
                return log_msg_ret("ini", ret);
        gd->flags |= GD_FLG_BLOBLIST_READY;
 
-#ifdef DEBUG
-       bloblist_show_stats();
-       bloblist_show_list();
-#endif
-
        return 0;
 }
 
include/bloblist.h +0 -11
index 1e1ca34aa92..5063ab66e4a 100644
@@ -482,14 +482,4 @@ static inline int bloblist_maybe_init(void)
  */
 int bloblist_check_reg_conv(ulong rfdt, ulong rzero, ulong rsig);
 
-/**
- * xferlist_from_boot_arg() - Get bloblist from the boot args and relocate it
- *                           to the specified address.
- *
- * @addr: Address for the bloblist
- * @size: Size of space reserved for the bloblist
- * Return: 0 if OK, else on error
- */
-int xferlist_from_boot_arg(ulong addr, ulong size);
-
 #endif /* __BLOBLIST_H */
--

2.43.0

#63 lore raw

Re: [PATCH 28/29] Revert "bloblist: Load the bloblist from the previous loader"

Quoted 42 lines · Simon Glass

Hi Raymond,

Quoted 25 lines · Raymond Mao

+CC Ilias,

Hi Simon,

Quoted 9 lines · Simon Glass

The logic of this has become too confusing.

The primary issue with the patch is that U-Boot needs to set up a bloblist in the first phase where BLOBLIST is enabled. Subsequent phases can then use that bloblist.

But the first phase of U-Boot cannot assume that one exists.

Quoted 9 lines

Reverting this commit seems like a better starting point for getting things working for all use-cases.

This reverts commit 66131310d8ff1ba228f989b41bd8812f43be41c3.

https://lore.kernel.org/u-boot/CAPnjgZ3hMHtiH=f5ZKXNniOfV_-vFryq1Gn7QZ5hKU8Wjo8igw@mail.gmail.com/

---

Quoted 8 lines

If my understanding is correct, you want to add some logic to control when the U-Boot should or should not get the bloblist from the existing register argument.
But xferlist_from_boot_arg() should be called when a valid register argument is there, I didn't see this in your patch.
Maybe you plan to do this with other patch series, but simply reverting this results in a breaking of handoff policy and the firmware handoff won't work.

Yes, I certainly did not want to revert it, but the current code is too hard to understand and I did not look at it at the time it went in. I've had three tries at working with what you have here, but each turns to spaghetti.

Quoted 6 lines

I would like to build on this and get something running in CI which uses standard passage. As Tom suggests, perhaps we should disconnect bloblist and standard passage?

On the CI point, is there a board we could add that uses the xferlist_from_boot_arg() call?

Yes: https://patchwork.ozlabs.org/project/uboot/list/?series=442824

Signature · 1 line
Tom
#64 lore raw

Re: [PATCH 28/29] Revert "bloblist: Load the bloblist from the previous loader"

Hi Tom,

Quoted 44 lines · Tom Rini
Quoted 42 lines · Simon Glass

Hi Raymond,

Quoted 25 lines · Raymond Mao

+CC Ilias,

Hi Simon,

Quoted 9 lines · Simon Glass

The logic of this has become too confusing.

The primary issue with the patch is that U-Boot needs to set up a bloblist in the first phase where BLOBLIST is enabled. Subsequent phases can then use that bloblist.

But the first phase of U-Boot cannot assume that one exists.

Quoted 9 lines

Reverting this commit seems like a better starting point for getting things working for all use-cases.

This reverts commit 66131310d8ff1ba228f989b41bd8812f43be41c3.

https://lore.kernel.org/u-boot/CAPnjgZ3hMHtiH=f5ZKXNniOfV_-vFryq1Gn7QZ5hKU8Wjo8igw@mail.gmail.com/

---

Quoted 8 lines

If my understanding is correct, you want to add some logic to control when the U-Boot should or should not get the bloblist from the existing register argument.
But xferlist_from_boot_arg() should be called when a valid register argument is there, I didn't see this in your patch.
Maybe you plan to do this with other patch series, but simply reverting this results in a breaking of handoff policy and the firmware handoff won't work.

Yes, I certainly did not want to revert it, but the current code is too hard to understand and I did not look at it at the time it went in. I've had three tries at working with what you have here, but each turns to spaghetti.

Quoted 8 lines
Quoted 6 lines

I would like to build on this and get something running in CI which uses standard passage. As Tom suggests, perhaps we should disconnect bloblist and standard passage?

On the CI point, is there a board we could add that uses the xferlist_from_boot_arg() call?

Yes: https://patchwork.ozlabs.org/project/uboot/list/?series=442824

OK, so is that 'vexpress_ca9x4' in CI?

Assuming those patches are going in, it's all the more important that we apply this revert and tidy things up quickly.

Regards,
Simon

#65 lore raw

Re: [PATCH 28/29] Revert "bloblist: Load the bloblist from the previous loader"

In reply to Simon Glass

Hi Simon,

Quoted 38 lines · Simon Glass

Hi Raymond,

Quoted 25 lines · Raymond Mao

+CC Ilias,

Hi Simon,

Quoted 9 lines · Simon Glass

The logic of this has become too confusing.

The primary issue with the patch is that U-Boot needs to set up a bloblist in the first phase where BLOBLIST is enabled. Subsequent phases can then use that bloblist.

But the first phase of U-Boot cannot assume that one exists.

Quoted 9 lines

Reverting this commit seems like a better starting point for getting things working for all use-cases.

This reverts commit 66131310d8ff1ba228f989b41bd8812f43be41c3.

https://lore.kernel.org/u-boot/CAPnjgZ3hMHtiH=f5ZKXNniOfV_-vFryq1Gn7QZ5hKU8Wjo8igw@mail.gmail.com/

---

Quoted 8 lines

If my understanding is correct, you want to add some logic to control when the U-Boot should or should not get the bloblist from the existing register argument.
But xferlist_from_boot_arg() should be called when a valid register argument is there, I didn't see this in your patch.
Maybe you plan to do this with other patch series, but simply reverting this results in a breaking of handoff policy and the firmware handoff won't work.

Quoted 5 lines

Yes, I certainly did not want to revert it, but the current code is too hard to understand and I did not look at it at the time it went in. I've had three tries at working with what you have here, but each turns to spaghetti.

Still not very clear on what concerns you have and what is the way you want to go.
The logic is straight forward, when U-Boot has a previous loader and the registers pass in valid arguments - It indicates handoff should be done using the transfer list.
Other kconfig options decide whether to use the passed in address directly or copy to a predefined address.
But in either way, xferlist_from_boot_arg() is doing the right thing to get the transfer list from the register if it exists and is valid. I don't see a reason for removing it.

Regards,
Raymond

Quoted 142 lines

I would like to build on this and get something running in CI which uses standard passage. As Tom suggests, perhaps we should disconnect bloblist and standard passage?

On the CI point, is there a board we could add that uses the xferlist_from_boot_arg() call?

Regards,
Simon

Quoted 132 lines

Regards,
Raymond

Quoted 128 lines
 common/bloblist.c  | 64 ++++++++++++++--------------------------------
 include/bloblist.h | 10 --------
 2 files changed, 19 insertions(+), 55 deletions(-)
common/bloblist.c +19 -45
index e8acfc74331..7eda94ecdf9 100644
@@ -487,57 +487,37 @@ int bloblist_reloc(void *to, uint to_size)
        return 0;
 }
 
-/*
- * Weak default function for getting bloblist from boot args.
- */
-int __weak xferlist_from_boot_arg(ulong __always_unused addr,
-                                 ulong __always_unused size)
-{
-       return -ENOENT;
-}
-
 int bloblist_init(void)
 {
        bool fixed = IS_ENABLED(CONFIG_BLOBLIST_FIXED);
        int ret = -ENOENT;
-       ulong addr = 0, size;
-       /*
-        * If U-Boot is not in the first phase, an existing bloblist must be
-        * at a fixed address.
-        */
-       bool from_addr = fixed && !xpl_is_first_phase();
-       /*
-        * If U-Boot is in the first phase that an arch custom routine should
-        * install the bloblist passed from previous loader to this fixed
+       ulong addr, size;
+       bool expected;
+
+       /**
+        * We don't expect to find an existing bloblist in the first phase of
+        * U-Boot that runs. Also we have no way to receive the address of an
+        * allocated bloblist from a previous stage, so it must be at a fixed
         * address.
         */
-       bool from_boot_arg = fixed && xpl_is_first_phase();
-
+       expected = fixed && !xpl_is_first_phase();
        if (xpl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST))
-               from_addr = false;
+               expected = false;
        if (fixed)
                addr = IF_ENABLED_INT(CONFIG_BLOBLIST_FIXED,
                                      CONFIG_BLOBLIST_ADDR);
        size = CONFIG_BLOBLIST_SIZE;
-
-       if (from_boot_arg)
-               ret = xferlist_from_boot_arg(addr, size);
-       else if (from_addr)
+       if (expected) {
                ret = bloblist_check(addr, size);
-
-       if (ret)
-               log_warning("Bloblist at %lx not found (err=%d)\n",
-                           addr, ret);
-       else
-               /* Get the real size */
-               size = gd->bloblist->total_size;
-
+               if (ret) {
+                       log_warning("Expected bloblist at %lx not found (err=%d)\n",
+                                   addr, ret);
+               } else {
+                       /* Get the real size, if it is not what we expected */
+                       size = gd->bloblist->total_size;
+               }
+       }
        if (ret) {
-               /*
-                * If we don't have a bloblist from a fixed address, or the one
-                * in the fixed address is not valid. we must allocate the
-                * memory for it now.
-                */
                if (CONFIG_IS_ENABLED(BLOBLIST_ALLOC)) {
                        void *ptr = memalign(BLOBLIST_ALIGN, size);
 
@@ -545,8 +525,7 @@ int bloblist_init(void)
                                return log_msg_ret("alloc", -ENOMEM);
                        addr = map_to_sysmem(ptr);
                } else if (!fixed) {
-                       return log_msg_ret("BLOBLIST_FIXED is not enabled",
-                                          ret);
+                       return log_msg_ret("!fixed", ret);
                }
                log_debug("Creating new bloblist size %lx at %lx\n", size,
                          addr);
@@ -559,11 +538,6 @@ int bloblist_init(void)
                return log_msg_ret("ini", ret);
        gd->flags |= GD_FLG_BLOBLIST_READY;
 
-#ifdef DEBUG
-       bloblist_show_stats();
-       bloblist_show_list();
-#endif
-
        return 0;
 }
 
include/bloblist.h +0 -11
index 1e1ca34aa92..5063ab66e4a 100644
@@ -482,14 +482,4 @@ static inline int bloblist_maybe_init(void)
  */
 int bloblist_check_reg_conv(ulong rfdt, ulong rzero, ulong rsig);
 
-/**
- * xferlist_from_boot_arg() - Get bloblist from the boot args and relocate it
- *                           to the specified address.
- *
- * @addr: Address for the bloblist
- * @size: Size of space reserved for the bloblist
- * Return: 0 if OK, else on error
- */
-int xferlist_from_boot_arg(ulong addr, ulong size);
-
 #endif /* __BLOBLIST_H */
--

2.43.0

#66 lore raw

Re: [PATCH 28/29] Revert "bloblist: Load the bloblist from the previous loader"

Quoted 47 lines · Raymond Mao

Hi Simon,

Quoted 38 lines · Simon Glass

Hi Raymond,

Quoted 25 lines · Raymond Mao

+CC Ilias,

Hi Simon,

Quoted 9 lines · Simon Glass

The logic of this has become too confusing.

The primary issue with the patch is that U-Boot needs to set up a bloblist in the first phase where BLOBLIST is enabled. Subsequent phases can then use that bloblist.

But the first phase of U-Boot cannot assume that one exists.

Quoted 9 lines

Reverting this commit seems like a better starting point for getting things working for all use-cases.

This reverts commit 66131310d8ff1ba228f989b41bd8812f43be41c3.

https://lore.kernel.org/u-boot/CAPnjgZ3hMHtiH=f5ZKXNniOfV_-vFryq1Gn7QZ5hKU8Wjo8igw@mail.gmail.com/

---

Quoted 8 lines

If my understanding is correct, you want to add some logic to control when the U-Boot should or should not get the bloblist from the existing register argument.
But xferlist_from_boot_arg() should be called when a valid register argument is there, I didn't see this in your patch.
Maybe you plan to do this with other patch series, but simply reverting this results in a breaking of handoff policy and the firmware handoff won't work.

Quoted 5 lines

Yes, I certainly did not want to revert it, but the current code is too hard to understand and I did not look at it at the time it went in. I've had three tries at working with what you have here, but each turns to spaghetti.

Quoted 10 lines

Still not very clear on what concerns you have and what is the way you want to go.
The logic is straight forward, when U-Boot has a previous loader and the registers pass in valid arguments - It indicates handoff should be done using the transfer list.
Other kconfig options decide whether to use the passed in address directly or copy to a predefined address.
But in either way, xferlist_from_boot_arg() is doing the right thing to get the transfer list from the register if it exists and is valid. I don't see a reason for removing it.

Exactly. We aren't reverting anything in master. As far as I can tell the only problems we have are:
- No mechanism within U-Boot to pass a bloblist/handoff from one stage to another WITHOUT it being at a fixed address.
- The actions of "is there a bloblist" and "make a bloblist" are tied together, which is a problem with a fixed address being set in memory that is either maybe uninitialized or could be re-initialized.

But if we fix the former we don't really need to have the latter normally.

Signature · 1 line
Tom
#67 lore raw

Re: [PATCH 28/29] Revert "bloblist: Load the bloblist from the previous loader"

In reply to Raymond Mao

Hi Raymond,

Quoted 48 lines · Raymond Mao

Hi Simon,

Quoted 38 lines · Simon Glass

Hi Raymond,

Quoted 25 lines · Raymond Mao

+CC Ilias,

Hi Simon,

Quoted 9 lines · Simon Glass

The logic of this has become too confusing.

The primary issue with the patch is that U-Boot needs to set up a bloblist in the first phase where BLOBLIST is enabled. Subsequent phases can then use that bloblist.

But the first phase of U-Boot cannot assume that one exists.

Quoted 9 lines

Reverting this commit seems like a better starting point for getting things working for all use-cases.

This reverts commit 66131310d8ff1ba228f989b41bd8812f43be41c3.

https://lore.kernel.org/u-boot/CAPnjgZ3hMHtiH=f5ZKXNniOfV_-vFryq1Gn7QZ5hKU8Wjo8igw@mail.gmail.com/

---

Quoted 8 lines

If my understanding is correct, you want to add some logic to control when the U-Boot should or should not get the bloblist from the existing register argument.
But xferlist_from_boot_arg() should be called when a valid register argument is there, I didn't see this in your patch.
Maybe you plan to do this with other patch series, but simply reverting this results in a breaking of handoff policy and the firmware handoff won't work.

Quoted 5 lines

Yes, I certainly did not want to revert it, but the current code is too hard to understand and I did not look at it at the time it went in. I've had three tries at working with what you have here, but each turns to spaghetti.

Quoted 10 lines

Still not very clear on what concerns you have and what is the way you want to go.
The logic is straight forward, when U-Boot has a previous loader and the registers pass in valid arguments - It indicates handoff should be done using the transfer list.
Other kconfig options decide whether to use the passed in address directly or copy to a predefined address.
But in either way, xferlist_from_boot_arg() is doing the right thing to get the transfer list from the register if it exists and is valid. I don't see a reason for removing it.

Here is the initial code:

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

bool from_addr = fixed && !xpl_is_first_phase();
/*
* If U-Boot is in the first phase that an arch custom routine should
* install the bloblist passed from previous loader to this fixed
* address.
*/
bool from_boot_arg = fixed && xpl_is_first_phase();

if (xpl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST))
from_addr = false;
<<<<

and by the way, that is my tree. In -next it is even worse:

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

/*
* If U-Boot is not in the first phase, an existing bloblist must be
* at a fixed address.
*/
bool from_addr = fixed && !xpl_is_first_phase();
/*
* If U-Boot is in the first phase that an arch custom routine should
* install the bloblist passed from previous loader to this fixed
* address.
*/
bool from_boot_arg = fixed && xpl_is_first_phase();

if (xpl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST)) from_addr = false;
if (fixed)
addr = IF_ENABLED_INT(CONFIG_BLOBLIST_FIXED,

      CONFIG_BLOBLIST_ADDR);

size = CONFIG_BLOBLIST_SIZE;

if (from_boot_arg)
ret = xferlist_from_boot_arg(addr, size);
else if (from_addr)
ret = bloblist_check(addr, size);
<<<<

I want to update it so that TPL creates a bloblist and passes it through the following phases, ending up at U-Boot.

To my mind, if CONFIG_IS_ENABLED(BLOBLIST), then we should check the registers and always accept standard passage. If not, we should either:
- create a bloblist (if this *is* the first phase with CONFIG_IS_ENABLED(BLOBLIST))
- use an existing bloblistl, which must exist (if not)

I just don't think the existing logic is a good starting point as it is too confusing.

Perhaps, putting it another way, what do you like about the current code (either version)?

Regards,
Simon

Quoted 146 lines

Regards,
Raymond

Quoted 142 lines

I would like to build on this and get something running in CI which uses standard passage. As Tom suggests, perhaps we should disconnect bloblist and standard passage?

On the CI point, is there a board we could add that uses the xferlist_from_boot_arg() call?

Regards,
Simon

Quoted 132 lines

Regards,
Raymond

Quoted 128 lines
 common/bloblist.c  | 64 ++++++++++++++--------------------------------
 include/bloblist.h | 10 --------
 2 files changed, 19 insertions(+), 55 deletions(-)
common/bloblist.c +19 -45
index e8acfc74331..7eda94ecdf9 100644
@@ -487,57 +487,37 @@ int bloblist_reloc(void *to, uint to_size)
        return 0;
 }
 
-/*
- * Weak default function for getting bloblist from boot args.
- */
-int __weak xferlist_from_boot_arg(ulong __always_unused addr,
-                                 ulong __always_unused size)
-{
-       return -ENOENT;
-}
-
 int bloblist_init(void)
 {
        bool fixed = IS_ENABLED(CONFIG_BLOBLIST_FIXED);
        int ret = -ENOENT;
-       ulong addr = 0, size;
-       /*
-        * If U-Boot is not in the first phase, an existing bloblist must be
-        * at a fixed address.
-        */
-       bool from_addr = fixed && !xpl_is_first_phase();
-       /*
-        * If U-Boot is in the first phase that an arch custom routine should
-        * install the bloblist passed from previous loader to this fixed
+       ulong addr, size;
+       bool expected;
+
+       /**
+        * We don't expect to find an existing bloblist in the first phase of
+        * U-Boot that runs. Also we have no way to receive the address of an
+        * allocated bloblist from a previous stage, so it must be at a fixed
         * address.
         */
-       bool from_boot_arg = fixed && xpl_is_first_phase();
-
+       expected = fixed && !xpl_is_first_phase();
        if (xpl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST))
-               from_addr = false;
+               expected = false;
        if (fixed)
                addr = IF_ENABLED_INT(CONFIG_BLOBLIST_FIXED,
                                      CONFIG_BLOBLIST_ADDR);
        size = CONFIG_BLOBLIST_SIZE;
-
-       if (from_boot_arg)
-               ret = xferlist_from_boot_arg(addr, size);
-       else if (from_addr)
+       if (expected) {
                ret = bloblist_check(addr, size);
-
-       if (ret)
-               log_warning("Bloblist at %lx not found (err=%d)\n",
-                           addr, ret);
-       else
-               /* Get the real size */
-               size = gd->bloblist->total_size;
-
+               if (ret) {
+                       log_warning("Expected bloblist at %lx not found (err=%d)\n",
+                                   addr, ret);
+               } else {
+                       /* Get the real size, if it is not what we expected */
+                       size = gd->bloblist->total_size;
+               }
+       }
        if (ret) {
-               /*
-                * If we don't have a bloblist from a fixed address, or the one
-                * in the fixed address is not valid. we must allocate the
-                * memory for it now.
-                */
                if (CONFIG_IS_ENABLED(BLOBLIST_ALLOC)) {
                        void *ptr = memalign(BLOBLIST_ALIGN, size);
 
@@ -545,8 +525,7 @@ int bloblist_init(void)
                                return log_msg_ret("alloc", -ENOMEM);
                        addr = map_to_sysmem(ptr);
                } else if (!fixed) {
-                       return log_msg_ret("BLOBLIST_FIXED is not enabled",
-                                          ret);
+                       return log_msg_ret("!fixed", ret);
                }
                log_debug("Creating new bloblist size %lx at %lx\n", size,
                          addr);
@@ -559,11 +538,6 @@ int bloblist_init(void)
                return log_msg_ret("ini", ret);
        gd->flags |= GD_FLG_BLOBLIST_READY;
 
-#ifdef DEBUG
-       bloblist_show_stats();
-       bloblist_show_list();
-#endif
-
        return 0;
 }
 
include/bloblist.h +0 -11
index 1e1ca34aa92..5063ab66e4a 100644
@@ -482,14 +482,4 @@ static inline int bloblist_maybe_init(void)
  */
 int bloblist_check_reg_conv(ulong rfdt, ulong rzero, ulong rsig);
 
-/**
- * xferlist_from_boot_arg() - Get bloblist from the boot args and relocate it
- *                           to the specified address.
- *
- * @addr: Address for the bloblist
- * @size: Size of space reserved for the bloblist
- * Return: 0 if OK, else on error
- */
-int xferlist_from_boot_arg(ulong addr, ulong size);
-
 #endif /* __BLOBLIST_H */
--

2.43.0

#68 lore raw

Re: [PATCH 28/29] Revert "bloblist: Load the bloblist from the previous loader"

Quoted 113 lines · Simon Glass

Hi Raymond,

Quoted 48 lines · Raymond Mao

Hi Simon,

Quoted 38 lines · Simon Glass

Hi Raymond,

Quoted 25 lines · Raymond Mao

+CC Ilias,

Hi Simon,

Quoted 9 lines · Simon Glass

The logic of this has become too confusing.

The primary issue with the patch is that U-Boot needs to set up a bloblist in the first phase where BLOBLIST is enabled. Subsequent phases can then use that bloblist.

But the first phase of U-Boot cannot assume that one exists.

Quoted 9 lines

Reverting this commit seems like a better starting point for getting things working for all use-cases.

This reverts commit 66131310d8ff1ba228f989b41bd8812f43be41c3.

https://lore.kernel.org/u-boot/CAPnjgZ3hMHtiH=f5ZKXNniOfV_-vFryq1Gn7QZ5hKU8Wjo8igw@mail.gmail.com/

---

Quoted 8 lines

If my understanding is correct, you want to add some logic to control when the U-Boot should or should not get the bloblist from the existing register argument.
But xferlist_from_boot_arg() should be called when a valid register argument is there, I didn't see this in your patch.
Maybe you plan to do this with other patch series, but simply reverting this results in a breaking of handoff policy and the firmware handoff won't work.

Quoted 5 lines

Yes, I certainly did not want to revert it, but the current code is too hard to understand and I did not look at it at the time it went in. I've had three tries at working with what you have here, but each turns to spaghetti.

Quoted 10 lines

Still not very clear on what concerns you have and what is the way you want to go.
The logic is straight forward, when U-Boot has a previous loader and the registers pass in valid arguments - It indicates handoff should be done using the transfer list.
Other kconfig options decide whether to use the passed in address directly or copy to a predefined address.
But in either way, xferlist_from_boot_arg() is doing the right thing to get the transfer list from the register if it exists and is valid. I don't see a reason for removing it.

Here is the initial code:

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

bool from_addr = fixed && !xpl_is_first_phase();
/*
* If U-Boot is in the first phase that an arch custom routine should
* install the bloblist passed from previous loader to this fixed
* address.
*/
bool from_boot_arg = fixed && xpl_is_first_phase();

if (xpl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST))
from_addr = false;
<<<<

and by the way, that is my tree. In -next it is even worse:

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

/*
* If U-Boot is not in the first phase, an existing bloblist must be
* at a fixed address.
*/
bool from_addr = fixed && !xpl_is_first_phase();
/*
* If U-Boot is in the first phase that an arch custom routine should
* install the bloblist passed from previous loader to this fixed
* address.
*/
bool from_boot_arg = fixed && xpl_is_first_phase();

if (xpl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST)) from_addr = false;
if (fixed)
addr = IF_ENABLED_INT(CONFIG_BLOBLIST_FIXED,

      CONFIG_BLOBLIST_ADDR);

size = CONFIG_BLOBLIST_SIZE;

if (from_boot_arg)
ret = xferlist_from_boot_arg(addr, size);
else if (from_addr)
ret = bloblist_check(addr, size);
<<<<

I want to update it so that TPL creates a bloblist and passes it through the following phases, ending up at U-Boot.

To my mind, if CONFIG_IS_ENABLED(BLOBLIST), then we should check the registers and always accept standard passage. If not, we should either:
- create a bloblist (if this *is* the first phase with CONFIG_IS_ENABLED(BLOBLIST))
- use an existing bloblistl, which must exist (if not)

Quoted 5 lines

I just don't think the existing logic is a good starting point as it is too confusing.

Perhaps, putting it another way, what do you like about the current code (either version)?

We need to untie the check for and create logic. And we need to add code so that U-Boot can pass from one phase to the next without a fixed address. That should help simplify this logic and move towards being able to just drop the fixed case entirely.

Signature · 1 line
Tom
#69 lore raw

Re: [PATCH 28/29] Revert "bloblist: Load the bloblist from the previous loader"

Hi Tom,

Quoted 118 lines · Tom Rini
Quoted 116 lines · Simon Glass

Hi Raymond,

Quoted 48 lines · Raymond Mao

Hi Simon,

Quoted 38 lines · Simon Glass

Hi Raymond,

Quoted 25 lines · Raymond Mao

+CC Ilias,

Hi Simon,

Quoted 9 lines · Simon Glass

The logic of this has become too confusing.

The primary issue with the patch is that U-Boot needs to set up a bloblist in the first phase where BLOBLIST is enabled. Subsequent phases can then use that bloblist.

But the first phase of U-Boot cannot assume that one exists.

Quoted 9 lines

Reverting this commit seems like a better starting point for getting things working for all use-cases.

This reverts commit 66131310d8ff1ba228f989b41bd8812f43be41c3.

https://lore.kernel.org/u-boot/CAPnjgZ3hMHtiH=f5ZKXNniOfV_-vFryq1Gn7QZ5hKU8Wjo8igw@mail.gmail.com/

---

Quoted 8 lines

If my understanding is correct, you want to add some logic to control when the U-Boot should or should not get the bloblist from the existing register argument.
But xferlist_from_boot_arg() should be called when a valid register argument is there, I didn't see this in your patch.
Maybe you plan to do this with other patch series, but simply reverting this results in a breaking of handoff policy and the firmware handoff won't work.

Quoted 5 lines

Yes, I certainly did not want to revert it, but the current code is too hard to understand and I did not look at it at the time it went in. I've had three tries at working with what you have here, but each turns to spaghetti.

Quoted 10 lines

Still not very clear on what concerns you have and what is the way you want to go.
The logic is straight forward, when U-Boot has a previous loader and the registers pass in valid arguments - It indicates handoff should be done using the transfer list.
Other kconfig options decide whether to use the passed in address directly or copy to a predefined address.
But in either way, xferlist_from_boot_arg() is doing the right thing to get the transfer list from the register if it exists and is valid. I don't see a reason for removing it.

Here is the initial code:

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

bool from_addr = fixed && !xpl_is_first_phase();
/*
* If U-Boot is in the first phase that an arch custom routine should
* install the bloblist passed from previous loader to this fixed
* address.
*/
bool from_boot_arg = fixed && xpl_is_first_phase();

if (xpl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST))
from_addr = false;
<<<<

and by the way, that is my tree. In -next it is even worse:

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

/*
* If U-Boot is not in the first phase, an existing bloblist must be
* at a fixed address.
*/
bool from_addr = fixed && !xpl_is_first_phase();
/*
* If U-Boot is in the first phase that an arch custom routine should
* install the bloblist passed from previous loader to this fixed
* address.
*/
bool from_boot_arg = fixed && xpl_is_first_phase();

if (xpl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST)) from_addr = false;
if (fixed)
addr = IF_ENABLED_INT(CONFIG_BLOBLIST_FIXED,

      CONFIG_BLOBLIST_ADDR);

size = CONFIG_BLOBLIST_SIZE;

if (from_boot_arg)
ret = xferlist_from_boot_arg(addr, size);
else if (from_addr)
ret = bloblist_check(addr, size);
<<<<

I want to update it so that TPL creates a bloblist and passes it through the following phases, ending up at U-Boot.

To my mind, if CONFIG_IS_ENABLED(BLOBLIST), then we should check the registers and always accept standard passage. If not, we should either:
- create a bloblist (if this *is* the first phase with CONFIG_IS_ENABLED(BLOBLIST))
- use an existing bloblistl, which must exist (if not)

I just don't think the existing logic is a good starting point as it is too confusing.

Quoted 7 lines
Quoted 2 lines

Perhaps, putting it another way, what do you like about the current code (either version)?

We need to untie the check for and create logic. And we need to add code so that U-Boot can pass from one phase to the next without a fixed address. That should help simplify this logic and move towards being able to just drop the fixed case entirely.

Well, if you want me to do this, I can, but it needs to start with this revert. If someone else is going to do it, I'll cheer from the sidelines.

Regards,
SImon

#70 lore raw

Re: [PATCH 28/29] Revert "bloblist: Load the bloblist from the previous loader"

Quoted 124 lines · Simon Glass

Hi Tom,

Quoted 121 lines · Tom Rini
Quoted 118 lines · Simon Glass

Hi Raymond,

Quoted 48 lines · Raymond Mao

Hi Simon,

Quoted 38 lines · Simon Glass

Hi Raymond,

Quoted 25 lines · Raymond Mao

+CC Ilias,

Hi Simon,

Quoted 9 lines · Simon Glass

The logic of this has become too confusing.

The primary issue with the patch is that U-Boot needs to set up a bloblist in the first phase where BLOBLIST is enabled. Subsequent phases can then use that bloblist.

But the first phase of U-Boot cannot assume that one exists.

Quoted 9 lines

Reverting this commit seems like a better starting point for getting things working for all use-cases.

This reverts commit 66131310d8ff1ba228f989b41bd8812f43be41c3.

https://lore.kernel.org/u-boot/CAPnjgZ3hMHtiH=f5ZKXNniOfV_-vFryq1Gn7QZ5hKU8Wjo8igw@mail.gmail.com/

---

Quoted 8 lines

If my understanding is correct, you want to add some logic to control when the U-Boot should or should not get the bloblist from the existing register argument.
But xferlist_from_boot_arg() should be called when a valid register argument is there, I didn't see this in your patch.
Maybe you plan to do this with other patch series, but simply reverting this results in a breaking of handoff policy and the firmware handoff won't work.

Quoted 5 lines

Yes, I certainly did not want to revert it, but the current code is too hard to understand and I did not look at it at the time it went in. I've had three tries at working with what you have here, but each turns to spaghetti.

Quoted 10 lines

Still not very clear on what concerns you have and what is the way you want to go.
The logic is straight forward, when U-Boot has a previous loader and the registers pass in valid arguments - It indicates handoff should be done using the transfer list.
Other kconfig options decide whether to use the passed in address directly or copy to a predefined address.
But in either way, xferlist_from_boot_arg() is doing the right thing to get the transfer list from the register if it exists and is valid. I don't see a reason for removing it.

Here is the initial code:

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

bool from_addr = fixed && !xpl_is_first_phase();
/*
* If U-Boot is in the first phase that an arch custom routine should
* install the bloblist passed from previous loader to this fixed
* address.
*/
bool from_boot_arg = fixed && xpl_is_first_phase();

if (xpl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST))
from_addr = false;
<<<<

and by the way, that is my tree. In -next it is even worse:

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

/*
* If U-Boot is not in the first phase, an existing bloblist must be
* at a fixed address.
*/
bool from_addr = fixed && !xpl_is_first_phase();
/*
* If U-Boot is in the first phase that an arch custom routine should
* install the bloblist passed from previous loader to this fixed
* address.
*/
bool from_boot_arg = fixed && xpl_is_first_phase();

if (xpl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST)) from_addr = false;
if (fixed)
addr = IF_ENABLED_INT(CONFIG_BLOBLIST_FIXED,

      CONFIG_BLOBLIST_ADDR);

size = CONFIG_BLOBLIST_SIZE;

if (from_boot_arg)
ret = xferlist_from_boot_arg(addr, size);
else if (from_addr)
ret = bloblist_check(addr, size);
<<<<

I want to update it so that TPL creates a bloblist and passes it through the following phases, ending up at U-Boot.

To my mind, if CONFIG_IS_ENABLED(BLOBLIST), then we should check the registers and always accept standard passage. If not, we should either:
- create a bloblist (if this *is* the first phase with CONFIG_IS_ENABLED(BLOBLIST))
- use an existing bloblistl, which must exist (if not)

I just don't think the existing logic is a good starting point as it is too confusing.

Perhaps, putting it another way, what do you like about the current code (either version)?

Quoted 8 lines
Quoted 4 lines

We need to untie the check for and create logic. And we need to add code so that U-Boot can pass from one phase to the next without a fixed address. That should help simplify this logic and move towards being able to just drop the fixed case entirely.

Well, if you want me to do this, I can, but it needs to start with this revert. If someone else is going to do it, I'll cheer from the sidelines.

We aren't reverting what works for everyone else for the sake of your VBE series, so if you're going to pause that until someone else does it...

Signature · 1 line
Tom
#71 lore raw

Re: [PATCH 28/29] Revert "bloblist: Load the bloblist from the previous loader"

In reply to Simon Glass

Hi Simon,

Quoted 107 lines · Simon Glass

Hi Raymond,

Quoted 48 lines · Raymond Mao

Hi Simon,

Quoted 38 lines · Simon Glass

Hi Raymond,

Quoted 25 lines · Raymond Mao

+CC Ilias,

Hi Simon,

Quoted 9 lines · Simon Glass

The logic of this has become too confusing.

The primary issue with the patch is that U-Boot needs to set up a bloblist in the first phase where BLOBLIST is enabled. Subsequent phases can then use that bloblist.

But the first phase of U-Boot cannot assume that one exists.

Quoted 9 lines

Reverting this commit seems like a better starting point for getting things working for all use-cases.

This reverts commit 66131310d8ff1ba228f989b41bd8812f43be41c3.

https://lore.kernel.org/u-boot/CAPnjgZ3hMHtiH=f5ZKXNniOfV_-vFryq1Gn7QZ5hKU8Wjo8igw@mail.gmail.com/

---

Quoted 8 lines

If my understanding is correct, you want to add some logic to control when the U-Boot should or should not get the bloblist from the existing register argument.
But xferlist_from_boot_arg() should be called when a valid register argument is there, I didn't see this in your patch.
Maybe you plan to do this with other patch series, but simply reverting this results in a breaking of handoff policy and the firmware handoff won't work.

Quoted 5 lines

Yes, I certainly did not want to revert it, but the current code is too hard to understand and I did not look at it at the time it went in. I've had three tries at working with what you have here, but each turns to spaghetti.

Quoted 10 lines

Still not very clear on what concerns you have and what is the way you want to go.
The logic is straight forward, when U-Boot has a previous loader and the registers pass in valid arguments - It indicates handoff should be done using the transfer list.
Other kconfig options decide whether to use the passed in address directly or copy to a predefined address.
But in either way, xferlist_from_boot_arg() is doing the right thing to get the transfer list from the register if it exists and is valid. I don't see a reason for removing it.

Here is the initial code:

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

bool from_addr = fixed && !xpl_is_first_phase();
/*
* If U-Boot is in the first phase that an arch custom routine should
* install the bloblist passed from previous loader to this fixed
* address.
*/
bool from_boot_arg = fixed && xpl_is_first_phase();

if (xpl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST))
from_addr = false;
<<<<

and by the way, that is my tree. In -next it is even worse:

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

/*
* If U-Boot is not in the first phase, an existing bloblist must be
* at a fixed address.
*/
bool from_addr = fixed && !xpl_is_first_phase();
/*
* If U-Boot is in the first phase that an arch custom routine should
* install the bloblist passed from previous loader to this fixed
* address.
*/
bool from_boot_arg = fixed && xpl_is_first_phase();

if (xpl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST)) from_addr = false;
if (fixed)
addr = IF_ENABLED_INT(CONFIG_BLOBLIST_FIXED,

      CONFIG_BLOBLIST_ADDR);

size = CONFIG_BLOBLIST_SIZE;

if (from_boot_arg)
ret = xferlist_from_boot_arg(addr, size);
else if (from_addr)
ret = bloblist_check(addr, size);
<<<<

I want to update it so that TPL creates a bloblist and passes it through the following phases, ending up at U-Boot.

Quoted 7 lines

To my mind, if CONFIG_IS_ENABLED(BLOBLIST), then we should check the registers and always accept standard passage. If not, we should either:
- create a bloblist (if this *is* the first phase with CONFIG_IS_ENABLED(BLOBLIST))
- use an existing bloblistl, which must exist (if not)

To my mind, first we should check whether there is a valid transfer list passed in, which is done by xferlist_from_boot_arg().
If it does, and BLOBLIST is selected, then use the transfer list as bloblist. And we do need a new kconfig (e.g. FIRMWARE_HANDOFF_MANDATORY) to determine whether fw handoff is mandatory.

See below pseudo code:

```
if (!xferlist_from_boot_arg()) {
    /* a valid transfer list exists */
    if (!CONFIG_IS_ENABLED(BLOBLIST))
        return ERROR;

    /* use the transfer list as a bloblist */
    [...]
} else if (CONFIG_IS_ENABLED(FIRMWARE_HANDOFF_MANDATORY)) {
    /* no valid transfer list passed in, but the arm spec is mandatory */
    return ERROR;
} else {
    /* arm spec is not in use at all, create or use a static bloblist */
    [...]
}
```

Regards,
Raymond

Quoted 157 lines

I just don't think the existing logic is a good starting point as it is too confusing.

Perhaps, putting it another way, what do you like about the current code (either version)?

Regards,
Simon

Quoted 146 lines

Regards,
Raymond

Quoted 142 lines

I would like to build on this and get something running in CI which uses standard passage. As Tom suggests, perhaps we should disconnect bloblist and standard passage?

On the CI point, is there a board we could add that uses the xferlist_from_boot_arg() call?

Regards,
Simon

Quoted 132 lines

Regards,
Raymond

Quoted 128 lines
 common/bloblist.c  | 64 ++++++++++++++--------------------------------
 include/bloblist.h | 10 --------
 2 files changed, 19 insertions(+), 55 deletions(-)
common/bloblist.c +19 -45
index e8acfc74331..7eda94ecdf9 100644
@@ -487,57 +487,37 @@ int bloblist_reloc(void *to, uint to_size)
        return 0;
 }
 
-/*
- * Weak default function for getting bloblist from boot args.
- */
-int __weak xferlist_from_boot_arg(ulong __always_unused addr,
-                                 ulong __always_unused size)
-{
-       return -ENOENT;
-}
-
 int bloblist_init(void)
 {
        bool fixed = IS_ENABLED(CONFIG_BLOBLIST_FIXED);
        int ret = -ENOENT;
-       ulong addr = 0, size;
-       /*
-        * If U-Boot is not in the first phase, an existing bloblist must be
-        * at a fixed address.
-        */
-       bool from_addr = fixed && !xpl_is_first_phase();
-       /*
-        * If U-Boot is in the first phase that an arch custom routine should
-        * install the bloblist passed from previous loader to this fixed
+       ulong addr, size;
+       bool expected;
+
+       /**
+        * We don't expect to find an existing bloblist in the first phase of
+        * U-Boot that runs. Also we have no way to receive the address of an
+        * allocated bloblist from a previous stage, so it must be at a fixed
         * address.
         */
-       bool from_boot_arg = fixed && xpl_is_first_phase();
-
+       expected = fixed && !xpl_is_first_phase();
        if (xpl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST))
-               from_addr = false;
+               expected = false;
        if (fixed)
                addr = IF_ENABLED_INT(CONFIG_BLOBLIST_FIXED,
                                      CONFIG_BLOBLIST_ADDR);
        size = CONFIG_BLOBLIST_SIZE;
-
-       if (from_boot_arg)
-               ret = xferlist_from_boot_arg(addr, size);
-       else if (from_addr)
+       if (expected) {
                ret = bloblist_check(addr, size);
-
-       if (ret)
-               log_warning("Bloblist at %lx not found (err=%d)\n",
-                           addr, ret);
-       else
-               /* Get the real size */
-               size = gd->bloblist->total_size;
-
+               if (ret) {
+                       log_warning("Expected bloblist at %lx not found (err=%d)\n",
+                                   addr, ret);
+               } else {
+                       /* Get the real size, if it is not what we expected */
+                       size = gd->bloblist->total_size;
+               }
+       }
        if (ret) {
-               /*
-                * If we don't have a bloblist from a fixed address, or the one
-                * in the fixed address is not valid. we must allocate the
-                * memory for it now.
-                */
                if (CONFIG_IS_ENABLED(BLOBLIST_ALLOC)) {
                        void *ptr = memalign(BLOBLIST_ALIGN, size);
 
@@ -545,8 +525,7 @@ int bloblist_init(void)
                                return log_msg_ret("alloc", -ENOMEM);
                        addr = map_to_sysmem(ptr);
                } else if (!fixed) {
-                       return log_msg_ret("BLOBLIST_FIXED is not enabled",
-                                          ret);
+                       return log_msg_ret("!fixed", ret);
                }
                log_debug("Creating new bloblist size %lx at %lx\n", size,
                          addr);
@@ -559,11 +538,6 @@ int bloblist_init(void)
                return log_msg_ret("ini", ret);
        gd->flags |= GD_FLG_BLOBLIST_READY;
 
-#ifdef DEBUG
-       bloblist_show_stats();
-       bloblist_show_list();
-#endif
-
        return 0;
 }
 
include/bloblist.h +0 -11
index 1e1ca34aa92..5063ab66e4a 100644
@@ -482,14 +482,4 @@ static inline int bloblist_maybe_init(void)
  */
 int bloblist_check_reg_conv(ulong rfdt, ulong rzero, ulong rsig);
 
-/**
- * xferlist_from_boot_arg() - Get bloblist from the boot args and relocate it
- *                           to the specified address.
- *
- * @addr: Address for the bloblist
- * @size: Size of space reserved for the bloblist
- * Return: 0 if OK, else on error
- */
-int xferlist_from_boot_arg(ulong addr, ulong size);
-
 #endif /* __BLOBLIST_H */
--

2.43.0

#72 lore raw

Re: [PATCH 28/29] Revert "bloblist: Load the bloblist from the previous loader"

Hi Raymond,

Quoted 126 lines · Raymond Mao

Hi Simon,

Quoted 107 lines · Simon Glass

Hi Raymond,

Quoted 48 lines · Raymond Mao

Hi Simon,

Quoted 38 lines · Simon Glass

Hi Raymond,

Quoted 25 lines · Raymond Mao

+CC Ilias,

Hi Simon,

Quoted 9 lines · Simon Glass

The logic of this has become too confusing.

The primary issue with the patch is that U-Boot needs to set up a bloblist in the first phase where BLOBLIST is enabled. Subsequent phases can then use that bloblist.

But the first phase of U-Boot cannot assume that one exists.

Quoted 9 lines

Reverting this commit seems like a better starting point for getting things working for all use-cases.

This reverts commit 66131310d8ff1ba228f989b41bd8812f43be41c3.

https://lore.kernel.org/u-boot/CAPnjgZ3hMHtiH=f5ZKXNniOfV_-vFryq1Gn7QZ5hKU8Wjo8igw@mail.gmail.com/

---

Quoted 8 lines

If my understanding is correct, you want to add some logic to control when the U-Boot should or should not get the bloblist from the existing register argument.
But xferlist_from_boot_arg() should be called when a valid register argument is there, I didn't see this in your patch.
Maybe you plan to do this with other patch series, but simply reverting this results in a breaking of handoff policy and the firmware handoff won't work.

Quoted 5 lines

Yes, I certainly did not want to revert it, but the current code is too hard to understand and I did not look at it at the time it went in. I've had three tries at working with what you have here, but each turns to spaghetti.

Quoted 10 lines

Still not very clear on what concerns you have and what is the way you want to go.
The logic is straight forward, when U-Boot has a previous loader and the registers pass in valid arguments - It indicates handoff should be done using the transfer list.
Other kconfig options decide whether to use the passed in address directly or copy to a predefined address.
But in either way, xferlist_from_boot_arg() is doing the right thing to get the transfer list from the register if it exists and is valid. I don't see a reason for removing it.

Here is the initial code:

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

bool from_addr = fixed && !xpl_is_first_phase();
/*
* If U-Boot is in the first phase that an arch custom routine should
* install the bloblist passed from previous loader to this fixed
* address.
*/
bool from_boot_arg = fixed && xpl_is_first_phase();

if (xpl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST))
from_addr = false;
<<<<

and by the way, that is my tree. In -next it is even worse:

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

/*
* If U-Boot is not in the first phase, an existing bloblist must be
* at a fixed address.
*/
bool from_addr = fixed && !xpl_is_first_phase();
/*
* If U-Boot is in the first phase that an arch custom routine should
* install the bloblist passed from previous loader to this fixed
* address.
*/
bool from_boot_arg = fixed && xpl_is_first_phase();

if (xpl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST)) from_addr = false;
if (fixed)
addr = IF_ENABLED_INT(CONFIG_BLOBLIST_FIXED,

      CONFIG_BLOBLIST_ADDR);

size = CONFIG_BLOBLIST_SIZE;

if (from_boot_arg)
ret = xferlist_from_boot_arg(addr, size);
else if (from_addr)
ret = bloblist_check(addr, size);
<<<<

I want to update it so that TPL creates a bloblist and passes it through the following phases, ending up at U-Boot.

Quoted 7 lines

To my mind, if CONFIG_IS_ENABLED(BLOBLIST), then we should check the registers and always accept standard passage. If not, we should either:
- create a bloblist (if this *is* the first phase with CONFIG_IS_ENABLED(BLOBLIST))
- use an existing bloblistl, which must exist (if not)

To my mind, first we should check whether there is a valid transfer list passed in, which is done by xferlist_from_boot_arg().
If it does, and BLOBLIST is selected, then use the transfer list as bloblist. And we do need a new kconfig (e.g. FIRMWARE_HANDOFF_MANDATORY) to determine whether fw handoff is mandatory.

See below pseudo code:

Quoted 17 lines
```
if (!xferlist_from_boot_arg()) {
    /* a valid transfer list exists */
    if (!CONFIG_IS_ENABLED(BLOBLIST))
        return ERROR;

    /* use the transfer list as a bloblist */
    [...]
} else if (CONFIG_IS_ENABLED(FIRMWARE_HANDOFF_MANDATORY)) {
    /* no valid transfer list passed in, but the arm spec is mandatory */
    return ERROR;
} else {
    /* arm spec is not in use at all, create or use a static bloblist */
    [...]
}
```

Yes, that sounds good to me. Please go ahead.

Regards,
Simon

Quoted 158 lines
Quoted 158 lines

I just don't think the existing logic is a good starting point as it is too confusing.

Perhaps, putting it another way, what do you like about the current code (either version)?

Regards,
Simon

Quoted 146 lines

Regards,
Raymond

Quoted 142 lines

I would like to build on this and get something running in CI which uses standard passage. As Tom suggests, perhaps we should disconnect bloblist and standard passage?

On the CI point, is there a board we could add that uses the xferlist_from_boot_arg() call?

Regards,
Simon

Quoted 132 lines

Regards,
Raymond

Quoted 128 lines
 common/bloblist.c  | 64 ++++++++++++++--------------------------------
 include/bloblist.h | 10 --------
 2 files changed, 19 insertions(+), 55 deletions(-)
common/bloblist.c +19 -45
index e8acfc74331..7eda94ecdf9 100644
@@ -487,57 +487,37 @@ int bloblist_reloc(void *to, uint to_size)
        return 0;
 }
 
-/*
- * Weak default function for getting bloblist from boot args.
- */
-int __weak xferlist_from_boot_arg(ulong __always_unused addr,
-                                 ulong __always_unused size)
-{
-       return -ENOENT;
-}
-
 int bloblist_init(void)
 {
        bool fixed = IS_ENABLED(CONFIG_BLOBLIST_FIXED);
        int ret = -ENOENT;
-       ulong addr = 0, size;
-       /*
-        * If U-Boot is not in the first phase, an existing bloblist must be
-        * at a fixed address.
-        */
-       bool from_addr = fixed && !xpl_is_first_phase();
-       /*
-        * If U-Boot is in the first phase that an arch custom routine should
-        * install the bloblist passed from previous loader to this fixed
+       ulong addr, size;
+       bool expected;
+
+       /**
+        * We don't expect to find an existing bloblist in the first phase of
+        * U-Boot that runs. Also we have no way to receive the address of an
+        * allocated bloblist from a previous stage, so it must be at a fixed
         * address.
         */
-       bool from_boot_arg = fixed && xpl_is_first_phase();
-
+       expected = fixed && !xpl_is_first_phase();
        if (xpl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST))
-               from_addr = false;
+               expected = false;
        if (fixed)
                addr = IF_ENABLED_INT(CONFIG_BLOBLIST_FIXED,
                                      CONFIG_BLOBLIST_ADDR);
        size = CONFIG_BLOBLIST_SIZE;
-
-       if (from_boot_arg)
-               ret = xferlist_from_boot_arg(addr, size);
-       else if (from_addr)
+       if (expected) {
                ret = bloblist_check(addr, size);
-
-       if (ret)
-               log_warning("Bloblist at %lx not found (err=%d)\n",
-                           addr, ret);
-       else
-               /* Get the real size */
-               size = gd->bloblist->total_size;
-
+               if (ret) {
+                       log_warning("Expected bloblist at %lx not found (err=%d)\n",
+                                   addr, ret);
+               } else {
+                       /* Get the real size, if it is not what we expected */
+                       size = gd->bloblist->total_size;
+               }
+       }
        if (ret) {
-               /*
-                * If we don't have a bloblist from a fixed address, or the one
-                * in the fixed address is not valid. we must allocate the
-                * memory for it now.
-                */
                if (CONFIG_IS_ENABLED(BLOBLIST_ALLOC)) {
                        void *ptr = memalign(BLOBLIST_ALIGN, size);
 
@@ -545,8 +525,7 @@ int bloblist_init(void)
                                return log_msg_ret("alloc", -ENOMEM);
                        addr = map_to_sysmem(ptr);
                } else if (!fixed) {
-                       return log_msg_ret("BLOBLIST_FIXED is not enabled",
-                                          ret);
+                       return log_msg_ret("!fixed", ret);
                }
                log_debug("Creating new bloblist size %lx at %lx\n", size,
                          addr);
@@ -559,11 +538,6 @@ int bloblist_init(void)
                return log_msg_ret("ini", ret);
        gd->flags |= GD_FLG_BLOBLIST_READY;
 
-#ifdef DEBUG
-       bloblist_show_stats();
-       bloblist_show_list();
-#endif
-
        return 0;
 }
 
include/bloblist.h +0 -11
index 1e1ca34aa92..5063ab66e4a 100644
@@ -482,14 +482,4 @@ static inline int bloblist_maybe_init(void)
  */
 int bloblist_check_reg_conv(ulong rfdt, ulong rzero, ulong rsig);
 
-/**
- * xferlist_from_boot_arg() - Get bloblist from the boot args and relocate it
- *                           to the specified address.
- *
- * @addr: Address for the bloblist
- * @size: Size of space reserved for the bloblist
- * Return: 0 if OK, else on error
- */
-int xferlist_from_boot_arg(ulong addr, ulong size);
-
 #endif /* __BLOBLIST_H */
--

2.43.0

#73 lore raw

Re: [PATCH 28/29] Revert "bloblist: Load the bloblist from the previous loader"

Hi Simon,

Quoted 148 lines · Simon Glass

Hi Raymond,

Quoted 126 lines · Raymond Mao

Hi Simon,

Quoted 107 lines · Simon Glass

Hi Raymond,

Quoted 48 lines · Raymond Mao

Hi Simon,

Quoted 38 lines · Simon Glass

Hi Raymond,

Quoted 25 lines · Raymond Mao

+CC Ilias,

Hi Simon,

Quoted 9 lines · Simon Glass

The logic of this has become too confusing.

The primary issue with the patch is that U-Boot needs to set up a bloblist in the first phase where BLOBLIST is enabled. Subsequent phases can then use that bloblist.

But the first phase of U-Boot cannot assume that one exists.

Quoted 9 lines

Reverting this commit seems like a better starting point for getting things working for all use-cases.

This reverts commit 66131310d8ff1ba228f989b41bd8812f43be41c3.

https://lore.kernel.org/u-boot/CAPnjgZ3hMHtiH=f5ZKXNniOfV_-vFryq1Gn7QZ5hKU8Wjo8igw@mail.gmail.com/

---

Quoted 8 lines

If my understanding is correct, you want to add some logic to control when the U-Boot should or should not get the bloblist from the existing register argument.
But xferlist_from_boot_arg() should be called when a valid register argument is there, I didn't see this in your patch.
Maybe you plan to do this with other patch series, but simply reverting this results in a breaking of handoff policy and the firmware handoff won't work.

Quoted 5 lines

Yes, I certainly did not want to revert it, but the current code is too hard to understand and I did not look at it at the time it went in. I've had three tries at working with what you have here, but each turns to spaghetti.

Quoted 10 lines

Still not very clear on what concerns you have and what is the way you want to go.
The logic is straight forward, when U-Boot has a previous loader and the registers pass in valid arguments - It indicates handoff should be done using the transfer list.
Other kconfig options decide whether to use the passed in address directly or copy to a predefined address.
But in either way, xferlist_from_boot_arg() is doing the right thing to get the transfer list from the register if it exists and is valid. I don't see a reason for removing it.

Here is the initial code:

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

bool from_addr = fixed && !xpl_is_first_phase();
/*
* If U-Boot is in the first phase that an arch custom routine should
* install the bloblist passed from previous loader to this fixed
* address.
*/
bool from_boot_arg = fixed && xpl_is_first_phase();

if (xpl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST))
from_addr = false;
<<<<

and by the way, that is my tree. In -next it is even worse:

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

/*
* If U-Boot is not in the first phase, an existing bloblist must be
* at a fixed address.
*/
bool from_addr = fixed && !xpl_is_first_phase();
/*
* If U-Boot is in the first phase that an arch custom routine should
* install the bloblist passed from previous loader to this fixed
* address.
*/
bool from_boot_arg = fixed && xpl_is_first_phase();

if (xpl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST)) from_addr = false;
if (fixed)
addr = IF_ENABLED_INT(CONFIG_BLOBLIST_FIXED,

      CONFIG_BLOBLIST_ADDR);

size = CONFIG_BLOBLIST_SIZE;

if (from_boot_arg)
ret = xferlist_from_boot_arg(addr, size);
else if (from_addr)
ret = bloblist_check(addr, size);
<<<<

I want to update it so that TPL creates a bloblist and passes it through the following phases, ending up at U-Boot.

Quoted 7 lines

To my mind, if CONFIG_IS_ENABLED(BLOBLIST), then we should check the registers and always accept standard passage. If not, we should either:
- create a bloblist (if this *is* the first phase with CONFIG_IS_ENABLED(BLOBLIST))
- use an existing bloblistl, which must exist (if not)

To my mind, first we should check whether there is a valid transfer list passed in, which is done by xferlist_from_boot_arg().
If it does, and BLOBLIST is selected, then use the transfer list as bloblist. And we do need a new kconfig (e.g. FIRMWARE_HANDOFF_MANDATORY) to determine whether fw handoff is mandatory.

See below pseudo code:

Quoted 17 lines
```
if (!xferlist_from_boot_arg()) {
    /* a valid transfer list exists */
    if (!CONFIG_IS_ENABLED(BLOBLIST))
        return ERROR;

    /* use the transfer list as a bloblist */
    [...]
} else if (CONFIG_IS_ENABLED(FIRMWARE_HANDOFF_MANDATORY)) {
    /* no valid transfer list passed in, but the arm spec is mandatory */
    return ERROR;
} else {
    /* arm spec is not in use at all, create or use a static bloblist */
    [...]
}
```
Quoted 1 line

Yes, that sounds good to me. Please go ahead.

@Tom Rini @Ilias Apalodimas What's your idea? If all of you feel good I will post a patch for it.

Regards,
Raymond

Quoted 162 lines

Regards,
Simon

Quoted 158 lines
Quoted 158 lines

I just don't think the existing logic is a good starting point as it is too confusing.

Perhaps, putting it another way, what do you like about the current code (either version)?

Regards,
Simon

Quoted 146 lines

Regards,
Raymond

Quoted 142 lines

I would like to build on this and get something running in CI which uses standard passage. As Tom suggests, perhaps we should disconnect bloblist and standard passage?

On the CI point, is there a board we could add that uses the xferlist_from_boot_arg() call?

Regards,
Simon

Quoted 132 lines

Regards,
Raymond

Quoted 128 lines
 common/bloblist.c  | 64 ++++++++++++++--------------------------------
 include/bloblist.h | 10 --------
 2 files changed, 19 insertions(+), 55 deletions(-)
common/bloblist.c +19 -45
index e8acfc74331..7eda94ecdf9 100644
@@ -487,57 +487,37 @@ int bloblist_reloc(void *to, uint to_size)
        return 0;
 }
 
-/*
- * Weak default function for getting bloblist from boot args.
- */
-int __weak xferlist_from_boot_arg(ulong __always_unused addr,
-                                 ulong __always_unused size)
-{
-       return -ENOENT;
-}
-
 int bloblist_init(void)
 {
        bool fixed = IS_ENABLED(CONFIG_BLOBLIST_FIXED);
        int ret = -ENOENT;
-       ulong addr = 0, size;
-       /*
-        * If U-Boot is not in the first phase, an existing bloblist must be
-        * at a fixed address.
-        */
-       bool from_addr = fixed && !xpl_is_first_phase();
-       /*
-        * If U-Boot is in the first phase that an arch custom routine should
-        * install the bloblist passed from previous loader to this fixed
+       ulong addr, size;
+       bool expected;
+
+       /**
+        * We don't expect to find an existing bloblist in the first phase of
+        * U-Boot that runs. Also we have no way to receive the address of an
+        * allocated bloblist from a previous stage, so it must be at a fixed
         * address.
         */
-       bool from_boot_arg = fixed && xpl_is_first_phase();
-
+       expected = fixed && !xpl_is_first_phase();
        if (xpl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST))
-               from_addr = false;
+               expected = false;
        if (fixed)
                addr = IF_ENABLED_INT(CONFIG_BLOBLIST_FIXED,
                                      CONFIG_BLOBLIST_ADDR);
        size = CONFIG_BLOBLIST_SIZE;
-
-       if (from_boot_arg)
-               ret = xferlist_from_boot_arg(addr, size);
-       else if (from_addr)
+       if (expected) {
                ret = bloblist_check(addr, size);
-
-       if (ret)
-               log_warning("Bloblist at %lx not found (err=%d)\n",
-                           addr, ret);
-       else
-               /* Get the real size */
-               size = gd->bloblist->total_size;
-
+               if (ret) {
+                       log_warning("Expected bloblist at %lx not found (err=%d)\n",
+                                   addr, ret);
+               } else {
+                       /* Get the real size, if it is not what we expected */
+                       size = gd->bloblist->total_size;
+               }
+       }
        if (ret) {
-               /*
-                * If we don't have a bloblist from a fixed address, or the one
-                * in the fixed address is not valid. we must allocate the
-                * memory for it now.
-                */
                if (CONFIG_IS_ENABLED(BLOBLIST_ALLOC)) {
                        void *ptr = memalign(BLOBLIST_ALIGN, size);
 
@@ -545,8 +525,7 @@ int bloblist_init(void)
                                return log_msg_ret("alloc", -ENOMEM);
                        addr = map_to_sysmem(ptr);
                } else if (!fixed) {
-                       return log_msg_ret("BLOBLIST_FIXED is not enabled",
-                                          ret);
+                       return log_msg_ret("!fixed", ret);
                }
                log_debug("Creating new bloblist size %lx at %lx\n", size,
                          addr);
@@ -559,11 +538,6 @@ int bloblist_init(void)
                return log_msg_ret("ini", ret);
        gd->flags |= GD_FLG_BLOBLIST_READY;
 
-#ifdef DEBUG
-       bloblist_show_stats();
-       bloblist_show_list();
-#endif
-
        return 0;
 }
 
include/bloblist.h +0 -11
index 1e1ca34aa92..5063ab66e4a 100644
@@ -482,14 +482,4 @@ static inline int bloblist_maybe_init(void)
  */
 int bloblist_check_reg_conv(ulong rfdt, ulong rzero, ulong rsig);
 
-/**
- * xferlist_from_boot_arg() - Get bloblist from the boot args and relocate it
- *                           to the specified address.
- *
- * @addr: Address for the bloblist
- * @size: Size of space reserved for the bloblist
- * Return: 0 if OK, else on error
- */
-int xferlist_from_boot_arg(ulong addr, ulong size);
-
 #endif /* __BLOBLIST_H */
--

2.43.0

#74 lore raw

Re: [PATCH 28/29] Revert "bloblist: Load the bloblist from the previous loader"

Quoted 151 lines · Raymond Mao

Hi Simon,

Quoted 148 lines · Simon Glass

Hi Raymond,

Quoted 143 lines · Raymond Mao

Hi Simon,

Quoted 107 lines · Simon Glass

Hi Raymond,

Quoted 48 lines · Raymond Mao

Hi Simon,

Quoted 38 lines · Simon Glass

Hi Raymond,

Quoted 25 lines · Raymond Mao

+CC Ilias,

Hi Simon,

Quoted 9 lines · Simon Glass

The logic of this has become too confusing.

The primary issue with the patch is that U-Boot needs to set up a bloblist in the first phase where BLOBLIST is enabled. Subsequent phases can then use that bloblist.

But the first phase of U-Boot cannot assume that one exists.

Quoted 9 lines

Reverting this commit seems like a better starting point for getting things working for all use-cases.

This reverts commit 66131310d8ff1ba228f989b41bd8812f43be41c3.

https://lore.kernel.org/u-boot/CAPnjgZ3hMHtiH=f5ZKXNniOfV_-vFryq1Gn7QZ5hKU8Wjo8igw@mail.gmail.com/

---

Quoted 8 lines

If my understanding is correct, you want to add some logic to control when the U-Boot should or should not get the bloblist from the existing register argument.
But xferlist_from_boot_arg() should be called when a valid register argument is there, I didn't see this in your patch.
Maybe you plan to do this with other patch series, but simply reverting this results in a breaking of handoff policy and the firmware handoff won't work.

Quoted 5 lines

Yes, I certainly did not want to revert it, but the current code is too hard to understand and I did not look at it at the time it went in. I've had three tries at working with what you have here, but each turns to spaghetti.

Quoted 10 lines

Still not very clear on what concerns you have and what is the way you want to go.
The logic is straight forward, when U-Boot has a previous loader and the registers pass in valid arguments - It indicates handoff should be done using the transfer list.
Other kconfig options decide whether to use the passed in address directly or copy to a predefined address.
But in either way, xferlist_from_boot_arg() is doing the right thing to get the transfer list from the register if it exists and is valid. I don't see a reason for removing it.

Here is the initial code:

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

bool from_addr = fixed && !xpl_is_first_phase();
/*
* If U-Boot is in the first phase that an arch custom routine should
* install the bloblist passed from previous loader to this fixed
* address.
*/
bool from_boot_arg = fixed && xpl_is_first_phase();

if (xpl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST))
from_addr = false;
<<<<

and by the way, that is my tree. In -next it is even worse:

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

/*
* If U-Boot is not in the first phase, an existing bloblist must be
* at a fixed address.
*/
bool from_addr = fixed && !xpl_is_first_phase();
/*
* If U-Boot is in the first phase that an arch custom routine should
* install the bloblist passed from previous loader to this fixed
* address.
*/
bool from_boot_arg = fixed && xpl_is_first_phase();

if (xpl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST)) from_addr = false;
if (fixed)
addr = IF_ENABLED_INT(CONFIG_BLOBLIST_FIXED,

      CONFIG_BLOBLIST_ADDR);

size = CONFIG_BLOBLIST_SIZE;

if (from_boot_arg)
ret = xferlist_from_boot_arg(addr, size);
else if (from_addr)
ret = bloblist_check(addr, size);
<<<<

I want to update it so that TPL creates a bloblist and passes it through the following phases, ending up at U-Boot.

Quoted 7 lines

To my mind, if CONFIG_IS_ENABLED(BLOBLIST), then we should check the registers and always accept standard passage. If not, we should either:
- create a bloblist (if this *is* the first phase with CONFIG_IS_ENABLED(BLOBLIST))
- use an existing bloblistl, which must exist (if not)

To my mind, first we should check whether there is a valid transfer list passed in, which is done by xferlist_from_boot_arg().
If it does, and BLOBLIST is selected, then use the transfer list as bloblist. And we do need a new kconfig (e.g. FIRMWARE_HANDOFF_MANDATORY) to determine whether fw handoff is mandatory.

See below pseudo code:

```
if (!xferlist_from_boot_arg()) {
    /* a valid transfer list exists */
    if (!CONFIG_IS_ENABLED(BLOBLIST))
        return ERROR;

    /* use the transfer list as a bloblist */
    [...]
} else if (CONFIG_IS_ENABLED(FIRMWARE_HANDOFF_MANDATORY)) {
    /* no valid transfer list passed in, but the arm spec is mandatory */
    return ERROR;
} else {
    /* arm spec is not in use at all, create or use a static bloblist */
    [...]
}
```
Quoted 4 lines
Quoted 1 line

Yes, that sounds good to me. Please go ahead.

@Tom Rini @Ilias Apalodimas What's your idea? If all of you feel good I will post a patch for it.

I think it's a step in the right direction, thanks.

Signature · 1 line
Tom
#75 lore raw

Re: [PATCH 28/29] Revert "bloblist: Load the bloblist from the previous loader"

In reply to Simon Glass

Hi,

st 5. 2. 2025 v 3:00 odesílatel Simon Glass <[email protected]> napsal:

Quoted 144 lines

The logic of this has become too confusing.

The primary issue with the patch is that U-Boot needs to set up a bloblist in the first phase where BLOBLIST is enabled. Subsequent phases can then use that bloblist.

But the first phase of U-Boot cannot assume that one exists.

Reverting this commit seems like a better starting point for getting things working for all use-cases.

This reverts commit 66131310d8ff1ba228f989b41bd8812f43be41c3.

https://lore.kernel.org/u-boot/CAPnjgZ3hMHtiH=f5ZKXNniOfV_-vFryq1Gn7QZ5hKU8Wjo8igw@mail.gmail.com/

---

 common/bloblist.c  | 64 ++++++++++++++--------------------------------
 include/bloblist.h | 10 --------
 2 files changed, 19 insertions(+), 55 deletions(-)
common/bloblist.c +19 -45
index e8acfc74331..7eda94ecdf9 100644
@@ -487,57 +487,37 @@ int bloblist_reloc(void *to, uint to_size)
        return 0;
 }
 
-/*
- * Weak default function for getting bloblist from boot args.
- */
-int __weak xferlist_from_boot_arg(ulong __always_unused addr,
-                                 ulong __always_unused size)
-{
-       return -ENOENT;
-}
-
 int bloblist_init(void)
 {
        bool fixed = IS_ENABLED(CONFIG_BLOBLIST_FIXED);
        int ret = -ENOENT;
-       ulong addr = 0, size;
-       /*
-        * If U-Boot is not in the first phase, an existing bloblist must be
-        * at a fixed address.
-        */
-       bool from_addr = fixed && !xpl_is_first_phase();
-       /*
-        * If U-Boot is in the first phase that an arch custom routine should
-        * install the bloblist passed from previous loader to this fixed
+       ulong addr, size;
+       bool expected;
+
+       /**
+        * We don't expect to find an existing bloblist in the first phase of
+        * U-Boot that runs. Also we have no way to receive the address of an
+        * allocated bloblist from a previous stage, so it must be at a fixed
         * address.
         */
-       bool from_boot_arg = fixed && xpl_is_first_phase();
-
+       expected = fixed && !xpl_is_first_phase();
        if (xpl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST))
-               from_addr = false;
+               expected = false;
        if (fixed)
                addr = IF_ENABLED_INT(CONFIG_BLOBLIST_FIXED,
                                      CONFIG_BLOBLIST_ADDR);
        size = CONFIG_BLOBLIST_SIZE;
-
-       if (from_boot_arg)
-               ret = xferlist_from_boot_arg(addr, size);
-       else if (from_addr)
+       if (expected) {
                ret = bloblist_check(addr, size);
-
-       if (ret)
-               log_warning("Bloblist at %lx not found (err=%d)\n",
-                           addr, ret);
-       else
-               /* Get the real size */
-               size = gd->bloblist->total_size;
-
+               if (ret) {
+                       log_warning("Expected bloblist at %lx not found (err=%d)\n",
+                                   addr, ret);
+               } else {
+                       /* Get the real size, if it is not what we expected */
+                       size = gd->bloblist->total_size;
+               }
+       }
        if (ret) {
-               /*
-                * If we don't have a bloblist from a fixed address, or the one
-                * in the fixed address is not valid. we must allocate the
-                * memory for it now.
-                */
                if (CONFIG_IS_ENABLED(BLOBLIST_ALLOC)) {
                        void *ptr = memalign(BLOBLIST_ALIGN, size);
 
@@ -545,8 +525,7 @@ int bloblist_init(void)
                                return log_msg_ret("alloc", -ENOMEM);
                        addr = map_to_sysmem(ptr);
                } else if (!fixed) {
-                       return log_msg_ret("BLOBLIST_FIXED is not enabled",
-                                          ret);
+                       return log_msg_ret("!fixed", ret);
                }
                log_debug("Creating new bloblist size %lx at %lx\n", size,
                          addr);
@@ -559,11 +538,6 @@ int bloblist_init(void)
                return log_msg_ret("ini", ret);
        gd->flags |= GD_FLG_BLOBLIST_READY;
 
-#ifdef DEBUG
-       bloblist_show_stats();
-       bloblist_show_list();
-#endif
-
        return 0;
 }
 
include/bloblist.h +0 -11
index 1e1ca34aa92..5063ab66e4a 100644
@@ -482,14 +482,4 @@ static inline int bloblist_maybe_init(void)
  */
 int bloblist_check_reg_conv(ulong rfdt, ulong rzero, ulong rsig);
 
-/**
- * xferlist_from_boot_arg() - Get bloblist from the boot args and relocate it
- *                           to the specified address.
- *
- * @addr: Address for the bloblist
- * @size: Size of space reserved for the bloblist
- * Return: 0 if OK, else on error
- */
-int xferlist_from_boot_arg(ulong addr, ulong size);
-
 #endif /* __BLOBLIST_H */
--
Quoted 2 lines

2.43.0

First of all if this should be reverted you should also remove arch/arm/lib/xferlist.c.

But we plan to use this feature and TL list will be passed via register as is defined in firmware handoff spec.
In our configuration we won't be using any of TPL/VPL/SPL and A cores will start with TF-A at bl31 which gets
TL list from the coprocessor. And TF-A should be passing TL list to TEE (optional) and to U-Boot.
If only hard coded address is supported we would have to recompile u-boot based on location where TL should
be which is an unwanted limitation.
If current implementation is not correct it should be fixed but revert seems to me too early without saying
what should change.

Thanks,
Michal

Signature · 5 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs
#76 lore raw

PATCH 29/29 bloblist: Allow relocation at the end of the SPL phase

In reply to Simon Glass

Where the bloblist is located in internal memory and TF-A's BL31 blob removes access to this memory, the best option seems to be to relocate the bloblist just before running TF-A.

Add an option to select this behaviour and provide a relocation address.

---

 common/Kconfig    | 20 ++++++++++++++++++++
 common/bloblist.c | 15 ++++++++++++++-
 common/spl/spl.c  |  9 +++++++++
 3 files changed, 43 insertions(+), 1 deletion(-)
common/Kconfig +20 -0
index 0e8c44f3f74..962e7fd76eb 100644
@@ -1125,6 +1125,26 @@ config SPL_BLOBLIST_ALLOC
 
 endchoice
 
+config SPL_BLOBLIST_RELOC
+	bool "Relocate the bloblist before existing SPL"
+	depends on BLOBLIST_FIXED
+	help
+	  Some platforms locate the bloblist in SRAM in SPL. In some cases,
+	  the TF-A BL31 blob removes access to SRAM, e.g. with Rockchip RK3399.
+
+	  Enable this option to make U-Boot copy the bloblist from SRAM to SDRAM
+	  before leaving SPL.
+
+config SPL_BLOBLIST_RELOC_ADDR
+	hex "Relocate the bloblist before existing SPL"
+	depends on SPL_BLOBLIST_RELOC
+	default BLOBLIST_ADDR
+	help
+	  Sets the address to which the bloblist is relocated at the end of SPL.
+	  U-Boot proper uses this address when it starts up. Note that U-Boot
+	  always relocates the bloblist again as part of its own relocation
+	  process.
+
 endif # SPL_BLOBLIST
 
 if TPL_BLOBLIST
common/bloblist.c +14 -1
index 7eda94ecdf9..60c23d604b6 100644
@@ -503,9 +503,22 @@ int bloblist_init(void)
 	expected = fixed && !xpl_is_first_phase();
 	if (xpl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST))
 		expected = false;
-	if (fixed)
+	if (fixed) {
 		addr = IF_ENABLED_INT(CONFIG_BLOBLIST_FIXED,
 				      CONFIG_BLOBLIST_ADDR);
+
+		if (xpl_phase() == PHASE_BOARD_F &&
+		    IS_ENABLED(CONFIG_SPL_BLOBLIST_RELOC)) {
+			ulong addr = IF_ENABLED_INT(CONFIG_SPL_BLOBLIST_RELOC,
+					    CONFIG_SPL_BLOBLIST_RELOC_ADDR);
+
+			log_debug("Using bloblist at %lx\n", addr);
+			bloblist_reloc(map_sysmem(addr, 0),
+				       bloblist_get_total_size());
+		}
+		log_debug("bloblist addr=%lx\n", addr);
+	}
+
 	size = CONFIG_BLOBLIST_SIZE;
 	if (expected) {
 		ret = bloblist_check(addr, size);
common/spl/spl.c +9 -0
index e7157df1ff9..84543691cde 100644
@@ -841,6 +841,15 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 			       ret);
 	}
 
+	if (xpl_phase() == PHASE_SPL && CONFIG_IS_ENABLED(BLOBLIST_RELOC)) {
+		ulong addr = CONFIG_IF_ENABLED_INT(BLOBLIST_RELOC,
+						   BLOBLIST_RELOC_ADDR);
+
+		log_debug("Relocating bloblist %p to %lx\n", gd_bloblist(),
+			  addr);
+		bloblist_reloc(map_sysmem(addr, 0), bloblist_get_total_size());
+	}
+
 	spl_board_prepare_for_boot();
 
 	if (CONFIG_IS_ENABLED(RELOC_LOADER)) {
Signature · 1 line
2.43.0
#77 lore raw

Re: [PATCH 29/29] bloblist: Allow relocation at the end of the SPL phase

Quoted 21 lines · Simon Glass

Where the bloblist is located in internal memory and TF-A's BL31 blob removes access to this memory, the best option seems to be to relocate the bloblist just before running TF-A.

Add an option to select this behaviour and provide a relocation address.

---

 common/Kconfig    | 20 ++++++++++++++++++++
 common/bloblist.c | 15 ++++++++++++++-
 common/spl/spl.c  |  9 +++++++++
 3 files changed, 43 insertions(+), 1 deletion(-)
common/Kconfig +0 -0
index 0e8c44f3f74..962e7fd76eb 100644
@@ -1125,6 +1125,26 @@ config SPL_BLOBLIST_ALLOC
 
 endchoice

common/Kconfig config SPL_BLOBLIST_ALLOC · line 1136

Quoted 10 lines
common/Kconfig +9 -0
 
+config SPL_BLOBLIST_RELOC
+	bool "Relocate the bloblist before existing SPL"
+	depends on BLOBLIST_FIXED
+	help
+	  Some platforms locate the bloblist in SRAM in SPL. In some cases,
+	  the TF-A BL31 blob removes access to SRAM, e.g. with Rockchip RK3399.
+
+	  Enable this option to make U-Boot copy the bloblist from SRAM to SDRAM
+	  before leaving SPL.

Isn't this because TF-A is (re?-)initializing SDRAM? I'll let one of the Rockchip people chime in here, thanks.

Signature · 1 line
Tom
#78 lore raw

Re: [PATCH 29/29] bloblist: Allow relocation at the end of the SPL phase

Hi Tom,

Quoted 25 lines · Tom Rini
Quoted 22 lines · Simon Glass

Where the bloblist is located in internal memory and TF-A's BL31 blob removes access to this memory, the best option seems to be to relocate the bloblist just before running TF-A.

Add an option to select this behaviour and provide a relocation address.

---

 common/Kconfig    | 20 ++++++++++++++++++++
 common/bloblist.c | 15 ++++++++++++++-
 common/spl/spl.c  |  9 +++++++++
 3 files changed, 43 insertions(+), 1 deletion(-)
common/Kconfig +0 -0
index 0e8c44f3f74..962e7fd76eb 100644
@@ -1125,6 +1125,26 @@ config SPL_BLOBLIST_ALLOC
 
 endchoice
 
Quoted 12 lines

common/Kconfig config SPL_BLOBLIST_ALLOC · line 1136

Quoted 9 lines
common/Kconfig +9 -0
+config SPL_BLOBLIST_RELOC
+     bool "Relocate the bloblist before existing SPL"
+     depends on BLOBLIST_FIXED
+     help
+       Some platforms locate the bloblist in SRAM in SPL. In some cases,
+       the TF-A BL31 blob removes access to SRAM, e.g. with Rockchip RK3399.
+
+       Enable this option to make U-Boot copy the bloblist from SRAM to SDRAM
+       before leaving SPL.

Isn't this because TF-A is (re?-)initializing SDRAM? I'll let one of the Rockchip people chime in here, thanks.

Not so far as I know. The DRAM init is in U-Boot on this platform.

Regards,
SImon

#79 lore raw

Re: [PATCH 29/29] bloblist: Allow relocation at the end of the SPL phase

Quoted 41 lines · Simon Glass

Hi Tom,

Quoted 25 lines · Tom Rini
Quoted 22 lines · Simon Glass

Where the bloblist is located in internal memory and TF-A's BL31 blob removes access to this memory, the best option seems to be to relocate the bloblist just before running TF-A.

Add an option to select this behaviour and provide a relocation address.

---

 common/Kconfig    | 20 ++++++++++++++++++++
 common/bloblist.c | 15 ++++++++++++++-
 common/spl/spl.c  |  9 +++++++++
 3 files changed, 43 insertions(+), 1 deletion(-)
common/Kconfig +0 -0
index 0e8c44f3f74..962e7fd76eb 100644
@@ -1125,6 +1125,26 @@ config SPL_BLOBLIST_ALLOC
 
 endchoice
 
Quoted 12 lines

common/Kconfig config SPL_BLOBLIST_ALLOC · line 1136

Quoted 9 lines
common/Kconfig +9 -0
+config SPL_BLOBLIST_RELOC
+     bool "Relocate the bloblist before existing SPL"
+     depends on BLOBLIST_FIXED
+     help
+       Some platforms locate the bloblist in SRAM in SPL. In some cases,
+       the TF-A BL31 blob removes access to SRAM, e.g. with Rockchip RK3399.
+
+       Enable this option to make U-Boot copy the bloblist from SRAM to SDRAM
+       before leaving SPL.

Isn't this because TF-A is (re?-)initializing SDRAM? I'll let one of the Rockchip people chime in here, thanks.

Quoted 1 line

Not so far as I know. The DRAM init is in U-Boot on this platform.

OK, but the question is where, since we have we have drivers/ram/rockchip/sdram_rk3399.c being built in TPL, SPL and full U-Boot. That should likely be tidied up but again, I'll let one of the Rockchip people chime in here.

Signature · 1 line
Tom
#80 lore raw

Re: [PATCH 29/29] bloblist: Allow relocation at the end of the SPL phase

In reply to Simon Glass

Hi Simon,

Quoted 35 lines · Simon Glass

Where the bloblist is located in internal memory and TF-A's BL31 blob removes access to this memory, the best option seems to be to relocate the bloblist just before running TF-A.

Add an option to select this behaviour and provide a relocation address.

---

 common/Kconfig    | 20 ++++++++++++++++++++
 common/bloblist.c | 15 ++++++++++++++-
 common/spl/spl.c  |  9 +++++++++
 3 files changed, 43 insertions(+), 1 deletion(-)
common/Kconfig +12 -0
index 0e8c44f3f74..962e7fd76eb 100644
@@ -1125,6 +1125,26 @@ config SPL_BLOBLIST_ALLOC
 
 endchoice
 
+config SPL_BLOBLIST_RELOC
+       bool "Relocate the bloblist before existing SPL"
+       depends on BLOBLIST_FIXED
+       help
+         Some platforms locate the bloblist in SRAM in SPL. In some cases,
+         the TF-A BL31 blob removes access to SRAM, e.g. with Rockchip RK3399.
+
+         Enable this option to make U-Boot copy the bloblist from SRAM to SDRAM
+         before leaving SPL.
+
+config SPL_BLOBLIST_RELOC_ADDR
+       hex "Relocate the bloblist before existing SPL"

common/Kconfig config SPL_BLOBLIST_ALLOC · line 1149

Quoted 10 lines
common/Kconfig +8 -0
+       depends on SPL_BLOBLIST_RELOC
+       default BLOBLIST_ADDR
+       help
+         Sets the address to which the bloblist is relocated at the end of SPL.
+         U-Boot proper uses this address when it starts up. Note that U-Boot
+         always relocates the bloblist again as part of its own relocation
+         process.
+
 endif # SPL_BLOBLIST
 

I think the relocation you mentioned is a board-specific behaviour and should not be part of common/Kconfig if only a few boards use them.

Regards,
Raymond

Quoted 52 lines
common/Kconfig +0 -0
 if TPL_BLOBLIST
common/bloblist.c +14 -1
index 7eda94ecdf9..60c23d604b6 100644
@@ -503,9 +503,22 @@ int bloblist_init(void)
        expected = fixed && !xpl_is_first_phase();
        if (xpl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST))
                expected = false;
-       if (fixed)
+       if (fixed) {
                addr = IF_ENABLED_INT(CONFIG_BLOBLIST_FIXED,
                                      CONFIG_BLOBLIST_ADDR);
+
+               if (xpl_phase() == PHASE_BOARD_F &&
+                   IS_ENABLED(CONFIG_SPL_BLOBLIST_RELOC)) {
+                       ulong addr = IF_ENABLED_INT(CONFIG_SPL_BLOBLIST_RELOC,
+                                           CONFIG_SPL_BLOBLIST_RELOC_ADDR);
+
+                       log_debug("Using bloblist at %lx\n", addr);
+                       bloblist_reloc(map_sysmem(addr, 0),
+                                      bloblist_get_total_size());
+               }
+               log_debug("bloblist addr=%lx\n", addr);
+       }
+
        size = CONFIG_BLOBLIST_SIZE;
        if (expected) {
                ret = bloblist_check(addr, size);
common/spl/spl.c +9 -1
index e7157df1ff9..84543691cde 100644
@@ -841,6 +841,15 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
                               ret);
        }
 
+       if (xpl_phase() == PHASE_SPL && CONFIG_IS_ENABLED(BLOBLIST_RELOC)) {
+               ulong addr = CONFIG_IF_ENABLED_INT(BLOBLIST_RELOC,
+                                                  BLOBLIST_RELOC_ADDR);
+
+               log_debug("Relocating bloblist %p to %lx\n", gd_bloblist(),
+                         addr);
+               bloblist_reloc(map_sysmem(addr, 0), bloblist_get_total_size());
+       }
+
        spl_board_prepare_for_boot();
 
        if (CONFIG_IS_ENABLED(RELOC_LOADER)) {
--

2.43.0

#81 lore raw

Re: [PATCH 29/29] bloblist: Allow relocation at the end of the SPL phase

Hi Raymond,

Quoted 44 lines · Raymond Mao

Hi Simon,

Quoted 40 lines · Simon Glass

Where the bloblist is located in internal memory and TF-A's BL31 blob removes access to this memory, the best option seems to be to relocate the bloblist just before running TF-A.

Add an option to select this behaviour and provide a relocation address.

---

 common/Kconfig    | 20 ++++++++++++++++++++
 common/bloblist.c | 15 ++++++++++++++-
 common/spl/spl.c  |  9 +++++++++
 3 files changed, 43 insertions(+), 1 deletion(-)
common/Kconfig +17 -0
index 0e8c44f3f74..962e7fd76eb 100644
@@ -1125,6 +1125,26 @@ config SPL_BLOBLIST_ALLOC
 
 endchoice
 
+config SPL_BLOBLIST_RELOC
+       bool "Relocate the bloblist before existing SPL"
+       depends on BLOBLIST_FIXED
+       help
+         Some platforms locate the bloblist in SRAM in SPL. In some cases,
+         the TF-A BL31 blob removes access to SRAM, e.g. with Rockchip RK3399.
+
+         Enable this option to make U-Boot copy the bloblist from SRAM to SDRAM
+         before leaving SPL.
+
+config SPL_BLOBLIST_RELOC_ADDR
+       hex "Relocate the bloblist before existing SPL"
+       depends on SPL_BLOBLIST_RELOC
+       default BLOBLIST_ADDR
+       help
+         Sets the address to which the bloblist is relocated at the end of SPL.
+         U-Boot proper uses this address when it starts up. Note that U-Boot
Quoted 8 lines

common/Kconfig config SPL_BLOBLIST_ALLOC · line 1149

Quoted 5 lines
common/Kconfig +3 -0
+         always relocates the bloblist again as part of its own relocation
+         process.
+
 endif # SPL_BLOBLIST
 

I think the relocation you mentioned is a board-specific behaviour and should not be part of common/Kconfig if only a few boards use them.

Where do you suggest this code should go?

Regards,
Simon

#82 lore raw

Re: [PATCH 29/29] bloblist: Allow relocation at the end of the SPL phase

Hi Simon,

Quoted 57 lines · Simon Glass

Hi Raymond,

Quoted 44 lines · Raymond Mao

Hi Simon,

Quoted 40 lines · Simon Glass

Where the bloblist is located in internal memory and TF-A's BL31 blob removes access to this memory, the best option seems to be to relocate the bloblist just before running TF-A.

Add an option to select this behaviour and provide a relocation address.

---

 common/Kconfig    | 20 ++++++++++++++++++++
 common/bloblist.c | 15 ++++++++++++++-
 common/spl/spl.c  |  9 +++++++++
 3 files changed, 43 insertions(+), 1 deletion(-)
common/Kconfig +17 -0
index 0e8c44f3f74..962e7fd76eb 100644
@@ -1125,6 +1125,26 @@ config SPL_BLOBLIST_ALLOC
 
 endchoice
 
+config SPL_BLOBLIST_RELOC
+       bool "Relocate the bloblist before existing SPL"
+       depends on BLOBLIST_FIXED
+       help
+         Some platforms locate the bloblist in SRAM in SPL. In some cases,
+         the TF-A BL31 blob removes access to SRAM, e.g. with Rockchip RK3399.
+
+         Enable this option to make U-Boot copy the bloblist from SRAM to SDRAM
+         before leaving SPL.
+
+config SPL_BLOBLIST_RELOC_ADDR
+       hex "Relocate the bloblist before existing SPL"
+       depends on SPL_BLOBLIST_RELOC
+       default BLOBLIST_ADDR
+       help
+         Sets the address to which the bloblist is relocated at the end of SPL.
+         U-Boot proper uses this address when it starts up. Note that U-Boot
Quoted 8 lines

common/Kconfig config SPL_BLOBLIST_ALLOC · line 1149

Quoted 5 lines
common/Kconfig +3 -0
+         always relocates the bloblist again as part of its own relocation
+         process.
+
 endif # SPL_BLOBLIST
 

I think the relocation you mentioned is a board-specific behaviour and should not be part of common/Kconfig if only a few boards use them.

Quoted 2 lines

Where do you suggest this code should go?

Can be arch/arm/mach-rockchip/rk3399 if it is general for all rk3399 or any rk3399 subdir under board if it is only board specific.

Regards,
Raymond

Quoted 2 lines

Regards,
Simon

#83 lore raw

Re: [PATCH 29/29] bloblist: Allow relocation at the end of the SPL phase

Hi Raymond,

Quoted 61 lines · Raymond Mao

Hi Simon,

Quoted 57 lines · Simon Glass

Hi Raymond,

Quoted 52 lines · Raymond Mao

Hi Simon,

Quoted 35 lines · Simon Glass

Where the bloblist is located in internal memory and TF-A's BL31 blob removes access to this memory, the best option seems to be to relocate the bloblist just before running TF-A.

Add an option to select this behaviour and provide a relocation address.

---

 common/Kconfig    | 20 ++++++++++++++++++++
 common/bloblist.c | 15 ++++++++++++++-
 common/spl/spl.c  |  9 +++++++++
 3 files changed, 43 insertions(+), 1 deletion(-)
common/Kconfig +12 -0
index 0e8c44f3f74..962e7fd76eb 100644
@@ -1125,6 +1125,26 @@ config SPL_BLOBLIST_ALLOC
 
 endchoice
 
+config SPL_BLOBLIST_RELOC
+       bool "Relocate the bloblist before existing SPL"
+       depends on BLOBLIST_FIXED
+       help
+         Some platforms locate the bloblist in SRAM in SPL. In some cases,
+         the TF-A BL31 blob removes access to SRAM, e.g. with Rockchip RK3399.
+
+         Enable this option to make U-Boot copy the bloblist from SRAM to SDRAM
+         before leaving SPL.
+
+config SPL_BLOBLIST_RELOC_ADDR
+       hex "Relocate the bloblist before existing SPL"

common/Kconfig config SPL_BLOBLIST_ALLOC · line 1149

Quoted 10 lines
common/Kconfig +8 -0
+       depends on SPL_BLOBLIST_RELOC
+       default BLOBLIST_ADDR
+       help
+         Sets the address to which the bloblist is relocated at the end of SPL.
+         U-Boot proper uses this address when it starts up. Note that U-Boot
+         always relocates the bloblist again as part of its own relocation
+         process.
+
 endif # SPL_BLOBLIST
 

I think the relocation you mentioned is a board-specific behaviour and should not be part of common/Kconfig if only a few boards use them.

Quoted 5 lines
Quoted 2 lines

Where do you suggest this code should go?

Can be arch/arm/mach-rockchip/rk3399 if it is general for all rk3399 or any rk3399 subdir under board if it is only board specific.

OK I'll take a look. I agree this is a pretty strange problem.

Regards,
SImon

#84 lore raw

Re: [PATCH 29/29] bloblist: Allow relocation at the end of the SPL phase

In reply to Simon Glass
Quoted 56 lines · Simon Glass

Hi Raymond,

Quoted 44 lines · Raymond Mao

Hi Simon,

Quoted 40 lines · Simon Glass

Where the bloblist is located in internal memory and TF-A's BL31 blob removes access to this memory, the best option seems to be to relocate the bloblist just before running TF-A.

Add an option to select this behaviour and provide a relocation address.

---

 common/Kconfig    | 20 ++++++++++++++++++++
 common/bloblist.c | 15 ++++++++++++++-
 common/spl/spl.c  |  9 +++++++++
 3 files changed, 43 insertions(+), 1 deletion(-)
common/Kconfig +17 -0
index 0e8c44f3f74..962e7fd76eb 100644
@@ -1125,6 +1125,26 @@ config SPL_BLOBLIST_ALLOC
 
 endchoice
 
+config SPL_BLOBLIST_RELOC
+       bool "Relocate the bloblist before existing SPL"
+       depends on BLOBLIST_FIXED
+       help
+         Some platforms locate the bloblist in SRAM in SPL. In some cases,
+         the TF-A BL31 blob removes access to SRAM, e.g. with Rockchip RK3399.
+
+         Enable this option to make U-Boot copy the bloblist from SRAM to SDRAM
+         before leaving SPL.
+
+config SPL_BLOBLIST_RELOC_ADDR
+       hex "Relocate the bloblist before existing SPL"
+       depends on SPL_BLOBLIST_RELOC
+       default BLOBLIST_ADDR
+       help
+         Sets the address to which the bloblist is relocated at the end of SPL.
+         U-Boot proper uses this address when it starts up. Note that U-Boot
Quoted 8 lines

common/Kconfig config SPL_BLOBLIST_ALLOC · line 1149

Quoted 5 lines
common/Kconfig +3 -0
+         always relocates the bloblist again as part of its own relocation
+         process.
+
 endif # SPL_BLOBLIST
 

I think the relocation you mentioned is a board-specific behaviour and should not be part of common/Kconfig if only a few boards use them.

Quoted 1 line

Where do you suggest this code should go?

What we need is a generic way to pass the bloblist we allocated in one stage to the next, without saying "Ah, it's a fixed address". Then we should just normally have each stage have a bloblist in a safe location, as needed.

Signature · 1 line
Tom
#85 lore raw
In reply to Simon Glass

Hi Simon,

It does not look like this is based on the master branch and cannot be applied for review/testing. Please rebase on top of the master branch.

Some quick feedback:
- Some of these could/should be a standalone patch, i.e. os=u-boot fix.
- All experimental VBE/VPL addition to rockchip-u-boot.dtsi should probably be moved to a separate file not to clutter the regular binman image.
- rk3399-generic is not generic, it is just pinepro64 with a new name? Please see [1] for the addition of a generic target I sent out, matching existing minimal generic targets for rk35xx.

Will get back with a more in depth feedback later.

[1] https://lore.kernel.org/r/[email protected]/

Regards,
Jonas

Quoted 290 lines · Simon Glass

This series completes the work to enable VBE on a suitable board. Most of it is rockchip-specific patches to support the VPL phase, i.e. the one which decides which boot patch to take (A, B or recovery).

A good chunk of this series is adding an image for VBE, by creating a new Binman image. Future work in Binman may make this more automated / easier, but for now it is written out in full. The work is undertaken piecemeal so it is easier to review the steps.

VBE allows similar boards to share firmware images, with perhaps just TPL (around 75K) being different for each board. Using a common image for VPL, SPL and U-Boot saves a lot of space in the image and makes builds easier. Of course, each board still needs a separate devicetree.

Here is the layout of the image:

Name Image-pos Size Entry-type Offset Uncomp-size
----------------------------------------------------------------------------------------------

image                                 0   1b960cf  section                    0
  alternates-fdt                   8000     31000  alternates-fdt          8000
    mkimage                        8000     31000  mkimage                    0
      u-boot-tpl                   8048     12a11  u-boot-tpl                48
  vpl                            208000     16200  fit                   208000
    image-vpl                    209400      a5a3  section                 1400
      section                    209400      a5a3  section                    0
        u-boot-vpl-nodtb                    10348  u-boot-vpl-nodtb           0
        u-boot-vpl-bss-pad                     20  u-boot-vpl-bss-pad     10348
    @fdt-SEQ                          0         0  section                    0
  vbe-a                          800000    39b200  section               800000
    spl-a                        800000    100000  fit                        0
      spl                        801400     10c97  section                 1400
        section                  801400     10c97  section                    0
          u-boot-spl-nodtb                  1a908  u-boot-spl-nodtb           0
          u-boot-spl-bss-pad                  1b0  u-boot-spl-bss-pad     1a908
      @fdt-SEQ                        0         0  section                    0
    u-boot-a                     900000    29b200  fit                   100000
      spl                        902400     10c97  section                 2400
        section                  902400     10c97  section                    0
          u-boot-spl-nodtb                  1a908  u-boot-spl-nodtb           0
          u-boot-spl-bss-pad                  1b0  u-boot-spl-bss-pad     1a908
      u-boot                     913200     e4250  section                13200
        u-boot-nodtb             913200     e4250  u-boot-nodtb               0
      @atf-SEQ                        0         0  section                    0
        atf-bl31                      0         0  atf-bl31                   0
      @tee-SEQ                        0         0  section                    0
        tee-os                        0         0  tee-os                     0
      @fdt-SEQ                        0         0  section                    0
  vbe-b                         1000000    39b200  section              1000000
    spl-b                       1000000    100000  fit                        0
      spl                       1001400     10c97  section                 1400
        section                 1001400     10c97  section                    0
          u-boot-spl-nodtb                  1a908  u-boot-spl-nodtb           0
          u-boot-spl-bss-pad                  1b0  u-boot-spl-bss-pad     1a908
      @fdt-SEQ                        0         0  section                    0
    u-boot-b                    1100000    29b200  fit                   100000
      spl                       1102400     10c97  section                 2400
        section                 1102400     10c97  section                    0
          u-boot-spl-nodtb                  1a908  u-boot-spl-nodtb           0
          u-boot-spl-bss-pad                  1b0  u-boot-spl-bss-pad     1a908
      u-boot                    1113200     e4250  section                13200
        u-boot-nodtb            1113200     e4250  u-boot-nodtb               0
      @atf-SEQ                        0         0  section                    0
        atf-bl31                      0         0  atf-bl31                   0
      @tee-SEQ                        0         0  section                    0
        tee-os                        0         0  tee-os                     0
      @fdt-SEQ                        0         0  section                    0
  vbe-recovery                  1800000    39b200  section              1800000
    spl-recovery                1800000    100000  fit                        0
      spl                       1801400     10c97  section                 1400
        section                 1801400     10c97  section                    0
          u-boot-spl-nodtb                  1a908  u-boot-spl-nodtb           0
          u-boot-spl-bss-pad                  1b0  u-boot-spl-bss-pad     1a908
      @fdt-SEQ                        0         0  section                    0
    u-boot-recovery             1900000    29b200  fit                   100000
      spl                       1902400     10c97  section                 2400
        section                 1902400     10c97  section                    0
          u-boot-spl-nodtb                  1a908  u-boot-spl-nodtb           0
          u-boot-spl-bss-pad                  1b0  u-boot-spl-bss-pad     1a908
      u-boot                    1913200     e4250  section                13200
        u-boot-nodtb            1913200     e4250  u-boot-nodtb               0
      @atf-SEQ                        0         0  section                    0
        atf-bl31                      0         0  atf-bl31                   0
      @tee-SEQ                        0         0  section                    0
        tee-os                        0         0  tee-os                     0
      @fdt-SEQ                        0         0  section                    0
  fdtmap                        1b9b200      2ecf  fdtmap               1b9b200

Unfortunately I got a bit lost trying to figure out the bloblist code, despite my being the original author. So for now I have included a revert of a recent patch, so that the logic can be simplified and more in keeping with the original intent. We may in fact need a symbol which specifically says which phase creates the bloblist, but I'm not completely sure of what the reverted patch was trying to achieve.

This is (mostly) the final VBE series, but there are a few loose ends to tidy up:

- cache is disabled in SPL, which slows the boot a little
- pinctrl init needs to be tidied up to avoid warnings

Other things may become apparently after more usage / testing.

Simon Glass (29):
arm: Support a separate stack for VPL
spl: Adjust xPL symbols
spl: Allow VBE to handle xPL size
vbe: Show the margin when using SPL_RELOC
rockchip: Allow RAM init to happen in SPL on rk3399
rockchip: dts: Factor out arch and compression
rockchip: Add an fdtmap
rockchip: Add more space below the stack pointer with kevin
rockchip: dts: Create a template for the FIT
rockchip: dts: Un-indent the FIT template
rockchip: dts: Correct the OS for U-Boot
rockchip: Specify the phase in the image
rockchip: Provide a bootstd configuration
rockchip: Add SPL into the main FIT
rockchip: Include a compatible string in each configuration
rockchip: Set the skip-at-start property correctly
rockchip: Add a template for SPL
rockchip: Add a VPL image
rockchip: Add TPL alternatives
rockchip: Update rk3399 bootph-tags for VPL
rockchip: Provide a VPL phase on rk3399
rockchip: Add symbols for spl_reloc
rockchip: Adjust rk3399 TPL-stack to the same as SPL
rockchip: Allow SPL to set up SDRAM
rockchip: Add a generic rk3399 board
rockchip: Add documentation for VBE
gitlab: Add an VBE board to the sjg lab
Revert "bloblist: Load the bloblist from the previous loader"
bloblist: Allow relocation at the end of the SPL phase

 .gitlab-ci.yml                                |   6 +
 arch/arm/dts/rk3399-generic-u-boot.dtsi       |  32 ++
 arch/arm/dts/rk3399-generic.dts               |  30 ++
 arch/arm/dts/rk3399-u-boot.dtsi               |   9 +-
 arch/arm/dts/rockchip-u-boot.dtsi             | 455 +++++++++++++-----
 arch/arm/include/asm/spl.h                    |   1 +
 arch/arm/lib/crt0_64.S                        |   4 +-
 arch/arm/mach-rockchip/Kconfig                |  25 +-
 arch/arm/mach-rockchip/Makefile               |   6 +-
 arch/arm/mach-rockchip/rk3399/Kconfig         |  11 +-
 arch/arm/mach-rockchip/spl-boot-order.c       |   3 +-
 arch/arm/mach-rockchip/spl.c                  |   3 +
 arch/arm/mach-rockchip/tpl.c                  |  12 +-
 arch/arm/mach-rockchip/u-boot-tpl-v8.lds      |  13 +
 arch/arm/mach-rockchip/u-boot-vpl-v8.lds      | 107 ++++
 arch/arm/mach-rockchip/vpl.c                  |  53 ++
 board/rockchip/evb_rk3399/MAINTAINERS         |   5 +
 cmd/vbe.c                                     |   8 +-
 common/Kconfig                                |  20 +
 common/bloblist.c                             |  77 ++-
 common/spl/Kconfig                            |   1 +
 common/spl/Kconfig.vpl                        |  13 +
 common/spl/spl.c                              |  11 +
 common/spl/spl_reloc.c                        |  14 +-
 configs/anbernic-rgxx3-rk3566_defconfig       |   2 +-
 configs/bpi-r2-pro-rk3568_defconfig           |   2 +-
 configs/chromebit_mickey_defconfig            |   2 +-
 configs/chromebook_bob_defconfig              |   4 +-
 configs/chromebook_jerry_defconfig            |   2 +-
 configs/chromebook_kevin_defconfig            |   4 +-
 configs/chromebook_minnie_defconfig           |   2 +-
 configs/chromebook_speedy_defconfig           |   2 +-
 configs/cm3588-nas-rk3588_defconfig           |   2 +-
 configs/coolpi-4b-rk3588s_defconfig           |   2 +-
 configs/coolpi-cm5-evb-rk3588_defconfig       |   2 +-
 configs/coolpi-cm5-genbook-rk3588_defconfig   |   2 +-
 configs/eaidk-610-rk3399_defconfig            |   2 +-
 configs/evb-px30_defconfig                    |   2 +-
 configs/evb-px5_defconfig                     |   2 +-
 configs/evb-rk3036_defconfig                  |   2 +-
 configs/evb-rk3229_defconfig                  |   2 +-
 configs/evb-rk3288_defconfig                  |   2 +-
 configs/evb-rk3308_defconfig                  |   2 +-
 configs/evb-rk3328_defconfig                  |   2 +-
 configs/evb-rk3399_defconfig                  |   2 +-
 configs/evb-rk3568_defconfig                  |   2 +-
 configs/evb-rk3588_defconfig                  |   2 +-
 configs/ficus-rk3399_defconfig                |   2 +-
 configs/firefly-px30_defconfig                |   2 +-
 configs/firefly-rk3288_defconfig              |   2 +-
 configs/firefly-rk3399_defconfig              |   2 +-
 configs/generic-rk3568_defconfig              |   2 +-
 configs/generic-rk3588_defconfig              |   2 +-
 configs/jaguar-rk3588_defconfig               |   2 +-
 configs/khadas-edge-captain-rk3399_defconfig  |   2 +-
 configs/khadas-edge-rk3399_defconfig          |   2 +-
 configs/khadas-edge-v-rk3399_defconfig        |   2 +-
 configs/kylin-rk3036_defconfig                |   2 +-
 configs/leez-rk3399_defconfig                 |   2 +-
 configs/lubancat-2-rk3568_defconfig           |   2 +-
 configs/miqi-rk3288_defconfig                 |   2 +-
 configs/mk808_defconfig                       |   2 +-
 configs/nanopc-t4-rk3399_defconfig            |   2 +-
 configs/nanopc-t6-rk3588_defconfig            |   2 +-
 configs/nanopi-m4-2gb-rk3399_defconfig        |   2 +-
 configs/nanopi-m4-rk3399_defconfig            |   2 +-
 configs/nanopi-m4b-rk3399_defconfig           |   2 +-
 configs/nanopi-neo4-rk3399_defconfig          |   2 +-
 configs/nanopi-r2c-plus-rk3328_defconfig      |   2 +-
 configs/nanopi-r2c-rk3328_defconfig           |   2 +-
 configs/nanopi-r2s-plus-rk3328_defconfig      |   2 +-
 configs/nanopi-r2s-rk3328_defconfig           |   2 +-
 configs/nanopi-r4s-rk3399_defconfig           |   2 +-
 configs/nanopi-r5c-rk3568_defconfig           |   2 +-
 configs/nanopi-r5s-rk3568_defconfig           |   2 +-
 configs/nanopi-r6c-rk3588s_defconfig          |   2 +-
 configs/nanopi-r6s-rk3588s_defconfig          |   2 +-
 configs/neu2-io-rv1126_defconfig              |   2 +-
 configs/neu6a-io-rk3588_defconfig             |   2 +-
 configs/neu6b-io-rk3588_defconfig             |   2 +-
 configs/nova-rk3588s_defconfig                |   2 +-
 configs/odroid-go2_defconfig                  |   2 +-
 configs/odroid-m1-rk3568_defconfig            |   2 +-
 configs/odroid-m1s-rk3566_defconfig           |   2 +-
 configs/odroid-m2-rk3588s_defconfig           |   2 +-
 configs/orangepi-3b-rk3566_defconfig          |   2 +-
 configs/orangepi-5-plus-rk3588_defconfig      |   2 +-
 configs/orangepi-5-rk3588s_defconfig          |   2 +-
 configs/orangepi-r1-plus-lts-rk3328_defconfig |   2 +-
 configs/orangepi-r1-plus-rk3328_defconfig     |   2 +-
 configs/orangepi-rk3399_defconfig             |   2 +-
 configs/phycore-rk3288_defconfig              |   2 +-
 configs/pinebook-pro-rk3399_defconfig         |   2 +-
 configs/pinephone-pro-rk3399_defconfig        |   2 +-
 configs/pinetab2-rk3566_defconfig             |   2 +-
 configs/popmetal-rk3288_defconfig             |   2 +-
 configs/powkiddy-x55-rk3566_defconfig         |   2 +-
 configs/puma-rk3399_defconfig                 |   2 +-
 configs/px30-core-ctouch2-of10-px30_defconfig |   2 +-
 configs/px30-core-ctouch2-px30_defconfig      |   2 +-
 configs/px30-core-edimm2.2-px30_defconfig     |   2 +-
 configs/qnap-ts433-rk3568_defconfig           |   2 +-
 configs/quartz64-a-rk3566_defconfig           |   2 +-
 configs/quartz64-b-rk3566_defconfig           |   2 +-
 configs/quartzpro64-rk3588_defconfig          |   2 +-
 configs/radxa-cm3-io-rk3566_defconfig         |   2 +-
 configs/radxa-e25-rk3568_defconfig            |   2 +-
 configs/radxa-zero-3-rk3566_defconfig         |   2 +-
 configs/rk3399-generic_defconfig              | 133 +++++
 configs/roc-cc-rk3308_defconfig               |   2 +-
 configs/roc-cc-rk3328_defconfig               |   2 +-
 configs/roc-pc-mezzanine-rk3399_defconfig     |   2 +-
 configs/roc-pc-rk3399_defconfig               |   2 +-
 configs/rock-3a-rk3568_defconfig              |   2 +-
 configs/rock-3b-rk3568_defconfig              |   2 +-
 configs/rock-3c-rk3566_defconfig              |   2 +-
 configs/rock-4c-plus-rk3399_defconfig         |   2 +-
 configs/rock-4se-rk3399_defconfig             |   2 +-
 configs/rock-5-itx-rk3588_defconfig           |   2 +-
 configs/rock-pi-4-rk3399_defconfig            |   2 +-
 configs/rock-pi-4c-rk3399_defconfig           |   2 +-
 configs/rock-pi-e-rk3328_defconfig            |   2 +-
 configs/rock-pi-e-v3-rk3328_defconfig         |   2 +-
 configs/rock-pi-n10-rk3399pro_defconfig       |   2 +-
 configs/rock-pi-n8-rk3288_defconfig           |   2 +-
 configs/rock-pi-s-rk3308_defconfig            |   2 +-
 configs/rock-s0-rk3308_defconfig              |   2 +-
 configs/rock2_defconfig                       |   2 +-
 configs/rock5a-rk3588s_defconfig              |   2 +-
 configs/rock5b-rk3588_defconfig               |   2 +-
 configs/rock64-rk3328_defconfig               |   2 +-
 configs/rock960-rk3399_defconfig              |   2 +-
 configs/rock_defconfig                        |   2 +-
 configs/rockpro64-rk3399_defconfig            |   2 +-
 configs/sige7-rk3588_defconfig                |   2 +-
 configs/sonoff-ihost-rv1126_defconfig         |   2 +-
 configs/soquartz-blade-rk3566_defconfig       |   2 +-
 configs/soquartz-cm4-rk3566_defconfig         |   2 +-
 configs/soquartz-model-a-rk3566_defconfig     |   2 +-
 configs/tiger-rk3588_defconfig                |   2 +-
 configs/tinker-rk3288_defconfig               |   2 +-
 configs/tinker-s-rk3288_defconfig             |   2 +-
 configs/toybrick-rk3588_defconfig             |   2 +-
 configs/turing-rk1-rk3588_defconfig           |   2 +-
 configs/vyasa-rk3288_defconfig                |   2 +-
 doc/board/rockchip/rockchip.rst               |  13 +
 drivers/ram/rockchip/sdram_rk3399.c           |   6 +-
 include/bloblist.h                            |  10 -
 include/vbe.h                                 |   3 +
 149 files changed, 1016 insertions(+), 312 deletions(-)
 create mode 100644 arch/arm/dts/rk3399-generic-u-boot.dtsi
 create mode 100644 arch/arm/dts/rk3399-generic.dts
 create mode 100644 arch/arm/mach-rockchip/u-boot-vpl-v8.lds
 create mode 100644 arch/arm/mach-rockchip/vpl.c
 create mode 100644 configs/rk3399-generic_defconfig
#86 lore raw

Hi Jonas,

Quoted 8 lines · Jonas Karlman

Hi Simon,

It does not look like this is based on the master branch and cannot be applied for review/testing. Please rebase on top of the master branch.

Some quick feedback:
- Some of these could/should be a standalone patch, i.e. os=u-boot fix.

OK, I'll move them earlier in case you want to apply them sooner.

Quoted 3 lines

- All experimental VBE/VPL addition to rockchip-u-boot.dtsi should probably be moved to a separate file not to clutter the regular binman image.

OK

Quoted 1 line

- rk3399-generic is not generic, it is just pinepro64 with a new name?

It is loosely based on firefly-rk3399 which is a board I have in my lab.

Quoted 4 lines

Please see [1] for the addition of a generic target I sent out, matching existing minimal generic targets for rk35xx.

Will get back with a more in depth feedback later.

Thanks for looking at this.

Regards,
Simon

Quoted 298 lines

[1] https://lore.kernel.org/r/[email protected]/

Regards,
Jonas

Quoted 290 lines · Simon Glass

This series completes the work to enable VBE on a suitable board. Most of it is rockchip-specific patches to support the VPL phase, i.e. the one which decides which boot patch to take (A, B or recovery).

A good chunk of this series is adding an image for VBE, by creating a new Binman image. Future work in Binman may make this more automated / easier, but for now it is written out in full. The work is undertaken piecemeal so it is easier to review the steps.

VBE allows similar boards to share firmware images, with perhaps just TPL (around 75K) being different for each board. Using a common image for VPL, SPL and U-Boot saves a lot of space in the image and makes builds easier. Of course, each board still needs a separate devicetree.

Here is the layout of the image:

Name Image-pos Size Entry-type Offset Uncomp-size
----------------------------------------------------------------------------------------------

image                                 0   1b960cf  section                    0
  alternates-fdt                   8000     31000  alternates-fdt          8000
    mkimage                        8000     31000  mkimage                    0
      u-boot-tpl                   8048     12a11  u-boot-tpl                48
  vpl                            208000     16200  fit                   208000
    image-vpl                    209400      a5a3  section                 1400
      section                    209400      a5a3  section                    0
        u-boot-vpl-nodtb                    10348  u-boot-vpl-nodtb           0
        u-boot-vpl-bss-pad                     20  u-boot-vpl-bss-pad     10348
    @fdt-SEQ                          0         0  section                    0
  vbe-a                          800000    39b200  section               800000
    spl-a                        800000    100000  fit                        0
      spl                        801400     10c97  section                 1400
        section                  801400     10c97  section                    0
          u-boot-spl-nodtb                  1a908  u-boot-spl-nodtb           0
          u-boot-spl-bss-pad                  1b0  u-boot-spl-bss-pad     1a908
      @fdt-SEQ                        0         0  section                    0
    u-boot-a                     900000    29b200  fit                   100000
      spl                        902400     10c97  section                 2400
        section                  902400     10c97  section                    0
          u-boot-spl-nodtb                  1a908  u-boot-spl-nodtb           0
          u-boot-spl-bss-pad                  1b0  u-boot-spl-bss-pad     1a908
      u-boot                     913200     e4250  section                13200
        u-boot-nodtb             913200     e4250  u-boot-nodtb               0
      @atf-SEQ                        0         0  section                    0
        atf-bl31                      0         0  atf-bl31                   0
      @tee-SEQ                        0         0  section                    0
        tee-os                        0         0  tee-os                     0
      @fdt-SEQ                        0         0  section                    0
  vbe-b                         1000000    39b200  section              1000000
    spl-b                       1000000    100000  fit                        0
      spl                       1001400     10c97  section                 1400
        section                 1001400     10c97  section                    0
          u-boot-spl-nodtb                  1a908  u-boot-spl-nodtb           0
          u-boot-spl-bss-pad                  1b0  u-boot-spl-bss-pad     1a908
      @fdt-SEQ                        0         0  section                    0
    u-boot-b                    1100000    29b200  fit                   100000
      spl                       1102400     10c97  section                 2400
        section                 1102400     10c97  section                    0
          u-boot-spl-nodtb                  1a908  u-boot-spl-nodtb           0
          u-boot-spl-bss-pad                  1b0  u-boot-spl-bss-pad     1a908
      u-boot                    1113200     e4250  section                13200
        u-boot-nodtb            1113200     e4250  u-boot-nodtb               0
      @atf-SEQ                        0         0  section                    0
        atf-bl31                      0         0  atf-bl31                   0
      @tee-SEQ                        0         0  section                    0
        tee-os                        0         0  tee-os                     0
      @fdt-SEQ                        0         0  section                    0
  vbe-recovery                  1800000    39b200  section              1800000
    spl-recovery                1800000    100000  fit                        0
      spl                       1801400     10c97  section                 1400
        section                 1801400     10c97  section                    0
          u-boot-spl-nodtb                  1a908  u-boot-spl-nodtb           0
          u-boot-spl-bss-pad                  1b0  u-boot-spl-bss-pad     1a908
      @fdt-SEQ                        0         0  section                    0
    u-boot-recovery             1900000    29b200  fit                   100000
      spl                       1902400     10c97  section                 2400
        section                 1902400     10c97  section                    0
          u-boot-spl-nodtb                  1a908  u-boot-spl-nodtb           0
          u-boot-spl-bss-pad                  1b0  u-boot-spl-bss-pad     1a908
      u-boot                    1913200     e4250  section                13200
        u-boot-nodtb            1913200     e4250  u-boot-nodtb               0
      @atf-SEQ                        0         0  section                    0
        atf-bl31                      0         0  atf-bl31                   0
      @tee-SEQ                        0         0  section                    0
        tee-os                        0         0  tee-os                     0
      @fdt-SEQ                        0         0  section                    0
  fdtmap                        1b9b200      2ecf  fdtmap               1b9b200

Unfortunately I got a bit lost trying to figure out the bloblist code, despite my being the original author. So for now I have included a revert of a recent patch, so that the logic can be simplified and more in keeping with the original intent. We may in fact need a symbol which specifically says which phase creates the bloblist, but I'm not completely sure of what the reverted patch was trying to achieve.

This is (mostly) the final VBE series, but there are a few loose ends to tidy up:

- cache is disabled in SPL, which slows the boot a little
- pinctrl init needs to be tidied up to avoid warnings

Other things may become apparently after more usage / testing.

Simon Glass (29):
arm: Support a separate stack for VPL
spl: Adjust xPL symbols
spl: Allow VBE to handle xPL size
vbe: Show the margin when using SPL_RELOC
rockchip: Allow RAM init to happen in SPL on rk3399
rockchip: dts: Factor out arch and compression
rockchip: Add an fdtmap
rockchip: Add more space below the stack pointer with kevin
rockchip: dts: Create a template for the FIT
rockchip: dts: Un-indent the FIT template
rockchip: dts: Correct the OS for U-Boot
rockchip: Specify the phase in the image
rockchip: Provide a bootstd configuration
rockchip: Add SPL into the main FIT
rockchip: Include a compatible string in each configuration
rockchip: Set the skip-at-start property correctly
rockchip: Add a template for SPL
rockchip: Add a VPL image
rockchip: Add TPL alternatives
rockchip: Update rk3399 bootph-tags for VPL
rockchip: Provide a VPL phase on rk3399
rockchip: Add symbols for spl_reloc
rockchip: Adjust rk3399 TPL-stack to the same as SPL
rockchip: Allow SPL to set up SDRAM
rockchip: Add a generic rk3399 board
rockchip: Add documentation for VBE
gitlab: Add an VBE board to the sjg lab
Revert "bloblist: Load the bloblist from the previous loader"
bloblist: Allow relocation at the end of the SPL phase

 .gitlab-ci.yml                                |   6 +
 arch/arm/dts/rk3399-generic-u-boot.dtsi       |  32 ++
 arch/arm/dts/rk3399-generic.dts               |  30 ++
 arch/arm/dts/rk3399-u-boot.dtsi               |   9 +-
 arch/arm/dts/rockchip-u-boot.dtsi             | 455 +++++++++++++-----
 arch/arm/include/asm/spl.h                    |   1 +
 arch/arm/lib/crt0_64.S                        |   4 +-
 arch/arm/mach-rockchip/Kconfig                |  25 +-
 arch/arm/mach-rockchip/Makefile               |   6 +-
 arch/arm/mach-rockchip/rk3399/Kconfig         |  11 +-
 arch/arm/mach-rockchip/spl-boot-order.c       |   3 +-
 arch/arm/mach-rockchip/spl.c                  |   3 +
 arch/arm/mach-rockchip/tpl.c                  |  12 +-
 arch/arm/mach-rockchip/u-boot-tpl-v8.lds      |  13 +
 arch/arm/mach-rockchip/u-boot-vpl-v8.lds      | 107 ++++
 arch/arm/mach-rockchip/vpl.c                  |  53 ++
 board/rockchip/evb_rk3399/MAINTAINERS         |   5 +
 cmd/vbe.c                                     |   8 +-
 common/Kconfig                                |  20 +
 common/bloblist.c                             |  77 ++-
 common/spl/Kconfig                            |   1 +
 common/spl/Kconfig.vpl                        |  13 +
 common/spl/spl.c                              |  11 +
 common/spl/spl_reloc.c                        |  14 +-
 configs/anbernic-rgxx3-rk3566_defconfig       |   2 +-
 configs/bpi-r2-pro-rk3568_defconfig           |   2 +-
 configs/chromebit_mickey_defconfig            |   2 +-
 configs/chromebook_bob_defconfig              |   4 +-
 configs/chromebook_jerry_defconfig            |   2 +-
 configs/chromebook_kevin_defconfig            |   4 +-
 configs/chromebook_minnie_defconfig           |   2 +-
 configs/chromebook_speedy_defconfig           |   2 +-
 configs/cm3588-nas-rk3588_defconfig           |   2 +-
 configs/coolpi-4b-rk3588s_defconfig           |   2 +-
 configs/coolpi-cm5-evb-rk3588_defconfig       |   2 +-
 configs/coolpi-cm5-genbook-rk3588_defconfig   |   2 +-
 configs/eaidk-610-rk3399_defconfig            |   2 +-
 configs/evb-px30_defconfig                    |   2 +-
 configs/evb-px5_defconfig                     |   2 +-
 configs/evb-rk3036_defconfig                  |   2 +-
 configs/evb-rk3229_defconfig                  |   2 +-
 configs/evb-rk3288_defconfig                  |   2 +-
 configs/evb-rk3308_defconfig                  |   2 +-
 configs/evb-rk3328_defconfig                  |   2 +-
 configs/evb-rk3399_defconfig                  |   2 +-
 configs/evb-rk3568_defconfig                  |   2 +-
 configs/evb-rk3588_defconfig                  |   2 +-
 configs/ficus-rk3399_defconfig                |   2 +-
 configs/firefly-px30_defconfig                |   2 +-
 configs/firefly-rk3288_defconfig              |   2 +-
 configs/firefly-rk3399_defconfig              |   2 +-
 configs/generic-rk3568_defconfig              |   2 +-
 configs/generic-rk3588_defconfig              |   2 +-
 configs/jaguar-rk3588_defconfig               |   2 +-
 configs/khadas-edge-captain-rk3399_defconfig  |   2 +-
 configs/khadas-edge-rk3399_defconfig          |   2 +-
 configs/khadas-edge-v-rk3399_defconfig        |   2 +-
 configs/kylin-rk3036_defconfig                |   2 +-
 configs/leez-rk3399_defconfig                 |   2 +-
 configs/lubancat-2-rk3568_defconfig           |   2 +-
 configs/miqi-rk3288_defconfig                 |   2 +-
 configs/mk808_defconfig                       |   2 +-
 configs/nanopc-t4-rk3399_defconfig            |   2 +-
 configs/nanopc-t6-rk3588_defconfig            |   2 +-
 configs/nanopi-m4-2gb-rk3399_defconfig        |   2 +-
 configs/nanopi-m4-rk3399_defconfig            |   2 +-
 configs/nanopi-m4b-rk3399_defconfig           |   2 +-
 configs/nanopi-neo4-rk3399_defconfig          |   2 +-
 configs/nanopi-r2c-plus-rk3328_defconfig      |   2 +-
 configs/nanopi-r2c-rk3328_defconfig           |   2 +-
 configs/nanopi-r2s-plus-rk3328_defconfig      |   2 +-
 configs/nanopi-r2s-rk3328_defconfig           |   2 +-
 configs/nanopi-r4s-rk3399_defconfig           |   2 +-
 configs/nanopi-r5c-rk3568_defconfig           |   2 +-
 configs/nanopi-r5s-rk3568_defconfig           |   2 +-
 configs/nanopi-r6c-rk3588s_defconfig          |   2 +-
 configs/nanopi-r6s-rk3588s_defconfig          |   2 +-
 configs/neu2-io-rv1126_defconfig              |   2 +-
 configs/neu6a-io-rk3588_defconfig             |   2 +-
 configs/neu6b-io-rk3588_defconfig             |   2 +-
 configs/nova-rk3588s_defconfig                |   2 +-
 configs/odroid-go2_defconfig                  |   2 +-
 configs/odroid-m1-rk3568_defconfig            |   2 +-
 configs/odroid-m1s-rk3566_defconfig           |   2 +-
 configs/odroid-m2-rk3588s_defconfig           |   2 +-
 configs/orangepi-3b-rk3566_defconfig          |   2 +-
 configs/orangepi-5-plus-rk3588_defconfig      |   2 +-
 configs/orangepi-5-rk3588s_defconfig          |   2 +-
 configs/orangepi-r1-plus-lts-rk3328_defconfig |   2 +-
 configs/orangepi-r1-plus-rk3328_defconfig     |   2 +-
 configs/orangepi-rk3399_defconfig             |   2 +-
 configs/phycore-rk3288_defconfig              |   2 +-
 configs/pinebook-pro-rk3399_defconfig         |   2 +-
 configs/pinephone-pro-rk3399_defconfig        |   2 +-
 configs/pinetab2-rk3566_defconfig             |   2 +-
 configs/popmetal-rk3288_defconfig             |   2 +-
 configs/powkiddy-x55-rk3566_defconfig         |   2 +-
 configs/puma-rk3399_defconfig                 |   2 +-
 configs/px30-core-ctouch2-of10-px30_defconfig |   2 +-
 configs/px30-core-ctouch2-px30_defconfig      |   2 +-
 configs/px30-core-edimm2.2-px30_defconfig     |   2 +-
 configs/qnap-ts433-rk3568_defconfig           |   2 +-
 configs/quartz64-a-rk3566_defconfig           |   2 +-
 configs/quartz64-b-rk3566_defconfig           |   2 +-
 configs/quartzpro64-rk3588_defconfig          |   2 +-
 configs/radxa-cm3-io-rk3566_defconfig         |   2 +-
 configs/radxa-e25-rk3568_defconfig            |   2 +-
 configs/radxa-zero-3-rk3566_defconfig         |   2 +-
 configs/rk3399-generic_defconfig              | 133 +++++
 configs/roc-cc-rk3308_defconfig               |   2 +-
 configs/roc-cc-rk3328_defconfig               |   2 +-
 configs/roc-pc-mezzanine-rk3399_defconfig     |   2 +-
 configs/roc-pc-rk3399_defconfig               |   2 +-
 configs/rock-3a-rk3568_defconfig              |   2 +-
 configs/rock-3b-rk3568_defconfig              |   2 +-
 configs/rock-3c-rk3566_defconfig              |   2 +-
 configs/rock-4c-plus-rk3399_defconfig         |   2 +-
 configs/rock-4se-rk3399_defconfig             |   2 +-
 configs/rock-5-itx-rk3588_defconfig           |   2 +-
 configs/rock-pi-4-rk3399_defconfig            |   2 +-
 configs/rock-pi-4c-rk3399_defconfig           |   2 +-
 configs/rock-pi-e-rk3328_defconfig            |   2 +-
 configs/rock-pi-e-v3-rk3328_defconfig         |   2 +-
 configs/rock-pi-n10-rk3399pro_defconfig       |   2 +-
 configs/rock-pi-n8-rk3288_defconfig           |   2 +-
 configs/rock-pi-s-rk3308_defconfig            |   2 +-
 configs/rock-s0-rk3308_defconfig              |   2 +-
 configs/rock2_defconfig                       |   2 +-
 configs/rock5a-rk3588s_defconfig              |   2 +-
 configs/rock5b-rk3588_defconfig               |   2 +-
 configs/rock64-rk3328_defconfig               |   2 +-
 configs/rock960-rk3399_defconfig              |   2 +-
 configs/rock_defconfig                        |   2 +-
 configs/rockpro64-rk3399_defconfig            |   2 +-
 configs/sige7-rk3588_defconfig                |   2 +-
 configs/sonoff-ihost-rv1126_defconfig         |   2 +-
 configs/soquartz-blade-rk3566_defconfig       |   2 +-
 configs/soquartz-cm4-rk3566_defconfig         |   2 +-
 configs/soquartz-model-a-rk3566_defconfig     |   2 +-
 configs/tiger-rk3588_defconfig                |   2 +-
 configs/tinker-rk3288_defconfig               |   2 +-
 configs/tinker-s-rk3288_defconfig             |   2 +-
 configs/toybrick-rk3588_defconfig             |   2 +-
 configs/turing-rk1-rk3588_defconfig           |   2 +-
 configs/vyasa-rk3288_defconfig                |   2 +-
 doc/board/rockchip/rockchip.rst               |  13 +
 drivers/ram/rockchip/sdram_rk3399.c           |   6 +-
 include/bloblist.h                            |  10 -
 include/vbe.h                                 |   3 +
 149 files changed, 1016 insertions(+), 312 deletions(-)
 create mode 100644 arch/arm/dts/rk3399-generic-u-boot.dtsi
 create mode 100644 arch/arm/dts/rk3399-generic.dts
 create mode 100644 arch/arm/mach-rockchip/u-boot-vpl-v8.lds
 create mode 100644 arch/arm/mach-rockchip/vpl.c
 create mode 100644 configs/rk3399-generic_defconfig