mbox series

[RFC,00/14] efi: implement EFISTUB support for ARM64 and Qualcomm

Message ID 20241124-b4-efistub-arm64-v1-0-3e33f0340071@linaro.org
Headers show
Series efi: implement EFISTUB support for ARM64 and Qualcomm | expand

Message

Caleb Connolly Nov. 24, 2024, 8:26 p.m. UTC
This series implements support for launching U-Boot as an EFI payload on
ARM64 devices that already have an EFI capable bootloader.

Patches 9 through 14 in tandem with another series [1] provide all the
pieces necessary to build and run U-Boot on Snapdragon X Elite laptops.
They're only here to demonstrate the usecase and either already have or
will be sent separately, they should not be reviewed as part of this
RFC.

Initial support is provided for:
* Building U-Boot with an EFI stub on ARM64
* Inheriting DRAM banks from the EFI memory map
* Creating a framebuffer node in the OF tree based on EFI GOP info

This allows for booting Linux on top of U-Boot's EFI implementation on
Qualcomm Snapdragon X Elite platforms.

The primary motivation for this is to provide a more standard EFI
interface on devices like Qualcomm powered Windows laptops. While these
devices ship an EFI capable bootloader, it has no understanding of
devicetree, requiring distros (or more often, users) to handle
devicetree selection and applying necessary fixups.

Additionally, the EFI implementation on these devices is often very far
from being systemready compliant, with a variety of bugs like broken
keyboards, crashes in OS loaders like systemd-boot, and other small
idiosyncrocies.

As a result, simply running U-Boot as an EFI app isn't a suitable
solution.

[1]: 20241124-b4-modernise-smem-v1-0-b7852c11b67c@linaro.org

---
Caleb Connolly (10):
      cmd: efi: avoid unitialized read
      efi: stub: support running U-Boot as an EFI payload on ARM64
      efi: move efi_info_get() to a new header file
      efi: stub: add helpers to populate memory map and framebuffer
      efi: stub: add additional types of memory
      efi: stub: log EFI memory banks
      efi: stub: add known memory to U-Boot's EFI memory map
      mach-snapdragon: support booting with EFISTUB
      common/board_f: init malloc earlier
      configs: add x1e_defconfig

Neil Armstrong (4):
      clk: qcom: Add X1E80100 clock driver
      qcom_defconfig: enable X1E80100 clock driver
      pinctrl: qcom: Add X1E80100 pinctrl driver
      qcom_defconfig: enable X1E80100 pinctrl driver

 Makefile                                |  15 +-
 arch/arm/cpu/armv8/config.mk            |  11 +
 arch/arm/include/asm/global_data.h      |   3 +
 arch/arm/lib/Makefile                   |   2 +
 arch/arm/mach-snapdragon/board.c        |  15 ++
 arch/arm/mach-snapdragon/dram.c         |  15 +-
 arch/arm/mach-snapdragon/qcom-priv.h    |   2 +
 arch/x86/cpu/efi/payload.c              |  32 +--
 board/qualcomm/efistub.env              |  11 +
 cmd/efi.c                               |   3 +-
 common/board_f.c                        |   2 +-
 configs/qcom_defconfig                  |   2 +
 configs/x1e_defconfig                   |  17 ++
 drivers/clk/qcom/Kconfig                |   8 +
 drivers/clk/qcom/Makefile               |   1 +
 drivers/clk/qcom/clock-x1e80100.c       | 348 ++++++++++++++++++++++++++++++++
 drivers/pinctrl/qcom/Kconfig            |   7 +
 drivers/pinctrl/qcom/Makefile           |   1 +
 drivers/pinctrl/qcom/pinctrl-x1e80100.c | 100 +++++++++
 drivers/video/efi.c                     |   1 +
 include/efi.h                           |  27 +--
 include/efi_stub.h                      |  67 ++++++
 lib/efi/Kconfig                         |   9 +-
 lib/efi/Makefile                        |  28 ++-
 lib/efi/efi_app.c                       |   1 +
 lib/efi/efi_info.c                      | 165 +++++++++++++++
 lib/efi/efi_stub_arm64.c                | 237 ++++++++++++++++++++++
 lib/efi/{efi_stub.c => efi_stub_x86.c}  |   1 +
 lib/efi_loader/efi_memory.c             |   5 +
 lib/of_live.c                           |   9 +
 30 files changed, 1072 insertions(+), 73 deletions(-)
---
base-commit: 1e327ec30e48902fff65fb58337b8f80cc526f08

// Caleb (they/them)

Comments

Simon Glass Feb. 3, 2025, 12:54 p.m. UTC | #1
Hi Caleb,

On Sun, 24 Nov 2024 at 13:27, Caleb Connolly <caleb.connolly@linaro.org> wrote:
>
> This series implements support for launching U-Boot as an EFI payload on
> ARM64 devices that already have an EFI capable bootloader.
>
> Patches 9 through 14 in tandem with another series [1] provide all the
> pieces necessary to build and run U-Boot on Snapdragon X Elite laptops.
> They're only here to demonstrate the usecase and either already have or
> will be sent separately, they should not be reviewed as part of this
> RFC.
>
> Initial support is provided for:
> * Building U-Boot with an EFI stub on ARM64
> * Inheriting DRAM banks from the EFI memory map
> * Creating a framebuffer node in the OF tree based on EFI GOP info
>
> This allows for booting Linux on top of U-Boot's EFI implementation on
> Qualcomm Snapdragon X Elite platforms.
>
> The primary motivation for this is to provide a more standard EFI
> interface on devices like Qualcomm powered Windows laptops. While these
> devices ship an EFI capable bootloader, it has no understanding of
> devicetree, requiring distros (or more often, users) to handle
> devicetree selection and applying necessary fixups.
>
> Additionally, the EFI implementation on these devices is often very far
> from being systemready compliant, with a variety of bugs like broken
> keyboards, crashes in OS loaders like systemd-boot, and other small
> idiosyncrocies.
>
> As a result, simply running U-Boot as an EFI app isn't a suitable
> solution.
>
> [1]: 20241124-b4-modernise-smem-v1-0-b7852c11b67c@linaro.org
>
> ---
> Caleb Connolly (10):
>       cmd: efi: avoid unitialized read
>       efi: stub: support running U-Boot as an EFI payload on ARM64
>       efi: move efi_info_get() to a new header file
>       efi: stub: add helpers to populate memory map and framebuffer
>       efi: stub: add additional types of memory
>       efi: stub: log EFI memory banks
>       efi: stub: add known memory to U-Boot's EFI memory map
>       mach-snapdragon: support booting with EFISTUB
>       common/board_f: init malloc earlier
>       configs: add x1e_defconfig
>
> Neil Armstrong (4):
>       clk: qcom: Add X1E80100 clock driver
>       qcom_defconfig: enable X1E80100 clock driver
>       pinctrl: qcom: Add X1E80100 pinctrl driver
>       qcom_defconfig: enable X1E80100 pinctrl driver
>
>  Makefile                                |  15 +-
>  arch/arm/cpu/armv8/config.mk            |  11 +
>  arch/arm/include/asm/global_data.h      |   3 +
>  arch/arm/lib/Makefile                   |   2 +
>  arch/arm/mach-snapdragon/board.c        |  15 ++
>  arch/arm/mach-snapdragon/dram.c         |  15 +-
>  arch/arm/mach-snapdragon/qcom-priv.h    |   2 +
>  arch/x86/cpu/efi/payload.c              |  32 +--
>  board/qualcomm/efistub.env              |  11 +
>  cmd/efi.c                               |   3 +-
>  common/board_f.c                        |   2 +-
>  configs/qcom_defconfig                  |   2 +
>  configs/x1e_defconfig                   |  17 ++
>  drivers/clk/qcom/Kconfig                |   8 +
>  drivers/clk/qcom/Makefile               |   1 +
>  drivers/clk/qcom/clock-x1e80100.c       | 348 ++++++++++++++++++++++++++++++++
>  drivers/pinctrl/qcom/Kconfig            |   7 +
>  drivers/pinctrl/qcom/Makefile           |   1 +
>  drivers/pinctrl/qcom/pinctrl-x1e80100.c | 100 +++++++++
>  drivers/video/efi.c                     |   1 +
>  include/efi.h                           |  27 +--
>  include/efi_stub.h                      |  67 ++++++
>  lib/efi/Kconfig                         |   9 +-
>  lib/efi/Makefile                        |  28 ++-
>  lib/efi/efi_app.c                       |   1 +
>  lib/efi/efi_info.c                      | 165 +++++++++++++++
>  lib/efi/efi_stub_arm64.c                | 237 ++++++++++++++++++++++
>  lib/efi/{efi_stub.c => efi_stub_x86.c}  |   1 +
>  lib/efi_loader/efi_memory.c             |   5 +
>  lib/of_live.c                           |   9 +
>  30 files changed, 1072 insertions(+), 73 deletions(-)
> ---
> base-commit: 1e327ec30e48902fff65fb58337b8f80cc526f08
>

I am pulling this in as I need to get the app going on ARM and this is
a better starting point.

For the series, applied to sjg/master, thanks!

Regards,
SImon
Simon Glass Feb. 3, 2025, 5:36 p.m. UTC | #2
Hi again,

On Mon, 3 Feb 2025 at 05:54, Simon Glass <sjg@chromium.org> wrote:
>
> Hi Caleb,
>
> On Sun, 24 Nov 2024 at 13:27, Caleb Connolly <caleb.connolly@linaro.org> wrote:
> >
> > This series implements support for launching U-Boot as an EFI payload on
> > ARM64 devices that already have an EFI capable bootloader.
> >
> > Patches 9 through 14 in tandem with another series [1] provide all the
> > pieces necessary to build and run U-Boot on Snapdragon X Elite laptops.
> > They're only here to demonstrate the usecase and either already have or
> > will be sent separately, they should not be reviewed as part of this
> > RFC.
> >
> > Initial support is provided for:
> > * Building U-Boot with an EFI stub on ARM64
> > * Inheriting DRAM banks from the EFI memory map
> > * Creating a framebuffer node in the OF tree based on EFI GOP info
> >
> > This allows for booting Linux on top of U-Boot's EFI implementation on
> > Qualcomm Snapdragon X Elite platforms.
> >
> > The primary motivation for this is to provide a more standard EFI
> > interface on devices like Qualcomm powered Windows laptops. While these
> > devices ship an EFI capable bootloader, it has no understanding of
> > devicetree, requiring distros (or more often, users) to handle
> > devicetree selection and applying necessary fixups.
> >
> > Additionally, the EFI implementation on these devices is often very far
> > from being systemready compliant, with a variety of bugs like broken
> > keyboards, crashes in OS loaders like systemd-boot, and other small
> > idiosyncrocies.
> >
> > As a result, simply running U-Boot as an EFI app isn't a suitable
> > solution.
> >
> > [1]: 20241124-b4-modernise-smem-v1-0-b7852c11b67c@linaro.org
> >
> > ---
> > Caleb Connolly (10):
> >       cmd: efi: avoid unitialized read
> >       efi: stub: support running U-Boot as an EFI payload on ARM64
> >       efi: move efi_info_get() to a new header file
> >       efi: stub: add helpers to populate memory map and framebuffer
> >       efi: stub: add additional types of memory
> >       efi: stub: log EFI memory banks
> >       efi: stub: add known memory to U-Boot's EFI memory map
> >       mach-snapdragon: support booting with EFISTUB
> >       common/board_f: init malloc earlier
> >       configs: add x1e_defconfig
> >
> > Neil Armstrong (4):
> >       clk: qcom: Add X1E80100 clock driver
> >       qcom_defconfig: enable X1E80100 clock driver
> >       pinctrl: qcom: Add X1E80100 pinctrl driver
> >       qcom_defconfig: enable X1E80100 pinctrl driver
> >
> >  Makefile                                |  15 +-
> >  arch/arm/cpu/armv8/config.mk            |  11 +
> >  arch/arm/include/asm/global_data.h      |   3 +
> >  arch/arm/lib/Makefile                   |   2 +
> >  arch/arm/mach-snapdragon/board.c        |  15 ++
> >  arch/arm/mach-snapdragon/dram.c         |  15 +-
> >  arch/arm/mach-snapdragon/qcom-priv.h    |   2 +
> >  arch/x86/cpu/efi/payload.c              |  32 +--
> >  board/qualcomm/efistub.env              |  11 +
> >  cmd/efi.c                               |   3 +-
> >  common/board_f.c                        |   2 +-
> >  configs/qcom_defconfig                  |   2 +
> >  configs/x1e_defconfig                   |  17 ++
> >  drivers/clk/qcom/Kconfig                |   8 +
> >  drivers/clk/qcom/Makefile               |   1 +
> >  drivers/clk/qcom/clock-x1e80100.c       | 348 ++++++++++++++++++++++++++++++++
> >  drivers/pinctrl/qcom/Kconfig            |   7 +
> >  drivers/pinctrl/qcom/Makefile           |   1 +
> >  drivers/pinctrl/qcom/pinctrl-x1e80100.c | 100 +++++++++
> >  drivers/video/efi.c                     |   1 +
> >  include/efi.h                           |  27 +--
> >  include/efi_stub.h                      |  67 ++++++
> >  lib/efi/Kconfig                         |   9 +-
> >  lib/efi/Makefile                        |  28 ++-
> >  lib/efi/efi_app.c                       |   1 +
> >  lib/efi/efi_info.c                      | 165 +++++++++++++++
> >  lib/efi/efi_stub_arm64.c                | 237 ++++++++++++++++++++++
> >  lib/efi/{efi_stub.c => efi_stub_x86.c}  |   1 +
> >  lib/efi_loader/efi_memory.c             |   5 +
> >  lib/of_live.c                           |   9 +
> >  30 files changed, 1072 insertions(+), 73 deletions(-)
> > ---
> > base-commit: 1e327ec30e48902fff65fb58337b8f80cc526f08
> >
>
> I am pulling this in as I need to get the app going on ARM and this is
> a better starting point.
>
> For the series, applied to sjg/master, thanks!

Er, just these patches:

de6dd73b4e5 efi: stub: add known memory to U-Boot's EFI memory map
8cb8d63b432 efi: stub: log EFI memory banks
cef0312def4 efi: stub: add additional types of memory
d9d2b8fb71f efi: stub: add helpers to populate memory map and framebuffer
- Updated to avoid changing the devicetree with the EFI app; fix build
error on x86

630cb84000f efi: move efi_info_get() to a new header file
e0a8bf6f453 efi: stub: support running U-Boot as an EFI payload on ARM64
88e332d7075 cmd: efi: avoid unitialized read

I will have a Qualcomm laptop so will be interested to see if this works on it.

Regards,
Simon