mbox series

[v4,0/9] x86: Improve support for chain-loading U-Boot

Message ID 20200426151302.93418-1-sjg@chromium.org
Headers show
Series x86: Improve support for chain-loading U-Boot | expand

Message

Simon Glass April 26, 2020, 3:12 p.m. UTC
This little series adds a few checks into the code to allow better
operation when booting a build from a previous-state loader such as
coreboot.

At present we have a 'coreboot' target but this runs very different code
from the bare-metal targets, such as coral. There is very little in common
between them.

It is useful to be able to boot the same U-Boot on a device, with or
without a first-stage bootloader. For example, with chromebook_coral, it
is helpful for testing to be able to boot the same U-Boot (complete with
FSP) on bare metal and from coreboot. It allows checking of things like
CPU speed, comparing registers, ACPI tables and the like.

This series allows U-Boot to detect that it ran from coreboot and
automatically do the right thing.

This series makes the most important changes to allow the same u-boot.bin
for coral to boot after coreboot (by itself) or bare metal (via TPL->SPL).

Changes in v4:
- Rename flag to GD_FLG_SKIP_LL_INIT
- Add new patch to move coreboot-table detection into common code
- Rename flag to GD_FLG_SKIP_LL_INIT
- Split this patch into two
- Update to use locate_coreboot_table()

Changes in v3:
- Add a new patch with a gd flag for chain loading
- Add new patch to detect running from coreboot

Changes in v2:
- Drop the other check in interrupt_init() which is not needed now
- Drop patch 'dm: Avoid initing built-in devices when chain loading'

Simon Glass (9):
  x86: fsp: Allow skipping init code when chain loading
  x86: apl: Skip init code when chain loading
  x86: cpu: Skip init code when chain loading
  pci: Avoid auto-config when chain loading
  board: Add a gd flag for chain loading
  x86: Move coreboot-table detection into common code
  x86: Add a way to detect running from coreboot
  x86: Use the existing stack when chain-loading
  x86: Add documentation for the chain-load feature

 arch/x86/cpu/apollolake/fsp_s.c        |  2 ++
 arch/x86/cpu/coreboot/tables.c         | 24 +++++++++-------------
 arch/x86/cpu/cpu.c                     |  4 +++-
 arch/x86/cpu/i386/cpu.c                | 27 +++++++++++++++++++++++++
 arch/x86/cpu/i386/interrupt.c          |  6 ++++--
 arch/x86/cpu/start_from_spl.S          | 16 +++++++++++++--
 arch/x86/include/asm/coreboot_tables.h |  7 +++++++
 arch/x86/lib/fsp/fsp_dram.c            |  8 ++++++++
 arch/x86/lib/fsp/fsp_graphics.c        |  3 +++
 arch/x86/lib/fsp2/fsp_dram.c           | 10 +++++++++
 arch/x86/lib/fsp2/fsp_init.c           |  2 +-
 arch/x86/lib/init_helpers.c            |  3 +++
 doc/arch/x86.rst                       | 28 ++++++++++++++++++++++++++
 drivers/pci/pci-uclass.c               |  4 ++--
 include/asm-generic/global_data.h      |  1 +
 include/init.h                         |  2 +-
 16 files changed, 123 insertions(+), 24 deletions(-)

Comments

Bin Meng April 30, 2020, 9:49 a.m. UTC | #1
Hi Simon,

On Sun, Apr 26, 2020 at 11:13 PM Simon Glass <sjg at chromium.org> wrote:
>
> This little series adds a few checks into the code to allow better
> operation when booting a build from a previous-state loader such as
> coreboot.
>
> At present we have a 'coreboot' target but this runs very different code
> from the bare-metal targets, such as coral. There is very little in common
> between them.
>
> It is useful to be able to boot the same U-Boot on a device, with or
> without a first-stage bootloader. For example, with chromebook_coral, it
> is helpful for testing to be able to boot the same U-Boot (complete with
> FSP) on bare metal and from coreboot. It allows checking of things like
> CPU speed, comparing registers, ACPI tables and the like.
>
> This series allows U-Boot to detect that it ran from coreboot and
> automatically do the right thing.
>
> This series makes the most important changes to allow the same u-boot.bin
> for coral to boot after coreboot (by itself) or bare metal (via TPL->SPL).
>
> Changes in v4:
> - Rename flag to GD_FLG_SKIP_LL_INIT
> - Add new patch to move coreboot-table detection into common code
> - Rename flag to GD_FLG_SKIP_LL_INIT
> - Split this patch into two
> - Update to use locate_coreboot_table()

v4 series applied to u-boot-x86/master, thanks!

Regards,
Bin