qemu-arm64: Allow booting via Trusted Firmware
Get series with b4
b4 am 20200930173958.GG14816@bill-the-catVersions newest first · linked by author and title
- v2 Latest6 patches 0 repliesNew
- v12 of 5 patches 0 repliesSuperseded
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/6 | arm64: PIE: Do not skip static relocation | +0 | 0 replies | |
| 2/6 | arm64: PIE: Skip fixups if distance is zero | +0 | 0 replies | |
| 3/6 | arm64: PIE: Allow fixed stack pointer | +0 | 0 replies | |
| 4/6 | qemu-arm: Remove need to specify flash banks | +0 | 0 replies | |
| 5/6 | qemu-arm: Drop ARCH_SUPPORT_TFABOOT | +0 | 0 replies | |
| 5/6 | qemu-arm: Drop ARCH_SUPPORT_TFABOOT | +0 | 0 replies | |
| 6/6 | qemu-arm64: Enable POSITION_INDEPENDENT | +0 | 0 replies |
Reviews trailers per patch
2 of 7 patches have a Reviewed-by or Acked-by.
| Patch | Tom Rini |
|---|---|
| 1/6 | |
| 2/6 | |
| 3/6 | |
| 4/6 | |
| 5/6 | R-b |
| 5/6 | R-b |
| 6/6 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v2 0/6] qemu-arm64: Allow booting via Trusted Firmware
Quoted 27 lines · Andre Przywara
U-Boot on QEMU-arm64 can be used in two configurations: Loaded directly via QEMU's -bios option, or as a non-secure payload (BL33) via ARM Trusted Firmware-A (TF-A).
In the latter case we need to defineCONFIG_TFABOOT, to accommodate the first flash bank being secure only, and manually setSYS_TEXT_BASEto the address configured in TF-A (currently0x60000000).To avoid this poorly documented adventure, we enable a position independent build, and also let the flash regions be always detected through the DTB. This results in a single build to work under both scenarios, and also allows to move the BL33 load address in TF-A to something lower in the future.
For this to work, we have to first make PIE work when booted from ROM. While writing to ROM should not hurt, it might trigger CFI flash sequences, and indeed crashes for me in the middle of the fixup routine. This is covered by patch 2/6, which skips the whole fixup routine if the offset is actually 0 (as it is in our case). To support older toolchains (including the popular Linaro builds), we need to ensure we do the static RELA fixups, even with PIE enabled (patch 1/6).
Also we have to decouple the relative initial stack pointer from the PIE option, as we always need to use the fixed version, pointing to RAM (patch 3/6).
Patch 4/6 drops the hard-coded flash address, instead U-Boot can already read all required information from QEMU's DTB.
Patch 5/6 is a cleanup, while the last patch enables the PIE build.
Quoted 5 lines
With this series the very same u-boot.bin file works when directly loaded from the QEMU command line (-bios), but also when embedded into TF-A's fip.bin, removing the need for case-specific build options.
Please have a look!
Can you please also update doc/board/emulation/qemu-arm.rst with instructions / example of using this configuration? Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200930/ac3f1c5b/attachment.sig>