public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH v2 00/10] Add SPL support for Qualcomm platforms, starting with sdm845
@ 2026-04-11  0:00 michael.srba
  2026-04-11  0:00 ` [PATCH v2 01/10] Makefile: add SPL_REMAKE_ELF_LDSCRIPT feature michael.srba
                   ` (9 more replies)
  0 siblings, 10 replies; 29+ messages in thread
From: michael.srba @ 2026-04-11  0:00 UTC (permalink / raw)
  To: u-boot, Sumit Garg, u-boot-qcom
  Cc: Tom Rini, Ilias Apalodimas, Simon Glass, Sughosh Ganu,
	Anshul Dalal, Peng Fan, Mattijs Korpershoek, Quentin Schulz,
	Heinrich Schuchardt, Andrew Davis, Hrushikesh Salunke,
	Dario Binacchi, Ye Li, Andre Przywara, Alif Zakuan Yuslaimi,
	Leo Yu-Chi Liang, Andrew Goodbody, Dhruva Gole,
	Kaustabh Chakraborty, Jerome Forissier, Heiko Schocher,
	Marek Vasut, Lukasz Majewski, Mateusz Kulikowski, Dinesh Maniyam,
	Neil Armstrong, Patrice Chotard, Patrick Delaunay, Michal Simek,
	Yao Zi, Peter Korsgaard, Rayagonda Kokatanur, Casey Connolly,
	Tingting Meng, Tien Fong Chee, Alice Guo, George Chan,
	Balaji Selvanathan, Alexey Charkov, Ronald Wahl, Michael Srba

[ context ]

Different generations of Qualcomm SoCs have differences in the boot
process. msm8916 (and similar) are quite straightforward:
[EL3]bootrom->sbl1->tz->[EL2]hyp->[EL1]aboot->linux (omitting non-AP
cores). msm8998, sdm845, kodiak and simiar are a bit more involved:
[EL3]bootrom->xbl_sec->[EL1]xbl_loader->[EL3]tz->[EL2]hyp->[EL1]uefi
->ABL->linux. Newer platforms like hamoa are even more involved.

Currently, u-boot proper can run in place of Linux, in place
of aboot, or in place of hyp. The option to run in place
of Linux is necessary because >99% of OEMs do not consider
the sale of a device to an end user a transfer of ownership,
that is, they sell the device with a hash of their public key
pre-burnt in the fuses.

[ end of context ]

U-Boot SPL, as it will be built using the defconfig added in this series,
replaces xbl_loader. If support for msm8916 or a similar platform
is added, it would replace sbl1. This will obviously only work on
the <1% of devices whose manufacturers consider the sale a transfer
of ownership, and of course most SBCs.

Unfortunately, starting with (iirc) msm8998, and getting progressively
worse, Qualcomm no longer consider a sale of their SoC a transfer
of ownership either. While it's possible to execute your code
in EL3 using either jtag or a patched devcfg, the former is impractical
while the latter is irrelevant for the purposes of running u-boot SPL
since the devcfg is parsed by trustzone. (this of course only applies
to the <1% of the devices where the OEM didn't lock the device down
prior to sale)

Given the above, this series uses an unintended feature in old builds
of xbl_sec which allows us to elevate to EL3. We also check if we
happen to already be running in EL3, in which case we proceed normally.
This can be the case e.g if JTAG was used to jump to u-boot SPL in EL3,
which may be the only option on e.g. kodiak. (Running in EL1 is not
really viable, because xbl_sec+xbl_loader are effectively sbl1 split
in half and replacing only one doesn't make much sense)

For now, only usb dfu is supported to load the next stage. Since we
don't support ram initialization, the next stage will need to run from
SRAM too, which is currently not supported. Additional patches will
be needed to make that work, at which point it will be possible
to use u-boot as a ufs/emmc programmer with zero proprietary code
in the boot chain (sans bootrom and part of xbl_sec, but the latter and
technically even the former could be skipped with JTAG)

Signed-off-by: Michael Srba <Michael.Srba@seznam.cz>
---
Changes in v2:
- fix spmi and of_live patches (missing help text, remove --, wording
  issues, drivers/spmi/Makefile), add bootstage_start()/bootstage_accum()
- fix conflict with upstream-added cmd_u-boot-spl-elf (and copy endianness
  handling), improve help text for SPL_REMAKE_ELF_LDSCRIPT
- split "mach-snapdragon: support building SPL" into smaller patches
- fix three SYS_MALLOC_LEN definitions; remove the conditional one, it was
  a leftover from related-but-separate effort to make u-boot proper work
  without dram
- s/#if CONFIG_SPL_TARGET_SDM845/#if defined(CONFIG_SPL_TARGET_SDM845)/
- fix "&rpmhcc: clock-controller" (probably accidental ctrl+z)
- change el3_ret_point to (el3_ret_point - _start); I'd swear when I was
  writing this I had to do it that way because for some bizzare reason
  el3_ret_point was relative and _start was absolute, but now I tested
  it again and they're both relative to the start of .text. (making _start
  0, but it's still cleaner this way)
- fix empty comment in el3_payload
- fix documentation style errors
- change KConfig as options as suggested (hardcode computed values, remove
  macro variables, move QCOM_SPL options under ARCH_SNAPDRAGON with
  SPL_BUILD conditionals; IMEM_START/END were dropped since they were
  a leftover from related-but-separate effort to make u-boot proper work
  without dram
- don't mess with SYS_SOC, it's clearly a bad idea; make the board .dtsi
  include sdm845-u-boot.dtsi
- split board.c and don't compile spl parts into u-boot proper and
  vice versa
- properly test clean build
- Link to v1: https://patch.msgid.link/20260404-qcom_spl-v1-0-9e6c2ac66587@seznam.cz

---
Michael Srba (10):
      Makefile: add SPL_REMAKE_ELF_LDSCRIPT feature
      of_live: support in SPL
      drivers: allow clk_stub and spmi in SPL
      mach-snapdragon: boot0.h: split out msm8916_boot0.h
      mach-snapdragon: add u-boot-spl-elf-sdm845.lds
      mach-snapdragon: Kconfig: changes / additions to support SPL
      mach-snapdragon: boot0.h: add sdm845_spl_boot0.h
      mach-snapdragon: add board-spl.c and split out common code
      qualcomm: add defconfig, env and docs for SPL on sdm845
      dts: add u-boot specific sdm845 .dtsi a .dtsi for shift-axolotl

 Makefile                                           |  28 ++
 arch/arm/Kconfig                                   |  31 +-
 arch/arm/dts/sdm845-shift-axolotl-u-boot.dtsi      |   2 +
 arch/arm/dts/sdm845-u-boot.dtsi                    |  16 +
 arch/arm/mach-snapdragon/Kconfig                   |  44 ++-
 arch/arm/mach-snapdragon/Makefile                  |   8 +
 arch/arm/mach-snapdragon/board.c                   | 358 +--------------------
 arch/arm/mach-snapdragon/board_common.c            |  56 ++++
 arch/arm/mach-snapdragon/board_spl.c               |  35 ++
 arch/arm/mach-snapdragon/include/mach/boot0.h      |  61 +---
 .../mach-snapdragon/include/mach/msm8916_boot0.h   |  54 ++++
 .../include/mach/sdm845_spl_boot0.h                | 120 +++++++
 arch/arm/mach-snapdragon/mem_map.c                 | 318 ++++++++++++++++++
 arch/arm/mach-snapdragon/qcom-priv.h               |   4 +-
 arch/arm/mach-snapdragon/u-boot-spl-elf-sdm845.lds |  25 ++
 board/qualcomm/sdm845_spl.env                      |   2 +
 common/spl/Kconfig                                 |   9 +
 common/spl/spl.c                                   |  11 +
 configs/sdm845_spl_defconfig                       | 131 ++++++++
 doc/board/qualcomm/index.rst                       |   1 +
 doc/board/qualcomm/spl.rst                         |  87 +++++
 drivers/Makefile                                   |   2 +-
 drivers/clk/Kconfig                                |   6 +
 drivers/spmi/Kconfig                               |   6 +
 drivers/spmi/Makefile                              |   2 +-
 dts/Kconfig                                        |   6 +
 lib/Makefile                                       |   2 +-
 27 files changed, 1013 insertions(+), 412 deletions(-)
---
base-commit: 93f84ee022a8401421cdaab84fe7d106d83fdb4a
change-id: 20260403-qcom_spl-0826843ba41c

Best regards,
--  
Michael Srba <Michael.Srba@seznam.cz>


^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2026-04-20 20:34 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-11  0:00 [PATCH v2 00/10] Add SPL support for Qualcomm platforms, starting with sdm845 michael.srba
2026-04-11  0:00 ` [PATCH v2 01/10] Makefile: add SPL_REMAKE_ELF_LDSCRIPT feature michael.srba
2026-04-11 15:39   ` Simon Glass
2026-04-13 17:12   ` Tom Rini
2026-04-11  0:00 ` [PATCH v2 02/10] of_live: support in SPL michael.srba
2026-04-11 15:39   ` Simon Glass
2026-04-11  0:00 ` [PATCH v2 03/10] drivers: allow clk_stub and spmi " michael.srba
2026-04-11 15:39   ` Simon Glass
2026-04-13 17:13   ` Tom Rini
2026-04-11  0:00 ` [PATCH v2 04/10] mach-snapdragon: boot0.h: split out msm8916_boot0.h michael.srba
2026-04-11 15:39   ` Simon Glass
2026-04-11  0:00 ` [PATCH v2 05/10] mach-snapdragon: add u-boot-spl-elf-sdm845.lds michael.srba
2026-04-11 15:40   ` Simon Glass
2026-04-11  0:00 ` [PATCH v2 06/10] mach-snapdragon: Kconfig: changes / additions to support SPL michael.srba
2026-04-11 15:40   ` Simon Glass
2026-04-13 17:17   ` Tom Rini
2026-04-18  1:01     ` Michael Srba
2026-04-20 18:05       ` Tom Rini
2026-04-11  0:00 ` [PATCH v2 07/10] mach-snapdragon: boot0.h: add sdm845_spl_boot0.h michael.srba
2026-04-11 15:40   ` Simon Glass
2026-04-16 19:15     ` Michael Srba
2026-04-16 21:09       ` Simon Glass
2026-04-11  0:00 ` [PATCH v2 08/10] mach-snapdragon: add board-spl.c and split out common code michael.srba
2026-04-11 20:30   ` Simon Glass
2026-04-11  0:00 ` [PATCH v2 09/10] qualcomm: add defconfig, env and docs for SPL on sdm845 michael.srba
2026-04-11 20:30   ` Simon Glass
2026-04-13 17:21   ` Tom Rini
2026-04-11  0:00 ` [PATCH v2 10/10] dts: add u-boot specific sdm845 .dtsi a .dtsi for shift-axolotl michael.srba
2026-04-11 15:40   ` Simon Glass

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox