U-Boot proper already accepts a bloblist passed in registers with the
register conventions of the Firmware Handoff spec, but SPL has no way to
pass its own bloblist on like this. The only option today is
BLOBLIST_FIXED, which needs every phase to agree on a fixed address.

This series adds config SPL_BLOBLIST_PASS_REGS. With it, SPL works out
the register values once, right after it finishes the bloblist, and the
default jump_to_image() passes them to the next phase. When SPL starts
BL31 (SPL_ATF), the bloblist is passed to BL33 the same way, through the
BL33 entry point arguments.

The register values come from a new hook, xferlist_to_boot_arg(), the
counterpart of xferlist_from_boot_arg(). It has a weak default in
common/bloblist.c and the ARM version in arch/arm/lib/xferlist.c, so
other architectures can add theirs later.

This replaces "spl: atf: optionally pass the bloblist to BL33" [1], which
only handled the SPL_ATF case. The Genio 520 and 720 SPL series will use
it.

Testing:
- sandbox: new "ut bloblist reg_conv" test.
- QEMU arm64, SPL -> U-Boot proper: on top of "board: qemu-arm: Add SPL
  support" [2] (which also needs scripts/Makefile.xpl to skip the SPL
  devicetree when OF_OMIT_DTB is set), U-Boot proper finds a record that
  SPL added to the bloblist.
- SPL -> BL31 -> U-Boot proper: Genio 720 EVK.
- 32-bit ARM: build only (Cubietruck with the option enabled), checked
  the register order in the disassembly.

[1]: 
https://lore.kernel.org/u-boot/[email protected]/
[2]: 
https://lore.kernel.org/u-boot/[email protected]/

Signed-off-by: David Lechner <[email protected]>
---
Changes in v2:
- Work out the register values once in board_init_r(), right after
  bloblist_finish(), and keep them in struct spl_image_info.
- spl: atf: set the BL33 arguments after bl2_plat_get_bl31_params*()
  returns instead of in the default implementations, so that boards which
  override these functions also pass the bloblist to BL33.
- Link to v1: 
https://patch.msgid.link/[email protected]

---
David Lechner (4):
      bloblist: add bloblist_get_reg_conv()
      arm: add xferlist_to_boot_arg()
      spl: optionally pass the bloblist to the next phase in registers
      spl: atf: pass the bloblist to BL33 in registers

 arch/arm/lib/xferlist.c | 23 +++++++++++++++++++++++
 common/Kconfig          | 17 +++++++++++++++++
 common/bloblist.c       | 44 +++++++++++++++++++++++++++++++++-----------
 common/spl/spl.c        | 21 ++++++++++++++++++++-
 common/spl/spl_atf.c    | 48 +++++++++++++++++++++++++++++++++++++++++++-----
 include/bloblist.h      | 27 +++++++++++++++++++++++++++
 include/spl.h           |  3 +++
 test/common/bloblist.c  | 24 ++++++++++++++++++++++++
 8 files changed, 190 insertions(+), 17 deletions(-)
---
base-commit: ab4dc5aacf957835c295b59ef2dd28281839cb20
base-tree: https://git.u-boot-project.org/u-boot/u-boot.git main
change-id: 20261103-spl-bloblist-pass-regs-3130cf768211

Best regards,
--  
David Lechner <[email protected]>

Reply via email to