Skip to contentSkip to conversation

vbe: Series part F

PATCH Superseded Simon Glass 2 participants 32 messages Jan 9, 2025 – Jan 15, 2025

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover vbe: Series part F

This includes various patches towards implementing the VBE abrec bootmeth in U-Boot. It mostly focuses on introducing a relocating SPL-loader so that VBE can run in the limited amount of SRAM available on many devices.

Another minor new feature is support in VBE for specifying the image phase when loading from a FIT. This allows a single FIT to include images for several boot phases, thus simplifying image-creation.

One lingering niggle in this series is that it has a different code path for sandbox, since it does not support the relocating jump. It should be possible to resolve this with additional work, but I have not attempted this so far.

Again, only MMC is supported so far.

Looking ahead, series G will have some more plumbing and H some rk3399 pieces. That should be enough to complete these feature.

Here is a run in my lab, with the VBE ABrec bootmeth. You can see that VPL runs before memory is set up. SPL sets up memory and can be upgraded in the field reliably.

$ ub-int vbe
Building U-Boot in sourcedir for rk3399-generic
Bootstrapping U-Boot from dir /tmp/b/rk3399-generic
Writing U-Boot using method rockchip

U-Boot TPL 2025.01-rc3-00345-gdfbdbf1eb56c-dirty (Jan 08 2025 - 10:47:58) Trying to boot from vbe_abrec
load: Firefly-RK3399 Board
Using 'config-3' configuration
Trying 'image-vpl' firmware subimage
Using 'config-3' configuration
Trying 'fdt-3' fdt subimage

U-Boot VPL 2025.01-rc3-00345-gdfbdbf1eb56c-dirty (Jan 08 2025 - 10:47:58) Trying to boot from vbe_abrec
load: Firefly-RK3399 Board
Starting with empty state
VBE: Firmware pick A at 800000
Using 'config-3' configuration
Trying 'spl' firmware subimage
Using 'config-3' configuration
Trying 'fdt-3' fdt subimage
Channel 0: DDR3, 800MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB Channel 1: DDR3, 800MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB 256B stride

U-Boot SPL 2025.01-rc3-00345-gdfbdbf1eb56c-dirty (Jan 08 2025 - 10:47:58 -0700) Trying to boot from vbe_abrec
load: Firefly-RK3399 Board
VBE: Firmware pick A at 900000
load_simple_fit: Skip load 'atf-5': image size is 0!
Relocating bloblist ff8eff00 to 100000: done
ns16550_serial serial@ff1a0000: pinctrl_select_state_full: uclass_get_device_by_phandle_id: err=-19

U-Boot 2025.01-rc3-00345-gdfbdbf1eb56c-dirty (Jan 08 2025 - 10:47:58 -0700)

SoC: Rockchip rk3399
Reset cause: POR
Model: Firefly-RK3399 Board
DRAM:  4 GiB (effective 3.9 GiB)
Core:  314 devices, 33 uclasses, devicetree: separate
MMC:   mmc@fe310000: 3, mmc@fe320000: 1, mmc@fe330000: 0

Loading Environment from SPIFlash... Invalid bus 0 (err=-19) *** Warning - spi_flash_probe_bus_cs() failed, using default environment

In:    serial,usbkbd
Out:   serial,vidconsole
Err:   serial,vidconsole
Model: Firefly-RK3399 Board
Net:   PMIC:  RK808
eth0: ethernet@fe300000

starting USB...
Bus usb@fe380000: USB EHCI 1.00
Bus usb@fe3a0000: USB OHCI 1.0
Bus usb@fe3c0000: USB EHCI 1.00
Bus usb@fe3e0000: USB OHCI 1.0
Bus usb@fe900000: Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
scanning bus usb@fe380000 for devices... 1 USB Device(s) found scanning bus usb@fe3a0000 for devices... 1 USB Device(s) found scanning bus usb@fe3c0000 for devices... 2 USB Device(s) found scanning bus usb@fe3e0000 for devices... 1 USB Device(s) found scanning bus usb@fe900000 for devices... 1 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot: 0

Simon Glass (15):
vbe: Split out some VBE code into a common file
vbe: Split out reading a FIT into a common file
vbe: Allocate space for the FIT header
vbe: Allow VBE to load FITs on any architecture
vbe: Tidy up error checking with blk_read()
vbe: Handle loading from an unaligned offset
vbe: Allow loading loadables if there is no firmware
vbe: Support loading an FDT from the FIT
spl: Add fields for VBE
spl: Add a type for the jumper function
spl: Add support for a relocating jump to the next phase
spl: Plumb in the relocating loader
vbe: Support loading an FDT with the relocating loader
vbe: Support loading SPL images
vbe: Update simple-fw to support using the SPL loader

 boot/Makefile          |   2 +-
 boot/vbe_common.c      | 362 +++++++++++++++++++++++++++++++++++++++++
 boot/vbe_common.h      | 173 ++++++++++++++++++++
 boot/vbe_simple.c      |  99 +++--------
 boot/vbe_simple.h      |  15 +-
 boot/vbe_simple_fw.c   | 207 +++++++++--------------
 common/spl/Kconfig     |   8 +
 common/spl/Kconfig.tpl |   8 +
 common/spl/Kconfig.vpl |   8 +
 common/spl/Makefile    |   1 +
 common/spl/spl.c       |  15 +-
 common/spl/spl_reloc.c | 183 +++++++++++++++++++++
 include/spl.h          |  90 +++++++++-
 13 files changed, 948 insertions(+), 223 deletions(-)
 create mode 100644 boot/vbe_common.c
 create mode 100644 boot/vbe_common.h
 create mode 100644 common/spl/spl_reloc.c
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/15 vbe: Split out some VBE code into a common file

Loading a FIT is useful for other VBE methods, such as ABrec, so start a new common file. Add functions for reading the version and nvdata. Also add a function to get the block device.

---

 boot/Makefile     |   2 +-
 boot/vbe_common.c |  93 ++++++++++++++++++++++++++++++
 boot/vbe_common.h | 143 ++++++++++++++++++++++++++++++++++++++++++++++
 boot/vbe_simple.c |  99 +++++++-------------------------
 boot/vbe_simple.h |  15 +----
 5 files changed, 258 insertions(+), 94 deletions(-)
 create mode 100644 boot/vbe_common.c
 create mode 100644 boot/vbe_common.h
boot/Makefile +1 -1
index 9446c6b82a9..30529bac367 100644
@@ -66,7 +66,7 @@ endif
 
 obj-$(CONFIG_$(PHASE_)BOOTMETH_VBE) += vbe.o
 obj-$(CONFIG_$(PHASE_)BOOTMETH_VBE_REQUEST) += vbe_request.o
-obj-$(CONFIG_$(PHASE_)BOOTMETH_VBE_SIMPLE) += vbe_simple.o
+obj-$(CONFIG_$(PHASE_)BOOTMETH_VBE_SIMPLE) += vbe_simple.o vbe_common.o
 obj-$(CONFIG_$(PHASE_)BOOTMETH_VBE_SIMPLE_FW) += vbe_simple_fw.o
 obj-$(CONFIG_$(PHASE_)BOOTMETH_VBE_SIMPLE_OS) += vbe_simple_os.o
 
boot/vbe_common.c new file +93 -0

93 lines not on this page · raw message

boot/vbe_common.h new file +143 -0

143 lines not on this page · raw message

boot/vbe_simple.c +20 -79

123 lines not on this page · raw message

boot/vbe_simple.h +1 -14
index 56d319206f2..8eb3ddb61ba 100644
@@ -9,20 +9,7 @@
 #ifndef __VBE_SIMPLE_H
 #define __VBE_SIMPLE_H
 
-enum {
-	MAX_VERSION_LEN		= 256,
-
-	NVD_HDR_VER_SHIFT	= 0,
-	NVD_HDR_VER_MASK	= 0xf,
-	NVD_HDR_SIZE_SHIFT	= 4,
-	NVD_HDR_SIZE_MASK	= 0xf << NVD_HDR_SIZE_SHIFT,
-
-	/* Firmware key-version is in the top 16 bits of fw_ver */
-	FWVER_KEY_SHIFT		= 16,
-	FWVER_FW_MASK		= 0xffff,
-
-	NVD_HDR_VER_CUR		= 1,	/* current version */
-};
+#include "vbe_common.h"
 
 /** struct simple_priv - information read from the device tree */
 struct simple_priv {
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH 01/15] vbe: Split out some VBE code into a common file

Quoted 3 lines · Simon Glass

Loading a FIT is useful for other VBE methods, such as ABrec, so start a new common file. Add functions for reading the version and nvdata. Also add a function to get the block device.

This is not a good commit message when you're also introducing functional changes (blk_dread -> blk_read). Further, this functional change seems to introduce some other code being pulled in very unexpectedly, and that needs to be explained. For example, phycore_am62x_r5_usbdfu is another case and that has CONFIG_BLOCK_CACHE=y but CONFIG_SPL_BLOCK_CACHE=n, and yet the size growth is in full U-Boot. Just moving code should not result in unexpected size change.

Signature · 1 line
Tom
#3 lore raw

Re: [PATCH 01/15] vbe: Split out some VBE code into a common file

Hi Tom,

Quoted 9 lines · Tom Rini
Quoted 3 lines · Simon Glass

Loading a FIT is useful for other VBE methods, such as ABrec, so start a new common file. Add functions for reading the version and nvdata. Also add a function to get the block device.

This is not a good commit message when you're also introducing functional changes (blk_dread -> blk_read).

Yes, I did not actually notice this size change at all, as mentioned, as I only built for a few boards (firefly rk3399/rk3288 and a few sandbox ones). The blk_dread() function is the old API for reading from a block. It didn't occur to me that blk_dread() would bypass the cache.

Quoted 6 lines

Further, this functional
change seems to introduce some other code being pulled in very unexpectedly, and that needs to be explained. For example, phycore_am62x_r5_usbdfu is another case and that has CONFIG_BLOCK_CACHE=y but CONFIG_SPL_BLOCK_CACHE=n, and yet the size growth is in full U-Boot.

This board currently uses blk_dread(), but not blk_read(), so the addition of a blk_read() call in non-SPL causes the BLK cache to be pulled in.

Quoted 2 lines

Just moving code should not result in
unexpected size change.

That's correct, so long as 'expected' size changes includes the normal function-call overhead and loss of intra-module optimisation.

So, what to do here? I certainly don't want to use the old blk API. But I can perhaps do a patch which changes VBE to use the new one, first, so the size growth is within that commit. I looked up BLOCK_CACHE and it is used by 90% of boards.

Another thing I could do (down the track) is a separate series to remove blk_d...() functions.

Regards,
Simon

#4 lore raw

Re: [PATCH 01/15] vbe: Split out some VBE code into a common file

Hi Tom,

Quoted 37 lines · Simon Glass

Hi Tom,

Quoted 9 lines · Tom Rini
Quoted 3 lines · Simon Glass

Loading a FIT is useful for other VBE methods, such as ABrec, so start a new common file. Add functions for reading the version and nvdata. Also add a function to get the block device.

This is not a good commit message when you're also introducing functional changes (blk_dread -> blk_read).

Yes, I did not actually notice this size change at all, as mentioned, as I only built for a few boards (firefly rk3399/rk3288 and a few sandbox ones). The blk_dread() function is the old API for reading from a block. It didn't occur to me that blk_dread() would bypass the cache.

Quoted 6 lines

Further, this functional
change seems to introduce some other code being pulled in very unexpectedly, and that needs to be explained. For example, phycore_am62x_r5_usbdfu is another case and that has CONFIG_BLOCK_CACHE=y but CONFIG_SPL_BLOCK_CACHE=n, and yet the size growth is in full U-Boot.

This board currently uses blk_dread(), but not blk_read(), so the addition of a blk_read() call in non-SPL causes the BLK cache to be pulled in.

Quoted 2 lines

Just moving code should not result in
unexpected size change.

That's correct, so long as 'expected' size changes includes the normal function-call overhead and loss of intra-module optimisation.

Quoted 7 lines

So, what to do here? I certainly don't want to use the old blk API. But I can perhaps do a patch which changes VBE to use the new one, first, so the size growth is within that commit. I looked up BLOCK_CACHE and it is used by 90% of boards.

Another thing I could do (down the track) is a separate series to remove blk_d...() functions.

Further to this I've created a v2 series which splits the first commit into more pieces, so we can more clearly see the code-size increase. I'll hold off sending it for now, in case something else comes up in this discussion.

Regards,
Simon

#5 lore raw

Re: [PATCH 01/15] vbe: Split out some VBE code into a common file

In reply to Simon Glass
Quoted 10 lines · Simon Glass

Hi Tom,

Quoted 7 lines · Tom Rini
Quoted 3 lines · Simon Glass

Loading a FIT is useful for other VBE methods, such as ABrec, so start a new common file. Add functions for reading the version and nvdata. Also add a function to get the block device.

Quoted 6 lines
Quoted 2 lines

This is not a good commit message when you're also introducing functional changes (blk_dread -> blk_read).

Yes, I did not actually notice this size change at all, as mentioned, as I only built for a few boards (firefly rk3399/rk3288 and a few sandbox ones). The blk_dread() function is the old API for reading

You have much faster build machines available than I do, it would be good to run a world build before/after (it might take an hour on alexandra) before posting these big series.

Quoted 2 lines

from a block. It didn't occur to me that blk_dread() would bypass the cache.

Yes, how is that happening? That's what doesn't make sense.

Quoted 11 lines
Quoted 7 lines

Further, this functional
change seems to introduce some other code being pulled in very unexpectedly, and that needs to be explained. For example, phycore_am62x_r5_usbdfu is another case and that has CONFIG_BLOCK_CACHE=y but CONFIG_SPL_BLOCK_CACHE=n, and yet the size growth is in full U-Boot.

This board currently uses blk_dread(), but not blk_read(), so the addition of a blk_read() call in non-SPL causes the BLK cache to be pulled in.

But, how? I mean, this sounds like some underlying bug that needs to be fixed. The platform sets CONFIG_BLK=y and CONFIG_BLOCK_CACHE=y and drivers/block/blk-uclass.c has:
ulong blk_dread(struct blk_desc *desc, lbaint_t start, lbaint_t blkcnt,
void *buffer)

{
        return blk_read(desc->bdev, start, blkcnt, buffer);
}

Or perhaps the answer / problem here is that I need to track down what's going wrong here instead of asking you to track this down.

Quoted 5 lines
Quoted 2 lines

Just moving code should not result in
unexpected size change.

That's correct, so long as 'expected' size changes includes the normal function-call overhead and loss of intra-module optimisation.

Yes, but that's not what this series shows. There's (a) the above bug and (b) you might be allocating buffers twice now instead of once?

Quoted 1 line

So, what to do here? I certainly don't want to use the old blk API.

Yes. I'm not 100% sure, especially after
https://patchwork.ozlabs.org/project/uboot/list/?series=437816&state=*
which I need to v2 what the non-SPL case is. And for new features, sure, saying SPL_BLK is required too is fine. Heck, it *may* even be the case that only TPL_BLK=n is required to be valid, all of that would require other investigation and removals.

Quoted 3 lines

But I can perhaps do a patch which changes VBE to use the new one, first, so the size growth is within that commit. I looked up BLOCK_CACHE and it is used by 90% of boards.

Yes, BLOCK_CACHE should be used by everyone at this point, it was one of those cases of "this grows the code but it's a universal speedup".

Signature · 1 line
Tom
#6 lore raw

Re: [PATCH 01/15] vbe: Split out some VBE code into a common file

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

Hi Tom,

Quoted 7 lines · Tom Rini
Quoted 3 lines · Simon Glass

Loading a FIT is useful for other VBE methods, such as ABrec, so start a new common file. Add functions for reading the version and nvdata. Also add a function to get the block device.

Quoted 6 lines
Quoted 2 lines

This is not a good commit message when you're also introducing functional changes (blk_dread -> blk_read).

Yes, I did not actually notice this size change at all, as mentioned, as I only built for a few boards (firefly rk3399/rk3288 and a few sandbox ones). The blk_dread() function is the old API for reading

You have much faster build machines available than I do, it would be good to run a world build before/after (it might take an hour on alexandra) before posting these big series.

Quoted 2 lines

from a block. It didn't occur to me that blk_dread() would bypass the cache.

Yes, how is that happening? That's what doesn't make sense.

Quoted 11 lines
Quoted 7 lines

Further, this functional
change seems to introduce some other code being pulled in very unexpectedly, and that needs to be explained. For example, phycore_am62x_r5_usbdfu is another case and that has CONFIG_BLOCK_CACHE=y but CONFIG_SPL_BLOCK_CACHE=n, and yet the size growth is in full U-Boot.

This board currently uses blk_dread(), but not blk_read(), so the addition of a blk_read() call in non-SPL causes the BLK cache to be pulled in.

But, how? I mean, this sounds like some underlying bug that needs to be fixed. The platform sets CONFIG_BLK=y and CONFIG_BLOCK_CACHE=y and drivers/block/blk-uclass.c has:
ulong blk_dread(struct blk_desc *desc, lbaint_t start, lbaint_t blkcnt,
void *buffer)

Quoted 6 lines
{
        return blk_read(desc->bdev, start, blkcnt, buffer);
}

Or perhaps the answer / problem here is that I need to track down what's going wrong here instead of asking you to track this down.

So, digging in to this, what's going on is that the platforms I've noted here (and a few others) don't actually enable any block devices. That's why, today, with VBE on still, they discard all of the code still. Your rework means that while there's still no block devices, we're now including the code. What to do? Both of:
- These platforms *should* disable the assorted block device related library options they have enabled if / when possible (it might not be a neat and easy un-tangle).
- VBE needs to handle the case where there's not a block device enabled and not fail the build. Part of this requires the Kconfig rework I linked to earlier (so that we can have BLK off) to be complete, but having the VBE code check for BLK being enabled either in Makefile or C code should be the same regardless.

Signature · 1 line
Tom
#7 lore raw

Re: [PATCH 01/15] vbe: Split out some VBE code into a common file

Hi Tom,

Quoted 16 lines · Tom Rini
Quoted 14 lines · Tom Rini
Quoted 13 lines · Simon Glass

Hi Tom,

Quoted 9 lines · Tom Rini
Quoted 3 lines · Simon Glass

Loading a FIT is useful for other VBE methods, such as ABrec, so start a new common file. Add functions for reading the version and nvdata. Also add a function to get the block device.

This is not a good commit message when you're also introducing functional changes (blk_dread -> blk_read).

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

Yes, I did not actually notice this size change at all, as mentioned, as I only built for a few boards (firefly rk3399/rk3288 and a few sandbox ones). The blk_dread() function is the old API for reading

You have much faster build machines available than I do, it would be good to run a world build before/after (it might take an hour on alexandra) before posting these big series.

OK. I used to do this, but with CI sometimes grabbing the machines it ends up with a huge load and sometimes runs out of memory. I suppose I can stop the runner before doing it and remember to restart it afterwards. Or perhaps Alex has enough memory per thread? (96GB).

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

from a block. It didn't occur to me that blk_dread() would bypass the cache.

Yes, how is that happening? That's what doesn't make sense.

OK, I see. It is actually one level deeper than I thought.

PARTITIONS is not enabled, for example on phycore_am62x_r5_usbdfu which means that blk_get_dev() returns NULL

So long as all the code is in one module, blk_get_dev() returning NULL causes the calls to vbe_simple_read_state() and simple_read_nvdata() to be dropped, so their code is dropped too, so there is no blk_read()/blk_dread() call. It is optimised away. It just happens to be the only call in U-Boot

Quoted 25 lines
Quoted 18 lines
Quoted 9 lines
Quoted 8 lines

Further, this functional
change seems to introduce some other code being pulled in very unexpectedly, and that needs to be explained. For example, phycore_am62x_r5_usbdfu is another case and that has CONFIG_BLOCK_CACHE=y but CONFIG_SPL_BLOCK_CACHE=n, and yet the size growth is in full U-Boot.

Quoted 3 lines

This board currently uses blk_dread(), but not blk_read(), so the addition of a blk_read() call in non-SPL causes the BLK cache to be pulled in.

But, how? I mean, this sounds like some underlying bug that needs to be fixed. The platform sets CONFIG_BLK=y and CONFIG_BLOCK_CACHE=y and drivers/block/blk-uclass.c has:
ulong blk_dread(struct blk_desc *desc, lbaint_t start, lbaint_t blkcnt,
void *buffer)

Quoted 6 lines
{
        return blk_read(desc->bdev, start, blkcnt, buffer);
}

Or perhaps the answer / problem here is that I need to track down what's going wrong here instead of asking you to track this down.

Quoted 8 lines

So, digging in to this, what's going on is that the platforms I've noted here (and a few others) don't actually enable any block devices. That's why, today, with VBE on still, they discard all of the code still. Your rework means that while there's still no block devices, we're now including the code. What to do? Both of:
- These platforms *should* disable the assorted block device related library options they have enabled if / when possible (it might not be a neat and easy un-tangle).

As above, the issue seems to be PARTITIONS

Quoted 5 lines

- VBE needs to handle the case where there's not a block device enabled and not fail the build. Part of this requires the Kconfig rework I linked to earlier (so that we can have BLK off) to be complete, but having the VBE code check for BLK being enabled either in Makefile or C code should be the same regardless.

I thought you NAK'd my patch to drop the 'depends on BLK' for bootstd?

From what I can tell EFI_LOADER doesn't do any block access unless PARTITIONS is enabled. I don't want that for VBE because the VBE data is not actually in a partition (although perhaps it could be in future).

Anyway, from what I can tell, the code-size increase is explainable and perhaps we should just accept it.

Regards,
Simon

#8 lore raw

Re: [PATCH 01/15] vbe: Split out some VBE code into a common file

Quoted 23 lines · Simon Glass

Hi Tom,

Quoted 20 lines · Tom Rini
Quoted 18 lines · Tom Rini
Quoted 16 lines · Simon Glass

Hi Tom,

Quoted 9 lines · Tom Rini
Quoted 3 lines · Simon Glass

Loading a FIT is useful for other VBE methods, such as ABrec, so start a new common file. Add functions for reading the version and nvdata. Also add a function to get the block device.

This is not a good commit message when you're also introducing functional changes (blk_dread -> blk_read).

Yes, I did not actually notice this size change at all, as mentioned, as I only built for a few boards (firefly rk3399/rk3288 and a few sandbox ones). The blk_dread() function is the old API for reading

Quoted 8 lines
Quoted 3 lines
Quoted 3 lines

You have much faster build machines available than I do, it would be good to run a world build before/after (it might take an hour on alexandra) before posting these big series.

OK. I used to do this, but with CI sometimes grabbing the machines it ends up with a huge load and sometimes runs out of memory. I suppose I can stop the runner before doing it and remember to restart it afterwards. Or perhaps Alex has enough memory per thread? (96GB).

Personally, I would make the script that does the world build for size test turn off the runner before starting and turn it back on when done otherwise build time will suffer greatly and you would have been better served doing it all on a slower class of machine.

Quoted 9 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

from a block. It didn't occur to me that blk_dread() would bypass the cache.

Yes, how is that happening? That's what doesn't make sense.

OK, I see. It is actually one level deeper than I thought.

Quoted 8 lines

PARTITIONS is not enabled, for example on phycore_am62x_r5_usbdfu which means that blk_get_dev() returns NULL

So long as all the code is in one module, blk_get_dev() returning NULL causes the calls to vbe_simple_read_state() and simple_read_nvdata() to be dropped, so their code is dropped too, so there is no blk_read()/blk_dread() call. It is optimised away. It just happens to be the only call in U-Boot

Ah, that is all also true, thanks.

Quoted 32 lines
Quoted 23 lines
Quoted 16 lines
Quoted 10 lines
Quoted 6 lines

Further, this functional
change seems to introduce some other code being pulled in very unexpectedly, and that needs to be explained. For example, phycore_am62x_r5_usbdfu is another case and that has CONFIG_BLOCK_CACHE=y but CONFIG_SPL_BLOCK_CACHE=n, and yet the size growth is in full U-Boot.

This board currently uses blk_dread(), but not blk_read(), so the addition of a blk_read() call in non-SPL causes the BLK cache to be pulled in.

But, how? I mean, this sounds like some underlying bug that needs to be fixed. The platform sets CONFIG_BLK=y and CONFIG_BLOCK_CACHE=y and drivers/block/blk-uclass.c has:
ulong blk_dread(struct blk_desc *desc, lbaint_t start, lbaint_t blkcnt,
void *buffer)

Quoted 6 lines
{
        return blk_read(desc->bdev, start, blkcnt, buffer);
}

Or perhaps the answer / problem here is that I need to track down what's going wrong here instead of asking you to track this down.

Quoted 8 lines

So, digging in to this, what's going on is that the platforms I've noted here (and a few others) don't actually enable any block devices. That's why, today, with VBE on still, they discard all of the code still. Your rework means that while there's still no block devices, we're now including the code. What to do? Both of:
- These platforms *should* disable the assorted block device related library options they have enabled if / when possible (it might not be a neat and easy un-tangle).

Quoted 1 line

As above, the issue seems to be PARTITIONS

Yes, I think we both agree there's a number of useless functionality enabled on these handful of platforms. PARTITIONS explains how it gets optimized away and all of the useless block-related things like MMC core should also be dropped.

Quoted 7 lines
Quoted 5 lines

- VBE needs to handle the case where there's not a block device enabled and not fail the build. Part of this requires the Kconfig rework I linked to earlier (so that we can have BLK off) to be complete, but having the VBE code check for BLK being enabled either in Makefile or C code should be the same regardless.

I thought you NAK'd my patch to drop the 'depends on BLK' for bootstd?

I know I NAK'd
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
as that should be instead done with
https://patchwork.ozlabs.org/project/uboot/list/?series=440336 instead.

With that series then yes, you should be able to have BOOTSTD not depend on BLK. But in a practical sense I worry that your changes in this series will break with BLK=n. My point above is to please make sure it still works in that case.

Quoted 4 lines

From what I can tell EFI_LOADER doesn't do any block access unless PARTITIONS is enabled. I don't want that for VBE because the VBE data is not actually in a partition (although perhaps it could be in future).

In a practical sense EFI_LOADER depends on BLK and I've fixed the dependency with my series and talked with Ilias and Heinrich about it. Making EFI_LOADER buildable without BLK is a mechanical effort, but making it usefully functional still might require a bit more work and they'll cross that bridge when they come to it.

Quoted 2 lines

Anyway, from what I can tell, the code-size increase is explainable and perhaps we should just accept it.

Other than the double buffer one, yes, I suppose it's not unreasonable to ask me to fixup the oddball platforms with extraneous PARTITIONS and other block type things enabled. Still need to get back to the buffer one as 200 bytes isn't normal for re-organizing things such that the compiler can't decide to inline something.

Signature · 1 line
Tom
#9 lore raw

Re: [PATCH 01/15] vbe: Split out some VBE code into a common file

Hi Tom,

Quoted 7 lines · Tom Rini
Quoted 5 lines · Simon Glass

Hi Tom,

Quoted 2 lines · Tom Rini

On Tue, Jan 14, 2025 at 10:58:01AM -0600, Tom Rini wrote:

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines · Simon Glass
Quoted 7 lines

Hi Tom,

Quoted 4 lines · Tom Rini
Quoted 1 line · Simon Glass

Loading a FIT is useful for other VBE methods, such as ABrec,

so start

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

a new common file. Add functions for reading the version and

nvdata.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Also add a function to get the block device.

This is not a good commit message when you're also introducing functional changes (blk_dread -> blk_read).

Yes, I did not actually notice this size change at all, as

mentioned,

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

as I only built for a few boards (firefly rk3399/rk3288 and a few sandbox ones). The blk_dread() function is the old API for reading

You have much faster build machines available than I do, it would be good to run a world build before/after (it might take an hour on alexandra) before posting these big series.

OK. I used to do this, but with CI sometimes grabbing the machines it ends up with a huge load and sometimes runs out of memory. I suppose I can stop the runner before doing it and remember to restart it afterwards. Or perhaps Alex has enough memory per thread? (96GB).

Quoted 8 lines

Personally, I would make the script that does the world build for size test turn off the runner before starting and turn it back on when done otherwise build time will suffer greatly and you would have been better served doing it all on a slower class of machine.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

from a block. It didn't occur to me that blk_dread() would bypass

the

Quoted 9 lines
Quoted 9 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

cache.

Yes, how is that happening? That's what doesn't make sense.

OK, I see. It is actually one level deeper than I thought.

PARTITIONS is not enabled, for example on phycore_am62x_r5_usbdfu which means that blk_get_dev() returns NULL

Quoted 13 lines
Quoted 5 lines

So long as all the code is in one module, blk_get_dev() returning NULL causes the calls to vbe_simple_read_state() and simple_read_nvdata() to be dropped, so their code is dropped too, so there is no blk_read()/blk_dread() call. It is optimised away. It just happens to be the only call in U-Boot

Ah, that is all also true, thanks.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Further, this functional
change seems to introduce some other code being pulled in very unexpectedly, and that needs to be explained. For example, phycore_am62x_r5_usbdfu is another case and that has CONFIG_BLOCK_CACHE=y but CONFIG_SPL_BLOCK_CACHE=n, and yet the

size

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line

growth is in full U-Boot.

This board currently uses blk_dread(), but not blk_read(), so the addition of a blk_read() call in non-SPL causes the BLK cache to

be

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

pulled in.

But, how? I mean, this sounds like some underlying bug that needs

to be

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

fixed. The platform sets CONFIG_BLK=y and CONFIG_BLOCK_CACHE=y and drivers/block/blk-uclass.c has:
ulong blk_dread(struct blk_desc *desc, lbaint_t start, lbaint_t

blkcnt,

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

void *buffer)

{
        return blk_read(desc->bdev, start, blkcnt, buffer);
}

Or perhaps the answer / problem here is that I need to track down

what's

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

going wrong here instead of asking you to track this down.

So, digging in to this, what's going on is that the platforms I've

noted

Quoted 1 line
Quoted 1 line
Quoted 1 line

here (and a few others) don't actually enable any block devices.

That's

Quoted 1 line
Quoted 1 line
Quoted 1 line

why, today, with VBE on still, they discard all of the code still.

Your

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

rework means that while there's still no block devices, we're now including the code. What to do? Both of:
- These platforms *should* disable the assorted block device related library options they have enabled if / when possible (it might not

be

Quoted 10 lines
Quoted 3 lines
Quoted 1 line

a neat and easy un-tangle).

As above, the issue seems to be PARTITIONS

Yes, I think we both agree there's a number of useless functionality enabled on these handful of platforms. PARTITIONS explains how it gets optimized away and all of the useless block-related things like MMC core should also be dropped.

Quoted 1 line
Quoted 1 line

- VBE needs to handle the case where there's not a block device

enabled

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

and not fail the build. Part of this requires the Kconfig rework I linked to earlier (so that we can have BLK off) to be complete, but having the VBE code check for BLK being enabled either in Makefile

or

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

C code should be the same regardless.

I thought you NAK'd my patch to drop the 'depends on BLK' for bootstd?

I know I NAK'd

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

Quoted 19 lines

as that should be instead done with
https://patchwork.ozlabs.org/project/uboot/list/?series=440336 instead.

With that series then yes, you should be able to have BOOTSTD not depend on BLK. But in a practical sense I worry that your changes in this series will break with BLK=n. My point above is to please make sure it still works in that case.

Quoted 4 lines

From what I can tell EFI_LOADER doesn't do any block access unless PARTITIONS is enabled. I don't want that for VBE because the VBE data is not actually in a partition (although perhaps it could be in future).

In a practical sense EFI_LOADER depends on BLK and I've fixed the dependency with my series and talked with Ilias and Heinrich about it. Making EFI_LOADER buildable without BLK is a mechanical effort, but making it usefully functional still might require a bit more work and they'll cross that bridge when they come to it.

Quoted 8 lines
Quoted 2 lines

Anyway, from what I can tell, the code-size increase is explainable and perhaps we should just accept it.

Other than the double buffer one, yes, I suppose it's not unreasonable to ask me to fixup the oddball platforms with extraneous PARTITIONS and other block type things enabled. Still need to get back to the buffer one as 200 bytes isn't normal for re-organizing things such that the compiler can't decide to inline something.

What is the double buffer one?

I have a v2 of this series which splits the first patch up a bit more. But the end result is the same.

Regards,
Simon

#10 lore raw

Re: [PATCH 01/15] vbe: Split out some VBE code into a common file

Hi Tom,

Quoted 140 lines · Simon Glass

Hi Tom,

Quoted 127 lines · Tom Rini
Quoted 23 lines · Simon Glass

Hi Tom,

Quoted 20 lines · Tom Rini
Quoted 18 lines · Tom Rini
Quoted 16 lines · Simon Glass

Hi Tom,

Quoted 9 lines · Tom Rini
Quoted 3 lines · Simon Glass

Loading a FIT is useful for other VBE methods, such as ABrec, so start a new common file. Add functions for reading the version and nvdata. Also add a function to get the block device.

This is not a good commit message when you're also introducing functional changes (blk_dread -> blk_read).

Yes, I did not actually notice this size change at all, as mentioned, as I only built for a few boards (firefly rk3399/rk3288 and a few sandbox ones). The blk_dread() function is the old API for reading

Quoted 8 lines
Quoted 3 lines
Quoted 3 lines

You have much faster build machines available than I do, it would be good to run a world build before/after (it might take an hour on alexandra) before posting these big series.

OK. I used to do this, but with CI sometimes grabbing the machines it ends up with a huge load and sometimes runs out of memory. I suppose I can stop the runner before doing it and remember to restart it afterwards. Or perhaps Alex has enough memory per thread? (96GB).

Personally, I would make the script that does the world build for size test turn off the runner before starting and turn it back on when done otherwise build time will suffer greatly and you would have been better served doing it all on a slower class of machine.

Quoted 9 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

from a block. It didn't occur to me that blk_dread() would bypass the cache.

Yes, how is that happening? That's what doesn't make sense.

OK, I see. It is actually one level deeper than I thought.

Quoted 8 lines

PARTITIONS is not enabled, for example on phycore_am62x_r5_usbdfu which means that blk_get_dev() returns NULL

So long as all the code is in one module, blk_get_dev() returning NULL causes the calls to vbe_simple_read_state() and simple_read_nvdata() to be dropped, so their code is dropped too, so there is no blk_read()/blk_dread() call. It is optimised away. It just happens to be the only call in U-Boot

Ah, that is all also true, thanks.

Quoted 32 lines
Quoted 23 lines
Quoted 16 lines
Quoted 10 lines
Quoted 6 lines

Further, this functional
change seems to introduce some other code being pulled in very unexpectedly, and that needs to be explained. For example, phycore_am62x_r5_usbdfu is another case and that has CONFIG_BLOCK_CACHE=y but CONFIG_SPL_BLOCK_CACHE=n, and yet the size growth is in full U-Boot.

This board currently uses blk_dread(), but not blk_read(), so the addition of a blk_read() call in non-SPL causes the BLK cache to be pulled in.

But, how? I mean, this sounds like some underlying bug that needs to be fixed. The platform sets CONFIG_BLK=y and CONFIG_BLOCK_CACHE=y and drivers/block/blk-uclass.c has:
ulong blk_dread(struct blk_desc *desc, lbaint_t start, lbaint_t blkcnt,
void *buffer)

Quoted 6 lines
{
        return blk_read(desc->bdev, start, blkcnt, buffer);
}

Or perhaps the answer / problem here is that I need to track down what's going wrong here instead of asking you to track this down.

Quoted 8 lines

So, digging in to this, what's going on is that the platforms I've noted here (and a few others) don't actually enable any block devices. That's why, today, with VBE on still, they discard all of the code still. Your rework means that while there's still no block devices, we're now including the code. What to do? Both of:
- These platforms *should* disable the assorted block device related library options they have enabled if / when possible (it might not be a neat and easy un-tangle).

Quoted 1 line

As above, the issue seems to be PARTITIONS

Yes, I think we both agree there's a number of useless functionality enabled on these handful of platforms. PARTITIONS explains how it gets optimized away and all of the useless block-related things like MMC core should also be dropped.

Quoted 7 lines
Quoted 5 lines

- VBE needs to handle the case where there's not a block device enabled and not fail the build. Part of this requires the Kconfig rework I linked to earlier (so that we can have BLK off) to be complete, but having the VBE code check for BLK being enabled either in Makefile or C code should be the same regardless.

I thought you NAK'd my patch to drop the 'depends on BLK' for bootstd?

I know I NAK'd
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
as that should be instead done with
https://patchwork.ozlabs.org/project/uboot/list/?series=440336 instead.

With that series then yes, you should be able to have BOOTSTD not depend on BLK. But in a practical sense I worry that your changes in this series will break with BLK=n. My point above is to please make sure it still works in that case.

Quoted 4 lines

From what I can tell EFI_LOADER doesn't do any block access unless PARTITIONS is enabled. I don't want that for VBE because the VBE data is not actually in a partition (although perhaps it could be in future).

In a practical sense EFI_LOADER depends on BLK and I've fixed the dependency with my series and talked with Ilias and Heinrich about it. Making EFI_LOADER buildable without BLK is a mechanical effort, but making it usefully functional still might require a bit more work and they'll cross that bridge when they come to it.

Quoted 8 lines
Quoted 2 lines

Anyway, from what I can tell, the code-size increase is explainable and perhaps we should just accept it.

Other than the double buffer one, yes, I suppose it's not unreasonable to ask me to fixup the oddball platforms with extraneous PARTITIONS and other block type things enabled. Still need to get back to the buffer one as 200 bytes isn't normal for re-organizing things such that the compiler can't decide to inline something.

Quoted 3 lines

What is the double buffer one?

I have a v2 of this series which splits the first patch up a bit more. But the end result is the same.

I can send that if you like, but I just want to make sure I haven't missed anything from this thread.

Regards,
SImon

#11 lore raw

PATCH 2/15 vbe: Split out reading a FIT into a common file

In reply to Simon Glass

Loading a FIT is useful for other VBE methods, such as ABrec. Create a new function to handling reading it.

---

 boot/vbe_common.c    | 103 +++++++++++++++++++++++++++++++++++++++++++
 boot/vbe_common.h    |  28 ++++++++++++
 boot/vbe_simple_fw.c |  94 ++-------------------------------------
 3 files changed, 135 insertions(+), 90 deletions(-)
boot/vbe_common.c +103 -0
index 5f31cde0288..c009337ef3f 100644
@@ -18,6 +18,109 @@
 #include <u-boot/crc.h>
 #include "vbe_common.h"
 
+int vbe_read_fit(struct udevice *blk, ulong area_offset, ulong area_size,
+		 ulong *load_addrp, ulong *lenp, char **namep)
+{
+	ALLOC_CACHE_ALIGN_BUFFER(u8, sbuf, MMC_MAX_BLOCK_LEN);
+	ulong size, blknum, addr, len, load_addr, num_blks;
+	const char *fit_uname, *fit_uname_config;
+	struct bootm_headers images = {};
+	enum image_phase_t phase;
+	struct blk_desc *desc;
+	int node, ret;
+	void *buf;
+
+	desc = dev_get_uclass_plat(blk);
+
+	/* read in one block to find the FIT size */
+	blknum =  area_offset / desc->blksz;
+	log_debug("read at %lx, blknum %lx\n", area_offset, blknum);
+	ret = blk_read(blk, blknum, 1, sbuf);
+	if (ret < 0)
+		return log_msg_ret("rd", ret);
+
+	ret = fdt_check_header(sbuf);
+	if (ret < 0)
+		return log_msg_ret("fdt", -EINVAL);
+	size = fdt_totalsize(sbuf);
+	if (size > area_size)
+		return log_msg_ret("fdt", -E2BIG);
+	log_debug("FIT size %lx\n", size);
+
+	/*
+	 * Load the FIT into the SPL memory. This is typically a FIT with
+	 * external data, so this is quite small, perhaps a few KB.
+	 */
+	addr = CONFIG_VAL(TEXT_BASE);
+	buf = map_sysmem(addr, size);
+	num_blks = DIV_ROUND_UP(size, desc->blksz);
+	log_debug("read %lx, %lx blocks to %lx / %p\n", size, num_blks, addr,
+		  buf);
+	ret = blk_read(blk, blknum, num_blks, buf);
+	if (ret < 0)
+		return log_msg_ret("rd", ret);
+
+	/* figure out the phase to load */
+	phase = IS_ENABLED(CONFIG_VPL_BUILD) ? IH_PHASE_SPL : IH_PHASE_U_BOOT;
+
+	/*
+	 * Load the image from the FIT. We ignore any load-address information
+	 * so in practice this simply locates the image in the external-data
+	 * region and returns its address and size. Since we only loaded the FIT
+	 * itself, only a part of the image will be present, at best.
+	 */
+	fit_uname = NULL;
+	fit_uname_config = NULL;
+	log_debug("loading FIT\n");
+	ret = fit_image_load(&images, addr, &fit_uname, &fit_uname_config,
+			     IH_ARCH_SANDBOX, image_ph(phase, IH_TYPE_FIRMWARE),
+			     BOOTSTAGE_ID_FIT_SPL_START, FIT_LOAD_IGNORED,
+			     &load_addr, &len);
+	if (ret < 0)
+		return log_msg_ret("ld", ret);
+	node = ret;
+	log_debug("loaded to %lx\n", load_addr);
+
+	/* For FIT external data, read in the external data */
+	if (load_addr + len > addr + size) {
+		ulong base, full_size;
+		void *base_buf;
+
+		/* Find the start address to load from */
+		base = ALIGN_DOWN(load_addr, desc->blksz);
+
+		/*
+		 * Get the total number of bytes to load, taking care of
+		 * block alignment
+		 */
+		full_size = load_addr + len - base;
+
+		/*
+		 * Get the start block number, number of blocks and the address
+		 * to load to, then load the blocks
+		 */
+		blknum = (area_offset + base - addr) / desc->blksz;
+		num_blks = DIV_ROUND_UP(full_size, desc->blksz);
+		base_buf = map_sysmem(base, full_size);
+		ret = blk_read(blk, blknum, num_blks, base_buf);
+		log_debug("read %lx %lx, %lx blocks to %lx / %p: ret=%d\n",
+			  blknum, full_size, num_blks, base, base_buf, ret);
+		if (ret < 0)
+			return log_msg_ret("rd", ret);
+	}
+	if (load_addrp)
+		*load_addrp = load_addr;
+	if (lenp)
+		*lenp = len;
+	if (namep) {
+		*namep = strdup(fdt_get_name(buf, node, NULL));
+		if (!namep)
+			return log_msg_ret("nam", -ENOMEM);
+	}
+
+	return 0;
+}
+
 int vbe_read_version(struct udevice *blk, ulong offset, char *version,
 		     int max_size)
 {
boot/vbe_common.h +28 -0
index df133fbf05f..403391ff1ea 100644
@@ -140,4 +140,32 @@ int vbe_read_version(struct udevice *blk, ulong offset, char *version,
  */
 int vbe_get_blk(const char *storage, struct udevice **blkp);
 
+/**
+ * vbe_read_fit() - Read an image from a FIT
+ *
+ * This handles most of the VBE logic for reading from a FIT. It reads the FIT
+ * metadata, decides which image to load and loads it to a suitable address,
+ * ready for jumping to the next phase of VBE.
+ *
+ * This supports transition from VPL to SPL as well as SPL to U-Boot proper. For
+ * now, TPL->VPL is not supported.
+ *
+ * Both embedded and external data are supported for the FIT
+ *
+ * @blk: Block device containing FIT
+ * @area_offset: Byte offset of the VBE area in @blk containing the FIT
+ * @area_size: Size of the VBE area
+ * @load_addrp: If non-null, returns the address where the image was loaded
+ * @lenp: If non-null, returns the size of the image loaded, in bytes
+ * @namep: If non-null, returns the name of the FIT-image node that was loaded
+ *	(allocated by this function)
+ * Return: 0 if OK, -EINVAL if the area does not contain an FDT (the underlying
+ * format for FIT), -E2BIG if the FIT extends past @area_size, -ENOMEM if there
+ * was not space to allocate the image-node name, other error if a read error
+ * occurred (see blk_read()), or something went wrong with the actually
+ * FIT-parsing (see fit_image_load()).
+ */
+int vbe_read_fit(struct udevice *blk, ulong area_offset, ulong area_size,
+		 ulong *load_addrp, ulong *lenp, char **namep);
+
 #endif /* __VBE_ABREC_H */
boot/vbe_simple_fw.c +4 -90

113 lines not on this page · raw message

Signature · 1 line
2.34.1
#12 lore raw

Re: [PATCH 02/15] vbe: Split out reading a FIT into a common file

Quoted 4 lines · Simon Glass

Loading a FIT is useful for other VBE methods, such as ABrec. Create a new function to handling reading it.

This causes a bunch of growth:
a3y17lte : all +1328 text +1328
u-boot: add: 8/0, grow: 1/0 bytes: 1328/0 (1328)
function old new delta
blkcache_fill - 332 +332
blkcache_read - 240 +240
blk_read - 188 +188
vbe_read_nvdata - 156 +156
vbe_read_version - 140 +140
vbe_get_blk - 100 +100
simple_read_nvdata - 96 +96
crc8 - 72 +72
vbe_simple_read_state 108 112 +4

Which is unexpected for just moving code around that's not newly used. And even when it's just a move it's still growing:
xilinx_zynqmp_virt: all +128 bss -72 text +200
u-boot: add: 4/0, grow: 0/-1 bytes: 540/-340 (200)
function old new delta
vbe_read_nvdata - 156 +156
vbe_get_blk - 148 +148
vbe_read_version - 140 +140
simple_read_nvdata - 96 +96
vbe_simple_read_state 452 112 -340

Signature · 1 line
Tom
#13 lore raw

Re: [PATCH 02/15] vbe: Split out reading a FIT into a common file

Hi Tom,

Quoted 22 lines · Tom Rini
Quoted 4 lines · Simon Glass

Loading a FIT is useful for other VBE methods, such as ABrec. Create a new function to handling reading it.

This causes a bunch of growth:
a3y17lte : all +1328 text +1328
u-boot: add: 8/0, grow: 1/0 bytes: 1328/0 (1328)
function old new delta
blkcache_fill - 332 +332
blkcache_read - 240 +240
blk_read - 188 +188
vbe_read_nvdata - 156 +156
vbe_read_version - 140 +140
vbe_get_blk - 100 +100
simple_read_nvdata - 96 +96
crc8 - 72 +72
vbe_simple_read_state 108 112 +4

Quoted 1 line

Which is unexpected for just moving code around that's not newly used.

I hadn't noticed that on the boards I was trying, so thank you for spotting it.

This is because it now uses blk_read() instead of blk_dread(), so if BLOCK_CACHE is enabled, it will use the block cache. We could disable BLOCK_CACHE on those boards perhaps? It is a speed optimisation so shouldn't be used by boards which care about code size.

Quoted 9 lines

And even when it's just a move it's still growing:
xilinx_zynqmp_virt: all +128 bss -72 text +200
u-boot: add: 4/0, grow: 0/-1 bytes: 540/-340 (200)
function old new delta
vbe_read_nvdata - 156 +156
vbe_get_blk - 148 +148
vbe_read_version - 140 +140
simple_read_nvdata - 96 +96
vbe_simple_read_state 452 112 -340

Unfortunately this one is hard to fix. As you know, whenever you take code from a single module and put it into another, the compiler cannot optimise away the function-call overhead. I'll note that there is no increase when LTO is used, e.g. with xilinx_versal_net_mini_qspi

So let me know what you think.

Regards,
Simon

#14 lore raw

Re: [PATCH 02/15] vbe: Split out reading a FIT into a common file

Quoted 25 lines · Simon Glass

Hi Tom,

Quoted 22 lines · Tom Rini
Quoted 4 lines · Simon Glass

Loading a FIT is useful for other VBE methods, such as ABrec. Create a new function to handling reading it.

This causes a bunch of growth:
a3y17lte : all +1328 text +1328
u-boot: add: 8/0, grow: 1/0 bytes: 1328/0 (1328)
function old new delta
blkcache_fill - 332 +332
blkcache_read - 240 +240
blk_read - 188 +188
vbe_read_nvdata - 156 +156
vbe_read_version - 140 +140
vbe_get_blk - 100 +100
simple_read_nvdata - 96 +96
crc8 - 72 +72
vbe_simple_read_state 108 112 +4

Quoted 5 lines
Quoted 1 line

Which is unexpected for just moving code around that's not newly used.

I hadn't noticed that on the boards I was trying, so thank you for spotting it.

This is because it now uses blk_read() instead of blk_dread(), so if

That's not what this patch does? There's no caller before or after in this patch of "blk_dread". Just moving functions around should not increase size on platforms that weren't using the existing functionality. Why is vbe_simple_read_state changing at all here, when it's not being touched?

Quoted 14 lines

BLOCK_CACHE is enabled, it will use the block cache. We could disable BLOCK_CACHE on those boards perhaps? It is a speed optimisation so shouldn't be used by boards which care about code size.

Quoted 9 lines

And even when it's just a move it's still growing:
xilinx_zynqmp_virt: all +128 bss -72 text +200
u-boot: add: 4/0, grow: 0/-1 bytes: 540/-340 (200)
function old new delta
vbe_read_nvdata - 156 +156
vbe_get_blk - 148 +148
vbe_read_version - 140 +140
simple_read_nvdata - 96 +96
vbe_simple_read_state 452 112 -340

Quoted 6 lines

Unfortunately this one is hard to fix. As you know, whenever you take code from a single module and put it into another, the compiler cannot optimise away the function-call overhead. I'll note that there is no increase when LTO is used, e.g. with xilinx_versal_net_mini_qspi

So let me know what you think.

You likely need to re-think your refactor a bit then. If it's in part G or H that we have more than one caller of any of these functions, that's perhaps where it's time to refactor and expose them?

Signature · 1 line
Tom
#15 lore raw

Re: [PATCH 02/15] vbe: Split out reading a FIT into a common file

Hi Tom,

Quoted 29 lines · Tom Rini
Quoted 27 lines · Simon Glass

Hi Tom,

Quoted 23 lines · Tom Rini
Quoted 4 lines · Simon Glass

Loading a FIT is useful for other VBE methods, such as ABrec. Create a new function to handling reading it.

This causes a bunch of growth:
a3y17lte : all +1328 text +1328
u-boot: add: 8/0, grow: 1/0 bytes: 1328/0 (1328)
function old new delta
blkcache_fill - 332 +332
blkcache_read - 240 +240
blk_read - 188 +188
vbe_read_nvdata - 156 +156
vbe_read_version - 140 +140
vbe_get_blk - 100 +100
simple_read_nvdata - 96 +96
crc8 - 72 +72
vbe_simple_read_state 108 112 +4

Which is unexpected for just moving code around that's not newly used.

Quoted 8 lines
Quoted 3 lines

I hadn't noticed that on the boards I was trying, so thank you for spotting it.

This is because it now uses blk_read() instead of blk_dread(), so if

That's not what this patch does? There's no caller before or after in this patch of "blk_dread". Just moving functions around should not increase size on platforms that weren't using the existing functionality.

Firstly, are we looking at the same patch? Here is the one I am looking at:

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

It has blk_dread() in the old code and blk_read() in the new.

Quoted 2 lines

Why is vbe_simple_read_state changing at all here, when it's not being touched?

Again, I'm not sure we are looking at the same code. In my version, it does get changed, since it now calls vbe_get_blk() rather than finding the block device itself. This is to avoid duplicating that code in simple and abrec.

Quoted 20 lines
Quoted 20 lines

BLOCK_CACHE is enabled, it will use the block cache. We could disable BLOCK_CACHE on those boards perhaps? It is a speed optimisation so shouldn't be used by boards which care about code size.

Quoted 9 lines

And even when it's just a move it's still growing:
xilinx_zynqmp_virt: all +128 bss -72 text +200
u-boot: add: 4/0, grow: 0/-1 bytes: 540/-340 (200)
function old new delta
vbe_read_nvdata - 156 +156
vbe_get_blk - 148 +148
vbe_read_version - 140 +140
simple_read_nvdata - 96 +96
vbe_simple_read_state 452 112 -340

Unfortunately this one is hard to fix. As you know, whenever you take code from a single module and put it into another, the compiler cannot optimise away the function-call overhead. I'll note that there is no increase when LTO is used, e.g. with xilinx_versal_net_mini_qspi

Quoted 5 lines
Quoted 1 line

So let me know what you think.

You likely need to re-think your refactor a bit then. If it's in part G or H that we have more than one caller of any of these functions, that's perhaps where it's time to refactor and expose them?

Yes of course I can move things around. I would need to drop the FIT loader as well, so this series would become quite small. Shall I do that for the next version?

But just so that I understand...in the next series, when abrec is added, and I have these same patches, will you accept this size increase?

Regards,
Simon

#16 lore raw

Re: [PATCH 02/15] vbe: Split out reading a FIT into a common file

Quoted 36 lines · Simon Glass

Hi Tom,

Quoted 33 lines · Tom Rini
Quoted 30 lines · Simon Glass

Hi Tom,

Quoted 22 lines · Tom Rini
Quoted 4 lines · Simon Glass

Loading a FIT is useful for other VBE methods, such as ABrec. Create a new function to handling reading it.

This causes a bunch of growth:
a3y17lte : all +1328 text +1328
u-boot: add: 8/0, grow: 1/0 bytes: 1328/0 (1328)
function old new delta
blkcache_fill - 332 +332
blkcache_read - 240 +240
blk_read - 188 +188
vbe_read_nvdata - 156 +156
vbe_read_version - 140 +140
vbe_get_blk - 100 +100
simple_read_nvdata - 96 +96
crc8 - 72 +72
vbe_simple_read_state 108 112 +4

Quoted 1 line

Which is unexpected for just moving code around that's not newly used.

I hadn't noticed that on the boards I was trying, so thank you for spotting it.

This is because it now uses blk_read() instead of blk_dread(), so if

Quoted 8 lines
Quoted 4 lines

That's not what this patch does? There's no caller before or after in this patch of "blk_dread". Just moving functions around should not increase size on platforms that weren't using the existing functionality.

Firstly, are we looking at the same patch? Here is the one I am looking at:

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

You're right, I replied to the wrong patch here, sorry for the confusion. I'll move some of my comments in reply to the correct patch now.

[snip]

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines

And even when it's just a move it's still growing:
xilinx_zynqmp_virt: all +128 bss -72 text +200
u-boot: add: 4/0, grow: 0/-1 bytes: 540/-340 (200)
function old new delta
vbe_read_nvdata - 156 +156
vbe_get_blk - 148 +148
vbe_read_version - 140 +140
simple_read_nvdata - 96 +96
vbe_simple_read_state 452 112 -340

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Unfortunately this one is hard to fix. As you know, whenever you take code from a single module and put it into another, the compiler cannot optimise away the function-call overhead. I'll note that there is no increase when LTO is used, e.g. with xilinx_versal_net_mini_qspi

Yes, but 200 bytes isn't just function call overhead. Some of that might be from going from one ALLOC_CACHE_ALIGN_BUFFER(u8, buf, MMC_MAX_BLOCK_LEN) to two?

Quoted 6 lines
Quoted 5 lines
Quoted 1 line

So let me know what you think.

You likely need to re-think your refactor a bit then. If it's in part G or H that we have more than one caller of any of these functions, that's perhaps where it's time to refactor and expose them?

Quoted 7 lines

Yes of course I can move things around. I would need to drop the FIT loader as well, so this series would become quite small. Shall I do that for the next version?

But just so that I understand...in the next series, when abrec is added, and I have these same patches, will you accept this size increase?

It sounds like you're talking about re-ordering patches and I'm asking you to re-work your re-work of the code so that it doesn't grow things without explanation, and minimizes growth. Maybe that's code changes, maybe that's better commit messages, likely it's a combination of both.

Signature · 1 line
Tom
#17 lore raw

Re: [PATCH 02/15] vbe: Split out reading a FIT into a common file

Quoted 61 lines · Tom Rini
Quoted 36 lines · Simon Glass

Hi Tom,

Quoted 33 lines · Tom Rini
Quoted 30 lines · Simon Glass

Hi Tom,

Quoted 22 lines · Tom Rini
Quoted 4 lines · Simon Glass

Loading a FIT is useful for other VBE methods, such as ABrec. Create a new function to handling reading it.

This causes a bunch of growth:
a3y17lte : all +1328 text +1328
u-boot: add: 8/0, grow: 1/0 bytes: 1328/0 (1328)
function old new delta
blkcache_fill - 332 +332
blkcache_read - 240 +240
blk_read - 188 +188
vbe_read_nvdata - 156 +156
vbe_read_version - 140 +140
vbe_get_blk - 100 +100
simple_read_nvdata - 96 +96
crc8 - 72 +72
vbe_simple_read_state 108 112 +4

Quoted 1 line

Which is unexpected for just moving code around that's not newly used.

I hadn't noticed that on the boards I was trying, so thank you for spotting it.

This is because it now uses blk_read() instead of blk_dread(), so if

Quoted 8 lines
Quoted 4 lines

That's not what this patch does? There's no caller before or after in this patch of "blk_dread". Just moving functions around should not increase size on platforms that weren't using the existing functionality.

Firstly, are we looking at the same patch? Here is the one I am looking at:

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

You're right, I replied to the wrong patch here, sorry for the confusion. I'll move some of my comments in reply to the correct patch now.

[snip]

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines

And even when it's just a move it's still growing:
xilinx_zynqmp_virt: all +128 bss -72 text +200
u-boot: add: 4/0, grow: 0/-1 bytes: 540/-340 (200)
function old new delta
vbe_read_nvdata - 156 +156
vbe_get_blk - 148 +148
vbe_read_version - 140 +140
simple_read_nvdata - 96 +96
vbe_simple_read_state 452 112 -340

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Unfortunately this one is hard to fix. As you know, whenever you take code from a single module and put it into another, the compiler cannot optimise away the function-call overhead. I'll note that there is no increase when LTO is used, e.g. with xilinx_versal_net_mini_qspi

Yes, but 200 bytes isn't just function call overhead. Some of that might be from going from one ALLOC_CACHE_ALIGN_BUFFER(u8, buf, MMC_MAX_BLOCK_LEN) to two?

This is the double buffer I was referring to.

Signature · 1 line
Tom
#18 lore raw

Re: [PATCH 02/15] vbe: Split out reading a FIT into a common file

Hi Tom,

Quoted 68 lines · Tom Rini
Quoted 66 lines · Tom Rini
Quoted 36 lines · Simon Glass

Hi Tom,

Quoted 33 lines · Tom Rini
Quoted 30 lines · Simon Glass

Hi Tom,

Quoted 22 lines · Tom Rini
Quoted 4 lines · Simon Glass

Loading a FIT is useful for other VBE methods, such as ABrec. Create a new function to handling reading it.

This causes a bunch of growth:
a3y17lte : all +1328 text +1328
u-boot: add: 8/0, grow: 1/0 bytes: 1328/0 (1328)
function old new delta
blkcache_fill - 332 +332
blkcache_read - 240 +240
blk_read - 188 +188
vbe_read_nvdata - 156 +156
vbe_read_version - 140 +140
vbe_get_blk - 100 +100
simple_read_nvdata - 96 +96
crc8 - 72 +72
vbe_simple_read_state 108 112 +4

Quoted 1 line

Which is unexpected for just moving code around that's not newly used.

I hadn't noticed that on the boards I was trying, so thank you for spotting it.

This is because it now uses blk_read() instead of blk_dread(), so if

Quoted 8 lines
Quoted 4 lines

That's not what this patch does? There's no caller before or after in this patch of "blk_dread". Just moving functions around should not increase size on platforms that weren't using the existing functionality.

Firstly, are we looking at the same patch? Here is the one I am looking at:

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

You're right, I replied to the wrong patch here, sorry for the confusion. I'll move some of my comments in reply to the correct patch now.

[snip]

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 9 lines

And even when it's just a move it's still growing:
xilinx_zynqmp_virt: all +128 bss -72 text +200
u-boot: add: 4/0, grow: 0/-1 bytes: 540/-340 (200)
function old new delta
vbe_read_nvdata - 156 +156
vbe_get_blk - 148 +148
vbe_read_version - 140 +140
simple_read_nvdata - 96 +96
vbe_simple_read_state 452 112 -340

Unfortunately this one is hard to fix. As you know, whenever you take code from a single module and put it into another, the compiler cannot optimise away the function-call overhead. I'll note that there is no increase when LTO is used, e.g. with xilinx_versal_net_mini_qspi

Quoted 5 lines
Quoted 3 lines

Yes, but 200 bytes isn't just function call overhead. Some of that might be from going from one ALLOC_CACHE_ALIGN_BUFFER(u8, buf, MMC_MAX_BLOCK_LEN) to two?

This is the double buffer I was referring to.

OK, well that is just a declaration, so doesn't add any code, so far as I understand it.

I ran out of time this morning, but did find that the compiler cannot (of course) optimise the common range-checks when the code is in different files. So I fiddled with removing some of them and that gets the growth down, about 40 bytes on Thumb2 and 130 on aarch64, both without LTO.

I'll send a new series out later today.

Regards,
Simon

#19 lore raw

PATCH 3/15 vbe: Allocate space for the FIT header

In reply to Simon Glass

It is convenient to use TEXT_BASE as a place to hold the FIT header, but this does not work in VPL, since SDRAM is not inited yet.

Allocate the memory instead. Ensure the size is aligned to the media block-size so that it can be read in directly. Improve the error-checking for blk_read() and add some more debugging.

Keep the existing TEXT_BASE mechanism in sandbox to avoid an 'Exec format error' when trying to run the image.

---

 boot/vbe_common.c | 36 ++++++++++++++++++++++++++++--------
 1 file changed, 28 insertions(+), 8 deletions(-)
boot/vbe_common.c +28 -8
index c009337ef3f..d2d20cabe00 100644
@@ -27,6 +27,7 @@ int vbe_read_fit(struct udevice *blk, ulong area_offset, ulong area_size,
 	struct bootm_headers images = {};
 	enum image_phase_t phase;
 	struct blk_desc *desc;
+	ulong aligned_size;
 	int node, ret;
 	void *buf;
 
@@ -46,20 +47,37 @@ int vbe_read_fit(struct udevice *blk, ulong area_offset, ulong area_size,
 	if (size > area_size)
 		return log_msg_ret("fdt", -E2BIG);
 	log_debug("FIT size %lx\n", size);
+	aligned_size = ALIGN(size, desc->blksz);
 
 	/*
 	 * Load the FIT into the SPL memory. This is typically a FIT with
 	 * external data, so this is quite small, perhaps a few KB.
 	 */
-	addr = CONFIG_VAL(TEXT_BASE);
-	buf = map_sysmem(addr, size);
-	num_blks = DIV_ROUND_UP(size, desc->blksz);
-	log_debug("read %lx, %lx blocks to %lx / %p\n", size, num_blks, addr,
-		  buf);
+	if (IS_ENABLED(CONFIG_SANDBOX)) {
+		addr = CONFIG_VAL(TEXT_BASE);
+		buf = map_sysmem(addr, size);
+	} else {
+		buf = malloc(aligned_size);
+		if (!buf)
+			return log_msg_ret("fit", -ENOMEM);
+		addr = map_to_sysmem(buf);
+	}
+	num_blks = aligned_size / desc->blksz;
+	log_debug("read %lx, %lx blocks to %lx / %p\n", aligned_size, num_blks,
+		  addr, buf);
 	ret = blk_read(blk, blknum, num_blks, buf);
 	if (ret < 0)
-		return log_msg_ret("rd", ret);
-
+		return log_msg_ret("rd3", ret);
+	else if (ret != num_blks)
+		return log_msg_ret("rd4", -EIO);
+	log_debug("check total size %x off_dt_strings %x\n", fdt_totalsize(buf),
+		  fdt_off_dt_strings(buf));
+
+#if CONFIG_IS_ENABLED(SYS_MALLOC_F)
+	log_debug("malloc base %lx ptr %x limit %x top %lx\n",
+		  gd->malloc_base, gd->malloc_ptr, gd->malloc_limit,
+		  gd->malloc_base + gd->malloc_limit);
+#endif
 	/* figure out the phase to load */
 	phase = IS_ENABLED(CONFIG_VPL_BUILD) ? IH_PHASE_SPL : IH_PHASE_U_BOOT;
 
@@ -82,7 +100,9 @@ int vbe_read_fit(struct udevice *blk, ulong area_offset, ulong area_size,
 	log_debug("loaded to %lx\n", load_addr);
 
 	/* For FIT external data, read in the external data */
-	if (load_addr + len > addr + size) {
+	log_debug("load_addr %lx len %lx addr %lx aligned_size %lx\n",
+		  load_addr, len, addr, aligned_size);
+	if (load_addr + len > addr + aligned_size) {
 		ulong base, full_size;
 		void *base_buf;
 
Signature · 1 line
2.34.1
#20 lore raw

PATCH 4/15 vbe: Allow VBE to load FITs on any architecture

In reply to Simon Glass

At present the VBE implementation is limited to sandbox only. Adjust the call to fit_image_load() to remove this limitation.

---

 boot/vbe_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
boot/vbe_common.c +1 -1
index d2d20cabe00..dfe44822430 100644
@@ -91,7 +91,7 @@ int vbe_read_fit(struct udevice *blk, ulong area_offset, ulong area_size,
 	fit_uname_config = NULL;
 	log_debug("loading FIT\n");
 	ret = fit_image_load(&images, addr, &fit_uname, &fit_uname_config,
-			     IH_ARCH_SANDBOX, image_ph(phase, IH_TYPE_FIRMWARE),
+			     IH_ARCH_DEFAULT, image_ph(phase, IH_TYPE_FIRMWARE),
 			     BOOTSTAGE_ID_FIT_SPL_START, FIT_LOAD_IGNORED,
 			     &load_addr, &len);
 	if (ret < 0)
Signature · 1 line
2.34.1
#21 lore raw

PATCH 5/15 vbe: Tidy up error checking with blk_read()

In reply to Simon Glass

This function can read fewer blocks than requested, so update the checks to handle this.

---

 boot/vbe_common.c | 4 ++++
 1 file changed, 4 insertions(+)
boot/vbe_common.c +4 -0
index dfe44822430..c7f09c6d090 100644
@@ -39,6 +39,8 @@ int vbe_read_fit(struct udevice *blk, ulong area_offset, ulong area_size,
 	ret = blk_read(blk, blknum, 1, sbuf);
 	if (ret < 0)
 		return log_msg_ret("rd", ret);
+	else if (ret != 1)
+		return log_msg_ret("rd2", -EIO);
 
 	ret = fdt_check_header(sbuf);
 	if (ret < 0)
@@ -127,6 +129,8 @@ int vbe_read_fit(struct udevice *blk, ulong area_offset, ulong area_size,
 			  blknum, full_size, num_blks, base, base_buf, ret);
 		if (ret < 0)
 			return log_msg_ret("rd", ret);
+		if (ret != num_blks)
+			return log_msg_ret("rd", -EIO);
 	}
 	if (load_addrp)
 		*load_addrp = load_addr;
Signature · 1 line
2.34.1
#22 lore raw

PATCH 6/15 vbe: Handle loading from an unaligned offset

In reply to Simon Glass

There is no guarantee that an FIT image starts on a block boundary. When it doesn't, the image starts part-way through the first block.

Add logic to detect this and copy the image down into place.

---

 boot/vbe_common.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
boot/vbe_common.c +14 -5
index c7f09c6d090..02e2c4ae066 100644
@@ -105,32 +105,41 @@ int vbe_read_fit(struct udevice *blk, ulong area_offset, ulong area_size,
 	log_debug("load_addr %lx len %lx addr %lx aligned_size %lx\n",
 		  load_addr, len, addr, aligned_size);
 	if (load_addr + len > addr + aligned_size) {
-		ulong base, full_size;
+		ulong base, full_size, offset, extra;
 		void *base_buf;
 
 		/* Find the start address to load from */
 		base = ALIGN_DOWN(load_addr, desc->blksz);
 
+		offset = area_offset + load_addr - addr;
+		blknum = offset / desc->blksz;
+		extra = offset % desc->blksz;
+
 		/*
 		 * Get the total number of bytes to load, taking care of
 		 * block alignment
 		 */
-		full_size = load_addr + len - base;
+		full_size = len + extra;
 
 		/*
 		 * Get the start block number, number of blocks and the address
 		 * to load to, then load the blocks
 		 */
-		blknum = (area_offset + base - addr) / desc->blksz;
 		num_blks = DIV_ROUND_UP(full_size, desc->blksz);
 		base_buf = map_sysmem(base, full_size);
 		ret = blk_read(blk, blknum, num_blks, base_buf);
-		log_debug("read %lx %lx, %lx blocks to %lx / %p: ret=%d\n",
-			  blknum, full_size, num_blks, base, base_buf, ret);
+		log_debug("read foffset %lx blknum %lx full_size %lx num_blks %lx to %lx / %p: ret=%d\n",
+			  offset - 0x8000, blknum, full_size, num_blks, base, base_buf,
+			  ret);
 		if (ret < 0)
 			return log_msg_ret("rd", ret);
 		if (ret != num_blks)
 			return log_msg_ret("rd", -EIO);
+		if (extra && !IS_ENABLED(CONFIG_SANDBOX)) {
+			log_debug("move %p %p %lx\n", base_buf,
+				  base_buf + extra, len);
+			memmove(base_buf, base_buf + extra, len);
+		}
 	}
 	if (load_addrp)
 		*load_addrp = load_addr;
Signature · 1 line
2.34.1
#23 lore raw

PATCH 7/15 vbe: Allow loading loadables if there is no firmware

In reply to Simon Glass

In some cases only the 'loadable' property is present in the FIT. Handle this by loading the first such image.

---

 boot/vbe_common.c | 7 +++++++
 1 file changed, 7 insertions(+)
boot/vbe_common.c +7 -0
index 02e2c4ae066..4b297e780b3 100644
@@ -96,6 +96,13 @@ int vbe_read_fit(struct udevice *blk, ulong area_offset, ulong area_size,
 			     IH_ARCH_DEFAULT, image_ph(phase, IH_TYPE_FIRMWARE),
 			     BOOTSTAGE_ID_FIT_SPL_START, FIT_LOAD_IGNORED,
 			     &load_addr, &len);
+	if (ret == -ENOENT) {
+		ret = fit_image_load(&images, addr, &fit_uname,
+				     &fit_uname_config, IH_ARCH_DEFAULT,
+				     image_ph(phase, IH_TYPE_LOADABLE),
+				     BOOTSTAGE_ID_FIT_SPL_START,
+				     FIT_LOAD_IGNORED, &load_addr, &len);
+	}
 	if (ret < 0)
 		return log_msg_ret("ld", ret);
 	node = ret;
Signature · 1 line
2.34.1
#24 lore raw

PATCH 8/15 vbe: Support loading an FDT from the FIT

In reply to Simon Glass

In many cases the FIT includes a devicetree. Add support for loading this into a suitable place in memory.

---

 boot/vbe_common.c | 33 ++++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)
boot/vbe_common.c +30 -3
index 4b297e780b3..742e754b133 100644
@@ -23,11 +23,11 @@ int vbe_read_fit(struct udevice *blk, ulong area_offset, ulong area_size,
 {
 	ALLOC_CACHE_ALIGN_BUFFER(u8, sbuf, MMC_MAX_BLOCK_LEN);
 	ulong size, blknum, addr, len, load_addr, num_blks;
+	ulong aligned_size, fdt_load_addr, fdt_size;
 	const char *fit_uname, *fit_uname_config;
 	struct bootm_headers images = {};
 	enum image_phase_t phase;
 	struct blk_desc *desc;
-	ulong aligned_size;
 	int node, ret;
 	void *buf;
 
@@ -108,12 +108,16 @@ int vbe_read_fit(struct udevice *blk, ulong area_offset, ulong area_size,
 	node = ret;
 	log_debug("loaded to %lx\n", load_addr);
 
+	fdt_load_addr = 0;
+	fdt_size = 0;
+
 	/* For FIT external data, read in the external data */
 	log_debug("load_addr %lx len %lx addr %lx aligned_size %lx\n",
 		  load_addr, len, addr, aligned_size);
 	if (load_addr + len > addr + aligned_size) {
-		ulong base, full_size, offset, extra;
-		void *base_buf;
+		ulong base, full_size, offset, extra, fdt_base, fdt_full_size;
+		ulong fdt_offset;
+		void *base_buf, *fdt_base_buf;
 
 		/* Find the start address to load from */
 		base = ALIGN_DOWN(load_addr, desc->blksz);
@@ -147,6 +151,29 @@ int vbe_read_fit(struct udevice *blk, ulong area_offset, ulong area_size,
 				  base_buf + extra, len);
 			memmove(base_buf, base_buf + extra, len);
 		}
+
+		/* now the FDT */
+		if (fdt_size) {
+			fdt_offset = area_offset + fdt_load_addr - addr;
+			blknum = fdt_offset / desc->blksz;
+			extra = fdt_offset % desc->blksz;
+			fdt_full_size = fdt_size + extra;
+			num_blks = DIV_ROUND_UP(fdt_full_size, desc->blksz);
+			fdt_base = ALIGN(base + len, 4);
+			fdt_base_buf = map_sysmem(fdt_base, fdt_size);
+			ret = blk_read(blk, blknum, num_blks, fdt_base_buf);
+			log_debug("fdt read foffset %lx blknum %lx full_size %lx num_blks %lx to %lx / %p: ret=%d\n",
+				  fdt_offset - 0x8000, blknum, fdt_full_size, num_blks,
+				  fdt_base, fdt_base_buf, ret);
+			if (ret != num_blks)
+				return log_msg_ret("rdf", -EIO);
+			if (extra) {
+				log_debug("move %p %p %lx\n", fdt_base_buf,
+					  fdt_base_buf + extra, fdt_size);
+				memmove(fdt_base_buf, fdt_base_buf + extra,
+					fdt_size);
+			}
+		}
 	}
 	if (load_addrp)
 		*load_addrp = load_addr;
Signature · 1 line
2.34.1
#25 lore raw

PATCH 9/15 spl: Add fields for VBE

In reply to Simon Glass

Add some fields to track the VBE state in SPL.

---

 include/spl.h | 41 ++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 40 insertions(+), 1 deletion(-)
include/spl.h +40 -1
index 43b344dbc55..781e5a2d638 100644
@@ -14,6 +14,7 @@
 #include <asm/global_data.h>
 #include <asm/spl.h>
 #include <handoff.h>
+#include <image.h>
 #include <mmc.h>
 
 struct blk_desc;
@@ -265,6 +266,11 @@ enum spl_sandbox_flags {
 	SPL_SANDBOXF_ARG_IS_BUF,
 };
 
+/**
+ * struct spl_image_info - Information about the SPL image being loaded
+ *
+ * @fdt_size: Size of the FDT for the image (0 if none)
+ */
 struct spl_image_info {
 	const char *name;
 	u8 os;
@@ -276,6 +282,7 @@ struct spl_image_info {
 	u32 boot_device;
 	u32 offset;
 	u32 size;
+	ulong fdt_size;
 	u32 flags;
 	void *arg;
 #ifdef CONFIG_SPL_LEGACY_IMAGE_CRC_CHECK
@@ -316,12 +323,18 @@ typedef ulong (*spl_load_reader)(struct spl_load_info *load, ulong sector,
  * @read: Function to call to read from the device
  * @priv: Private data for the device
  * @bl_len: Block length for reading in bytes
+ * @phase: Image phase to load
+ * @fit_loaded: true if the FIT has been loaded, except for external data
  */
 struct spl_load_info {
 	spl_load_reader read;
 	void *priv;
 #if IS_ENABLED(CONFIG_SPL_LOAD_BLOCK)
-	int bl_len;
+	u16 bl_len;
+#endif
+#if CONFIG_IS_ENABLED(BOOTMETH_VBE)
+	u8 phase;
+	u8 fit_loaded;
 #endif
 };
 
@@ -344,6 +357,32 @@ static inline void spl_set_bl_len(struct spl_load_info *info, int bl_len)
 #endif
 }
 
+static inline void xpl_set_phase(struct spl_load_info *info,
+				 enum image_phase_t phase)
+{
+#if CONFIG_IS_ENABLED(BOOTMETH_VBE)
+	info->phase = phase;
+#endif
+}
+
+static inline enum image_phase_t xpl_get_phase(struct spl_load_info *info)
+{
+#if CONFIG_IS_ENABLED(BOOTMETH_VBE)
+	return info->phase;
+#else
+	return IH_PHASE_NONE;
+#endif
+}
+
+static inline bool xpl_get_fit_loaded(struct spl_load_info *info)
+{
+#if CONFIG_IS_ENABLED(BOOTMETH_VBE)
+	return info->fit_loaded;
+#else
+	return false;
+#endif
+}
+
 /**
  * spl_load_init() - Set up a new spl_load_info structure
  */
Signature · 1 line
2.34.1
#26 lore raw

PATCH 10/15 spl: Add a type for the jumper function

In reply to Simon Glass

This function will be used by the relocating jumper too, so add a typedef to the header file to avoid mismatches.

---

 common/spl/spl.c | 3 +--
 include/spl.h    | 3 +++
 2 files changed, 4 insertions(+), 2 deletions(-)
common/spl/spl.c +1 -2
index ad31a2f8b6c..09e6dc26f5e 100644
@@ -671,8 +671,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 		BOOT_DEVICE_NONE,
 		BOOT_DEVICE_NONE,
 	};
-	typedef void __noreturn (*jump_to_image_t)(struct spl_image_info *);
-	jump_to_image_t jump_to_image = &jump_to_image_no_args;
+	spl_jump_to_image_t jump_to_image = &jump_to_image_no_args;
 	struct spl_image_info spl_image;
 	int ret, os;
 
include/spl.h +3 -0
index 781e5a2d638..488adbeb1bc 100644
@@ -292,6 +292,9 @@ struct spl_image_info {
 #endif
 };
 
+/* function to jump to an image from SPL */
+typedef void __noreturn (*spl_jump_to_image_t)(struct spl_image_info *);
+
 static inline void *spl_image_fdt_addr(struct spl_image_info *info)
 {
 #if CONFIG_IS_ENABLED(LOAD_FIT) || CONFIG_IS_ENABLED(LOAD_FIT_FULL)
Signature · 1 line
2.34.1
#27 lore raw

PATCH 11/15 spl: Add support for a relocating jump to the next phase

In reply to Simon Glass

When one xPL phase wants to jump to the next, the next phase must be loaded into its required address. This means that the TEXT_BASE for the two phases must be different and there cannot be any memory overlap between the code used by the two phases. It also can mean that phases need to be moved around to accommodate any size growth.

Having two xPL phases in SRAM at the same time can be tricky if SRAM is limited, which it often is. It would be better if the second phase could be loaded somewhere else, then decompressed into place over the top of the first phase.

Introduce a relocating jump for xPL to support this. This selects a suitable place to load the (typically compressed) next phase, copies some decompression code out of the first phase, then jumps to this code to decompress and start the next phase.

This feature makes it much easier to support Verified Boot for Embedded (VBE) on RK3399 boards, which have 192KB of SRAM.

---

 common/spl/Kconfig     |   8 ++
 common/spl/Kconfig.tpl |   8 ++
 common/spl/Kconfig.vpl |   8 ++
 common/spl/Makefile    |   1 +
 common/spl/spl_reloc.c | 183 +++++++++++++++++++++++++++++++++++++++++
 include/spl.h          |  45 ++++++++++
 6 files changed, 253 insertions(+)
 create mode 100644 common/spl/spl_reloc.c
common/spl/Kconfig +8 -0
index 045fcac10a5..a250bde779f 100644
@@ -981,6 +981,14 @@ config SPL_NAND_IDENT
 	help
 	  SPL uses the chip ID list to identify the NAND flash.
 
+config SPL_RELOC_LOADER
+	bool "Allow relocating the next phase"
+	help
+	  In some cases multiple U-Boot phases need to run in SRAM, typically
+	  at the same address. Enable this to support loading the next phase
+	  to temporary memory, then copying it into place afterwards, then
+	  jumping to it.
+
 config SPL_UBI
 	bool "Support UBI"
 	help
common/spl/Kconfig.tpl +8 -0
index 92d4d43ec87..22ca7016453 100644
@@ -268,6 +268,14 @@ config TPL_RAM_DEVICE
 	  be already in memory when TPL takes over, e.g. loaded by the boot
 	  ROM.
 
+config TPL_RELOC_LOADER
+	bool "Allow relocating the next phase"
+	help
+	  In some cases multiple U-Boot phases need to run in SRAM, typically
+	  at the same address. Enable this to support loading the next phase
+	  to temporary memory, then copying it into place afterwards, then
+	  jumping to it.
+
 config TPL_RTC
 	bool "Support RTC drivers"
 	help
common/spl/Kconfig.vpl +8 -0
index eb57dfabea5..97dfc630152 100644
@@ -181,6 +181,14 @@ config VPL_PCI
 	  necessary driver support. This enables the drivers in drivers/pci
 	  as part of a VPL build.
 
+config VPL_RELOC_LOADER
+	bool "Allow relocating the next phase"
+	help
+	  In some cases multiple U-Boot phases need to run in SRAM, typically
+	  at the same address. Enable this to support loading the next phase
+	  to temporary memory, then copying it into place afterwards, then
+	  jumping to it.
+
 config VPL_RTC
 	bool "Support RTC drivers"
 	help
common/spl/Makefile +1 -0
index 75123eb666b..4c9482bd309 100644
@@ -12,6 +12,7 @@ obj-$(CONFIG_$(PHASE_)BOOTROM_SUPPORT) += spl_bootrom.o
 obj-$(CONFIG_$(PHASE_)LOAD_FIT) += spl_fit.o
 obj-$(CONFIG_$(PHASE_)BLK_FS) += spl_blk_fs.o
 obj-$(CONFIG_$(PHASE_)LEGACY_IMAGE_FORMAT) += spl_legacy.o
+obj-$(CONFIG_$(PHASE_)RELOC_LOADER) += spl_reloc.o
 obj-$(CONFIG_$(PHASE_)NOR_SUPPORT) += spl_nor.o
 obj-$(CONFIG_$(PHASE_)XIP_SUPPORT) += spl_xip.o
 obj-$(CONFIG_$(PHASE_)YMODEM_SUPPORT) += spl_ymodem.o
common/spl/spl_reloc.c new file +183 -0

183 lines not on this page · raw message

include/spl.h +45 -0

61 lines not on this page · raw message

Signature · 1 line
2.34.1
#28 lore raw

PATCH 12/15 spl: Plumb in the relocating loader

In reply to Simon Glass

This is fairly easy to use. The SPL loader sets up some fields in the spl_image_info struct and calls spl_reloc_prepare(). When SPL is ready to do the jump it must call spl_reloc_jump() instead of jump_to_image().

Add this logic.

---

 common/spl/spl.c | 12 ++++++++++++
 include/spl.h    |  1 +
 2 files changed, 13 insertions(+)
common/spl/spl.c +12 -0
index 09e6dc26f5e..7cfbab06419 100644
@@ -826,6 +826,18 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 	}
 
 	spl_board_prepare_for_boot();
+
+	if (CONFIG_IS_ENABLED(RELOC_LOADER)) {
+		int ret;
+
+		ret = spl_reloc_jump(&spl_image, jump_to_image);
+		if (ret) {
+			if (xpl_phase() == PHASE_VPL)
+				printf("jump failed %d\n", ret);
+			hang();
+		}
+	}
+
 	jump_to_image(&spl_image);
 }
 
include/spl.h +1 -0
index 9cfba98db55..7155e9c67aa 100644
@@ -414,6 +414,7 @@ static inline void spl_load_init(struct spl_load_info *load,
 	load->read = h_read;
 	load->priv = priv;
 	spl_set_bl_len(load, bl_len);
+	xpl_set_phase(load, IH_PHASE_NONE);
 }
 
 /*
Signature · 1 line
2.34.1
#29 lore raw

PATCH 13/15 vbe: Support loading an FDT with the relocating loader

In reply to Simon Glass

Add FDT support so that this can be copied down in memory after loading and made available to the new image.

---

 boot/vbe_common.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
boot/vbe_common.c +20 -0
index 742e754b133..46b39cf8910 100644
@@ -173,6 +173,26 @@ int vbe_read_fit(struct udevice *blk, ulong area_offset, ulong area_size,
 				memmove(fdt_base_buf, fdt_base_buf + extra,
 					fdt_size);
 			}
+#if CONFIG_IS_ENABLED(RELOC_LOADER)
+			image->fdt_buf = fdt_base_buf;
+
+			ulong xpl_size;
+			ulong xpl_pad;
+			ulong fdt_start;
+
+			if (xpl_phase() == PHASE_TPL) {
+				xpl_size = binman_sym(ulong, u_boot_vpl_nodtb, size);
+				xpl_pad = binman_sym(ulong, u_boot_vpl_bss_pad, size);
+			} else {
+				xpl_size = binman_sym(ulong, u_boot_spl_nodtb, size);
+				xpl_pad = binman_sym(ulong, u_boot_spl_bss_pad, size);
+			}
+			fdt_start = image->load_addr + xpl_size + xpl_pad;
+			log_debug("load_addr %lx xpl_size %lx copy-to %lx\n",
+				  image->load_addr, xpl_size + xpl_pad,
+				  fdt_start);
+			image->fdt_start = map_sysmem(fdt_start, fdt_size);
+#endif
 		}
 	}
 	if (load_addrp)
Signature · 1 line
2.34.1
#30 lore raw

PATCH 14/15 vbe: Support loading SPL images

In reply to Simon Glass

VBE needs to load different images from a FIT depending on the xPL phase in use. The IH_PHASE value is used to select the image to load.

Add the required logic to handle this. For compatibility with the SPL-loader driver, fill out a struct spl_image_info with the details needed to boot the next phase.

---

 boot/vbe_common.c    | 85 ++++++++++++++++++++++++++++++++++++++++++--
 boot/vbe_common.h    |  4 ++-
 boot/vbe_simple_fw.c |  3 +-
 3 files changed, 87 insertions(+), 5 deletions(-)
boot/vbe_common.c +82 -3
index 46b39cf8910..799f33d9ffa 100644
@@ -18,17 +18,48 @@
 #include <u-boot/crc.h>
 #include "vbe_common.h"
 
+binman_sym_declare(ulong, u_boot_vpl_nodtb, size);
+binman_sym_declare(ulong, u_boot_vpl_bss_pad, size);
+binman_sym_declare(ulong, u_boot_spl_nodtb, size);
+binman_sym_declare(ulong, u_boot_spl_bss_pad, size);
+
+/**
+ * h_vbe_load_read() - Handler for reading an SPL image from a FIT
+ *
+ * See spl_load_reader for the definition
+ */
+ulong h_vbe_load_read(struct spl_load_info *load, ulong off, ulong size,
+		      void *buf)
+{
+	struct blk_desc *desc = load->priv;
+	lbaint_t sector = off >> desc->log2blksz;
+	lbaint_t count = size >> desc->log2blksz;
+	int ret;
+
+	log_debug("vbe read log2blksz %x offset %lx sector %lx count %lx\n",
+		  desc->log2blksz, (ulong)off, (long)sector, (ulong)count);
+
+	ret = blk_dread(desc, sector, count, buf);
+	log_debug("ret=%x\n", ret);
+	if (ret < 0)
+		return ret;
+
+	return ret << desc->log2blksz;
+}
+
 int vbe_read_fit(struct udevice *blk, ulong area_offset, ulong area_size,
-		 ulong *load_addrp, ulong *lenp, char **namep)
+		 struct spl_image_info *image, ulong *load_addrp, ulong *lenp,
+		 char **namep)
 {
 	ALLOC_CACHE_ALIGN_BUFFER(u8, sbuf, MMC_MAX_BLOCK_LEN);
-	ulong size, blknum, addr, len, load_addr, num_blks;
+	ulong size, blknum, addr, len, load_addr, num_blks, spl_load_addr;
 	ulong aligned_size, fdt_load_addr, fdt_size;
 	const char *fit_uname, *fit_uname_config;
 	struct bootm_headers images = {};
 	enum image_phase_t phase;
 	struct blk_desc *desc;
 	int node, ret;
+	bool for_xpl;
 	void *buf;
 
 	desc = dev_get_uclass_plat(blk);
@@ -81,7 +112,8 @@ int vbe_read_fit(struct udevice *blk, ulong area_offset, ulong area_size,
 		  gd->malloc_base + gd->malloc_limit);
 #endif
 	/* figure out the phase to load */
-	phase = IS_ENABLED(CONFIG_VPL_BUILD) ? IH_PHASE_SPL : IH_PHASE_U_BOOT;
+	phase = IS_ENABLED(CONFIG_TPL_BUILD) ? IH_PHASE_NONE :
+		IS_ENABLED(CONFIG_VPL_BUILD) ? IH_PHASE_SPL : IH_PHASE_U_BOOT;
 
 	/*
 	 * Load the image from the FIT. We ignore any load-address information
@@ -92,6 +124,20 @@ int vbe_read_fit(struct udevice *blk, ulong area_offset, ulong area_size,
 	fit_uname = NULL;
 	fit_uname_config = NULL;
 	log_debug("loading FIT\n");
+
+	if (xpl_phase() == PHASE_SPL && !IS_ENABLED(CONFIG_SANDBOX)) {
+		struct spl_load_info info;
+
+		spl_load_init(&info, h_vbe_load_read, desc, desc->blksz);
+		xpl_set_phase(&info, IH_PHASE_U_BOOT);
+		log_debug("doing SPL from %s blksz %lx log2blksz %x area_offset %lx + fdt_size %lx\n",
+			  blk->name, desc->blksz, desc->log2blksz, area_offset, ALIGN(size, 4));
+		ret = spl_load_simple_fit(image, &info, area_offset, buf);
+		log_debug("spl_load_abrec_fit() ret=%d\n", ret);
+
+		return ret;
+	}
+
 	ret = fit_image_load(&images, addr, &fit_uname, &fit_uname_config,
 			     IH_ARCH_DEFAULT, image_ph(phase, IH_TYPE_FIRMWARE),
 			     BOOTSTAGE_ID_FIT_SPL_START, FIT_LOAD_IGNORED,
@@ -110,6 +156,31 @@ int vbe_read_fit(struct udevice *blk, ulong area_offset, ulong area_size,
 
 	fdt_load_addr = 0;
 	fdt_size = 0;
+	if ((xpl_phase() == PHASE_TPL || xpl_phase() == PHASE_VPL) &&
+	    !IS_ENABLED(CONFIG_SANDBOX)) {
+		/* allow use of a different image from the configuration node */
+		fit_uname = NULL;
+		ret = fit_image_load(&images, addr, &fit_uname,
+				     &fit_uname_config, IH_ARCH_DEFAULT,
+				     image_ph(phase, IH_TYPE_FLATDT),
+				     BOOTSTAGE_ID_FIT_SPL_START,
+				     FIT_LOAD_IGNORED, &fdt_load_addr,
+				     &fdt_size);
+		fdt_size = ALIGN(fdt_size, desc->blksz);
+		log_debug("FDT noload to %lx size %lx\n", fdt_load_addr,
+			  fdt_size);
+	}
+
+	for_xpl = !USE_BOOTMETH && CONFIG_IS_ENABLED(RELOC_LOADER);
+	if (for_xpl) {
+		image->size = len;
+		image->fdt_size = fdt_size;
+		ret = spl_reloc_prepare(image, &spl_load_addr);
+		if (ret)
+			return log_msg_ret("spl", ret);
+	}
+	if (!IS_ENABLED(CONFIG_SANDBOX))
+		image->os = IH_OS_U_BOOT;
 
 	/* For FIT external data, read in the external data */
 	log_debug("load_addr %lx len %lx addr %lx aligned_size %lx\n",
@@ -137,6 +208,8 @@ int vbe_read_fit(struct udevice *blk, ulong area_offset, ulong area_size,
 		 * to load to, then load the blocks
 		 */
 		num_blks = DIV_ROUND_UP(full_size, desc->blksz);
+		if (for_xpl)
+			base = spl_load_addr;
 		base_buf = map_sysmem(base, full_size);
 		ret = blk_read(blk, blknum, num_blks, base_buf);
 		log_debug("read foffset %lx blknum %lx full_size %lx num_blks %lx to %lx / %p: ret=%d\n",
@@ -152,6 +225,12 @@ int vbe_read_fit(struct udevice *blk, ulong area_offset, ulong area_size,
 			memmove(base_buf, base_buf + extra, len);
 		}
 
+		if ((xpl_phase() == PHASE_VPL || xpl_phase() == PHASE_TPL) &&
+		    !IS_ENABLED(CONFIG_SANDBOX)) {
+			image->load_addr = spl_get_image_text_base();
+			image->entry_point = image->load_addr;
+		}
+
 		/* now the FDT */
 		if (fdt_size) {
 			fdt_offset = area_offset + fdt_load_addr - addr;
boot/vbe_common.h +3 -1
index 403391ff1ea..98b7aff0b5d 100644
@@ -155,6 +155,7 @@ int vbe_get_blk(const char *storage, struct udevice **blkp);
  * @blk: Block device containing FIT
  * @area_offset: Byte offset of the VBE area in @blk containing the FIT
  * @area_size: Size of the VBE area
+ * @image: SPL image to fill in with details of the loaded image, or NULL
  * @load_addrp: If non-null, returns the address where the image was loaded
  * @lenp: If non-null, returns the size of the image loaded, in bytes
  * @namep: If non-null, returns the name of the FIT-image node that was loaded
@@ -166,6 +167,7 @@ int vbe_get_blk(const char *storage, struct udevice **blkp);
  * FIT-parsing (see fit_image_load()).
  */
 int vbe_read_fit(struct udevice *blk, ulong area_offset, ulong area_size,
-		 ulong *load_addrp, ulong *lenp, char **namep);
+		 struct spl_image_info *image, ulong *load_addrp, ulong *lenp,
+		 char **namep);
 
 #endif /* __VBE_ABREC_H */
boot/vbe_simple_fw.c +2 -1
index 0bf25ccad23..9da3e49a66e 100644
@@ -52,7 +52,8 @@ int vbe_simple_read_bootflow_fw(struct udevice *dev, struct bootflow *bflow)
 	log_debug("blk=%s\n", blk->name);
 
 	ret = vbe_read_fit(blk, priv->area_start + priv->skip_offset,
-			   priv->area_size, &load_addr, &len, &bflow->name);
+			   priv->area_size, NULL, &load_addr, &len,
+			   &bflow->name);
 
 	/* set up the bootflow with the info we obtained */
 	bflow->blk = blk;
Signature · 1 line
2.34.1
#31 lore raw

PATCH 15/15 vbe: Update simple-fw to support using the SPL loader

In reply to Simon Glass

For a sandbox implementation, where code size is no object, it makes sense to use the full bootstd drivers to load images.

For real boards, running from SRAM, this adds quite a bit of overhead.

Add a way to load the next phase using just the underlying storage driver, to reduce code size. For now, only MMC is supported.

Change the log_debug() to show the load address and size in a more neutral way, rather than suggesting that the load has already happened.

---

 boot/vbe_common.c    |   2 +-
 boot/vbe_simple_fw.c | 112 +++++++++++++++++++++++++++++--------------
 2 files changed, 77 insertions(+), 37 deletions(-)
boot/vbe_common.c +1 -1
index 799f33d9ffa..549a3f955d1 100644
@@ -152,7 +152,7 @@ int vbe_read_fit(struct udevice *blk, ulong area_offset, ulong area_size,
 	if (ret < 0)
 		return log_msg_ret("ld", ret);
 	node = ret;
-	log_debug("loaded to %lx\n", load_addr);
+	log_debug("load %lx size %lx\n", load_addr, len);
 
 	fdt_load_addr = 0;
 	fdt_size = 0;
boot/vbe_simple_fw.c +76 -36

153 lines not on this page · raw message

Signature · 1 line
2.34.1