public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH v4 00/17] bootm: Clean up arch-specific, pre-OS clean-up
@ 2026-03-06  2:36 Simon Glass
  2026-03-06  2:36 ` [PATCH v4 01/17] dm: Move flags_remove() check before child removal Simon Glass
                   ` (17 more replies)
  0 siblings, 18 replies; 24+ messages in thread
From: Simon Glass @ 2026-03-06  2:36 UTC (permalink / raw)
  To: u-boot
  Cc: Tom Rini, Simon Glass, Albert Aribaud, Alexey Brodkin,
	Alison Wang, Andy Fleming, Angelo Dureghello, Angelo Dureghello,
	Aristo Chen, Benjamin ROBIN, Bin Meng, Daniel Schwierzeck,
	Eugeniy Paltsev, Guillaume Ranquet, Ilias Apalodimas,
	Kuan-Wei Chiu, Leo, Marek Vasut, Marek Vasut, Mario Six,
	Mattijs Korpershoek, Michal Simek, Michal Simek,
	Nobuhiro Iwamatsu, Patrice Chotard, Pavel Herrmann, Peng Fan,
	Priyanka Jain, Quentin Schulz, Rick Chen, Scott McNutt,
	Stefan Roese, Sughosh Ganu, Thomas Chou, Vishnu Singh,
	Wolfgang Denk, Wolfgang Wallner, Yao Zi, uboot-snps-arc

Each arch does something slightly different before booting the OS. Some
archs even do different things depending on the CPU type.

It is quite hard to know what actually happens in the final milliseconds
before the OS boot.

This series attempts to start cleaning up U-Boot in this area.

The basic intent is to create a new bootm_final() function which can be
called by all archs. It provides some flags for a couple of necessary
variations but otherwise it is generic.

All architectures are converted over to use this new function.

board_quiesce_devices() is moved into bootm_final() so that all archs
benefit from it.

This series fixes a bug in device_remove() is fixed where removing a
parent with specialised flags (e.g. DM_REMOVE_ACTIVE_ALL) could leave
children activated, since they do not match the flags. This fixes is
needed to avoid bootm_final() causing test failures on sandbox.

Future work could take this a little further:
- Convert EFI loader to use the same function
- Improve comments for cleanup_before_linux() across architectures
- Support fake-run tracing on all archs

Changes in v4:
- Drop announce_and_cleanup() in arm and riscv
- Drop announce_and_cleanup(), inline the two calls
- Pass flag directly instead of using BOOTM_FINAL_FAKE
- Print '(fake run for tracing)' when flag is set
- Use BOOTM_STATE_OS_FAKE_GO instead of new enum bootm_final_t

Changes in v3:
- Add dm: device_remove() fix for child removal with specialised flags
- Add new patch for ARC conversion
- Add new patch for ARM conversion (requested by Tom)
- Add new patch for MIPS conversion
- Add new patch for MicroBlaze conversion
- Add new patch for Nios2 conversion
- Add new patch for PowerPC conversion
- Add new patch for SH conversion
- Add new patch for Xtensa conversion
- Add new patch for bootstage stashing, needed for ARM conversion
- Add new patch for m68k conversion
- Add new patch for sandbox conversion
- Convert all remaining architectures
- Drop cleanup_before_linux() patch
- Drop the DMA comment move (now in the introductory patch)
- Drop udc_disconnect()
- Fix "the a" typo
- Introduce with all common functionality (not empty)
- Move board_quiesce_devices() into bootm_final() instead of dropping it
- Move bootstage dummies earlier in the series
- Move earlier in the series so bootm_final() can use bootstage from the start
- Put bootm_final() in bootm.c instead of a separate file
- Put in bootm.c instead of a separate file
- Squash in patches 2, 3 and 5 from v2
- Squash introductory patches so bootm_final() is introduced non-empty
- Squash with the previous riscv patches
- Update cover letter to match current series

Changes in v2:
- Drop patch 'efi: Drop EFI_GRUB_ARM32_WORKAROUND'
- Update cover message to reflect dropping the EFI patches, etc.

Simon Glass (17):
  dm: Move flags_remove() check before child removal
  dm: Remove children when parent is removed by flags
  bootstage: Add some missing dummy functions
  bootm: Create bootm_final() for pre-boot cleanup
  x86: Call bootm_final()
  riscv: Call bootm_final()
  bootm: Stash bootstage data in bootm_final()
  arm: Call bootm_final()
  arc: Call bootm_final()
  microblaze: Call bootm_final()
  mips: Call bootm_final()
  powerpc: Call bootm_final()
  m68k: Call bootm_final()
  nios2: Call bootm_final()
  sh: Call bootm_final()
  xtensa: Call bootm_final()
  sandbox: Call bootm_final()

 arch/arc/lib/bootm.c                  |  8 ++---
 arch/arm/lib/bootm.c                  | 50 ++++-----------------------
 arch/m68k/lib/bootm.c                 |  2 ++
 arch/microblaze/lib/bootm.c           |  8 ++---
 arch/mips/lib/bootm.c                 |  7 +---
 arch/nios2/lib/bootm.c                |  2 ++
 arch/powerpc/lib/bootm.c              |  7 +---
 arch/riscv/include/asm/u-boot-riscv.h |  1 -
 arch/riscv/lib/bootm.c                | 39 ++-------------------
 arch/sandbox/lib/bootm.c              |  1 +
 arch/sh/lib/bootm.c                   |  2 ++
 arch/x86/lib/bootm.c                  | 14 +-------
 arch/xtensa/lib/bootm.c               |  2 ++
 boot/bootm.c                          | 25 ++++++++++++++
 drivers/core/device-remove.c          | 34 +++++++++++-------
 include/bootm.h                       | 10 ++++++
 include/bootstage.h                   |  8 +++++
 17 files changed, 90 insertions(+), 130 deletions(-)

-- 
2.43.0

base-commit: c0ca147ac6228949a6d6497531c9f2f4a0dc6c67
branch: bootma-us4

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

end of thread, other threads:[~2026-03-19 14:18 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-06  2:36 [PATCH v4 00/17] bootm: Clean up arch-specific, pre-OS clean-up Simon Glass
2026-03-06  2:36 ` [PATCH v4 01/17] dm: Move flags_remove() check before child removal Simon Glass
2026-03-06  2:36 ` [PATCH v4 02/17] dm: Remove children when parent is removed by flags Simon Glass
2026-03-06  2:36 ` [PATCH v4 03/17] bootstage: Add some missing dummy functions Simon Glass
2026-03-06  2:36 ` [PATCH v4 04/17] bootm: Create bootm_final() for pre-boot cleanup Simon Glass
2026-03-06 15:12   ` Tom Rini
2026-03-06  2:36 ` [PATCH v4 05/17] x86: Call bootm_final() Simon Glass
2026-03-06  2:36 ` [PATCH v4 06/17] riscv: " Simon Glass
2026-03-06 15:12   ` Tom Rini
2026-03-06  2:36 ` [PATCH v4 07/17] bootm: Stash bootstage data in bootm_final() Simon Glass
2026-03-06  2:36 ` [PATCH v4 08/17] arm: Call bootm_final() Simon Glass
2026-03-06 15:12   ` Tom Rini
2026-03-06  2:36 ` [PATCH v4 09/17] arc: " Simon Glass
2026-03-06  2:36 ` [PATCH v4 10/17] microblaze: " Simon Glass
2026-03-06  2:36 ` [PATCH v4 11/17] mips: " Simon Glass
2026-03-06 12:20   ` Daniel Schwierzeck
2026-03-06  2:36 ` [PATCH v4 12/17] powerpc: " Simon Glass
2026-03-06  2:36 ` [PATCH v4 13/17] m68k: " Simon Glass
2026-03-07 16:36   ` Kuan-Wei Chiu
2026-03-06  2:36 ` [PATCH v4 14/17] nios2: " Simon Glass
2026-03-06  2:36 ` [PATCH v4 15/17] sh: " Simon Glass
2026-03-06  2:36 ` [PATCH v4 16/17] xtensa: " Simon Glass
2026-03-06  2:36 ` [PATCH v4 17/17] sandbox: " Simon Glass
2026-03-19 13:52 ` [PATCH v4 00/17] bootm: Clean up arch-specific, pre-OS clean-up Tom Rini

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