From: Ard Biesheuvel <ardb+git@google.com>
To: linux-efi@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org,
Ard Biesheuvel <ardb@kernel.org>,
Jason Gunthorpe <jgg@nvidia.com>, Paul Walmsley <pjw@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Huacai Chen <chenhuacai@kernel.org>,
loongarch@lists.linux.dev, linux-riscv@lists.infradead.org
Subject: [PATCH v4 00/19] efi: Expose loaded image properties via info struct
Date: Wed, 18 Nov 2026 19:21:06 +0100 [thread overview]
Message-ID: <20261118182105.1633603-21-ardb+git@google.com> (raw)
From: Ard Biesheuvel <ardb@kernel.org>
Clean up the arm64 build script and linker hacks that zboot uses to
obtain properties of the loaded image (which it cannot access directly
via a relative reference like the ordinary EFI stub).
Instead, define a generic struct efi_image_info, and expose its offset
in the loaded image in a similar manner, but without relying on explicit
linker script exports.
Populate the struct with section markers that all architecture use for
loading the kernel image at boot, so that all the linker exports can be
dropped for them.
Changes since v3:
- Populate efi_image_info for ARM correctly
- Fix a pre-existing issue in the ARM allocation logic
- Simplify the prototype of handle_kernel_image()
- Pass image_info pointer down to efi_kaslr_relocate_kernel() and
simplify the callers
- Align RISC-V's __inittext_end correctly so it can be remapped.
- Add some more acks from Jason
Changes since v2:
- Add some additional fixes for RISC-V, which deviates from other
architectures wrt its section markers. These patches have been sent
out separately as well [0] as they will likely be taken through the
RISC-V tree.
- Pass an efi_image_pointer to efi_stub_common() that points to the
version inside the loaded image, so that its relative references
accurately describe vmlinux in memory before boot.
- Avoid weak linkage hacks to derive the kernel entrypoint, and instead,
always use the entrypoint passed via efi_image_info
- Use efi_image_info for sysfb_display_info so that efifb earlycon works
much earlier on zboot
- Drop changes related to the previous bullet that are now no longer
needed
- Add acks from Jason
Changes since v1:
- drop arm64 image header changes
- move efi_image_info out of __efistub_ scope so it can access vmlinux
symbols directly
- implement in a generic manner for all architectures that support zboot
- address Sashiko comments
[0] https://lore.kernel.org/all/20261111164345.4059964-5-ardb+git@google.com/
Cc: Jason Gunthorpe <jgg@nvidia.com>
Cc: Paul Walmsley <pjw@kernel.org>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: loongarch@lists.linux.dev
Cc: linux-riscv@lists.infradead.org
Link: https://lore.kernel.org/all/0-v2-989a18390eb1+486-arm64_drtm_jgg@nvidia.com/
Ard Biesheuvel (19):
efi/zboot: arm64: Add missing barrier after cache maintenance
riscv: Use _stext not _text to denote the start of kernel code
riscv: Make _text point to the start of the kernel image
efi/riscv: Rename __init_text_end to __inittext_end like other archs
efi/libstub: Avoid _end section marker in library code
efi/libstub: arm: Size the decompressed kernel allocation precisely
efi/libstub: Avoid reserve_addr/_size in efi_kaslr_relocate_kernel()
efi/libstub: Capture loaded image information in struct efi_image_info
efi/libstub: Pass kernel entrypoint down to efi_enter_kernel()
efi/libstub: arm: Simplify handle_kernel_image()
efi/libstub: Drop reserve_addr/_size params from handle_kernel_image()
efi/libstub: arm64: Use struct efi_image_info to access image
properties
efi/libstub: loongarch: Use struct efi_image_info to access image
properties
efi/libstub: riscv: Use struct efi_image_info to access image
properties
efi/libstub: Make efi_remap_image() return efi_status_t
efi/zboot: Disentangle efi_remap_image() from efi_cache_sync_image()
efi/libstub: arm64: Drop zboot code_size hack
efi: Make config table based primary display handover ARM-only again
Revert "efi: earlycon: Reprobe after parsing config tables"
arch/arm/boot/compressed/head.S | 3 +-
arch/arm/include/asm/efi.h | 15 +---
arch/arm/kernel/efi.c | 27 ++++++
arch/arm64/boot/Makefile | 3 -
arch/arm64/include/asm/efi.h | 2 -
arch/arm64/kernel/efi-header.S | 2 +
arch/arm64/kernel/image-vars.h | 14 ---
arch/loongarch/kernel/efi.c | 20 +----
arch/loongarch/kernel/head.S | 4 +-
arch/loongarch/kernel/image-vars.h | 6 --
arch/loongarch/kernel/vmlinux.lds.S | 1 -
arch/riscv/include/asm/efi.h | 2 -
arch/riscv/include/asm/sections.h | 2 +-
arch/riscv/kernel/head.S | 1 +
arch/riscv/kernel/image-vars.h | 8 --
arch/riscv/kernel/setup.c | 2 +-
arch/riscv/kernel/vmlinux.lds.S | 6 +-
drivers/firmware/efi/earlycon.c | 16 +---
drivers/firmware/efi/efi-init.c | 24 +-----
drivers/firmware/efi/efi.c | 5 --
drivers/firmware/efi/libstub/Makefile | 3 +-
drivers/firmware/efi/libstub/Makefile.zboot | 11 ++-
drivers/firmware/efi/libstub/arm32-stub.c | 90 +++++++++++++++-----
drivers/firmware/efi/libstub/arm64-stub.c | 37 ++------
drivers/firmware/efi/libstub/arm64.c | 23 +----
drivers/firmware/efi/libstub/efi-stub-entry.c | 33 +------
drivers/firmware/efi/libstub/efi-stub-helper.c | 15 ++--
drivers/firmware/efi/libstub/efi-stub.c | 26 ++++--
drivers/firmware/efi/libstub/efistub.h | 84 +++++++++++++-----
drivers/firmware/efi/libstub/fdt.c | 5 +-
drivers/firmware/efi/libstub/image_info.S | 19 +++++
drivers/firmware/efi/libstub/kaslr.c | 45 +++++-----
drivers/firmware/efi/libstub/loongarch-stub.c | 21 ++---
drivers/firmware/efi/libstub/loongarch-stub.h | 4 -
drivers/firmware/efi/libstub/loongarch.c | 11 +--
drivers/firmware/efi/libstub/primary_display.c | 56 ------------
drivers/firmware/efi/libstub/riscv-stub.c | 29 +------
drivers/firmware/efi/libstub/riscv.c | 16 +---
drivers/firmware/efi/libstub/zboot-decompress-gzip.c | 2 -
drivers/firmware/efi/libstub/zboot-decompress-zstd.c | 2 -
drivers/firmware/efi/libstub/zboot.c | 28 +++++-
drivers/firmware/efi/libstub/zboot.lds | 6 +-
include/linux/efi.h | 1 -
43 files changed, 324 insertions(+), 406 deletions(-)
create mode 100644 drivers/firmware/efi/libstub/image_info.S
delete mode 100644 drivers/firmware/efi/libstub/loongarch-stub.h
delete mode 100644 drivers/firmware/efi/libstub/primary_display.c
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
--
2.56.1.708.g77570a6a1d-goog
next reply other threads:[~2026-11-18 18:21 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 18:21 Ard Biesheuvel [this message]
2026-11-18 18:21 ` [PATCH v4 01/19] efi/zboot: arm64: Add missing barrier after cache maintenance Ard Biesheuvel
2026-11-18 18:28 ` sashiko-bot
2026-11-18 18:21 ` [PATCH v4 02/19] riscv: Use _stext not _text to denote the start of kernel code Ard Biesheuvel
2026-11-18 18:21 ` [PATCH v4 03/19] riscv: Make _text point to the start of the kernel image Ard Biesheuvel
2026-11-18 18:21 ` [PATCH v4 04/19] efi/riscv: Rename __init_text_end to __inittext_end like other archs Ard Biesheuvel
2026-11-18 18:21 ` [PATCH v4 05/19] efi/libstub: Avoid _end section marker in library code Ard Biesheuvel
2026-11-18 18:21 ` [PATCH v4 06/19] efi/libstub: arm: Size the decompressed kernel allocation precisely Ard Biesheuvel
2026-11-18 18:41 ` sashiko-bot
2026-11-18 18:21 ` [PATCH v4 07/19] efi/libstub: Avoid reserve_addr/_size in efi_kaslr_relocate_kernel() Ard Biesheuvel
2026-11-18 18:21 ` [PATCH v4 08/19] efi/libstub: Capture loaded image information in struct efi_image_info Ard Biesheuvel
2026-11-18 18:21 ` [PATCH v4 09/19] efi/libstub: Pass kernel entrypoint down to efi_enter_kernel() Ard Biesheuvel
2026-11-18 18:21 ` [PATCH v4 10/19] efi/libstub: arm: Simplify handle_kernel_image() Ard Biesheuvel
2026-11-18 18:21 ` [PATCH v4 11/19] efi/libstub: Drop reserve_addr/_size params from handle_kernel_image() Ard Biesheuvel
2026-11-18 18:21 ` [PATCH v4 12/19] efi/libstub: arm64: Use struct efi_image_info to access image properties Ard Biesheuvel
2026-11-18 18:21 ` [PATCH v4 13/19] efi/libstub: loongarch: " Ard Biesheuvel
2026-11-18 18:21 ` [PATCH v4 14/19] efi/libstub: riscv: " Ard Biesheuvel
2026-11-18 18:21 ` [PATCH v4 15/19] efi/libstub: Make efi_remap_image() return efi_status_t Ard Biesheuvel
2026-11-18 18:21 ` [PATCH v4 16/19] efi/zboot: Disentangle efi_remap_image() from efi_cache_sync_image() Ard Biesheuvel
2026-11-18 18:21 ` [PATCH v4 17/19] efi/libstub: arm64: Drop zboot code_size hack Ard Biesheuvel
2026-11-18 18:21 ` [PATCH v4 18/19] efi: Make config table based primary display handover ARM-only again Ard Biesheuvel
2026-11-18 18:21 ` [PATCH v4 19/19] Revert "efi: earlycon: Reprobe after parsing config tables" Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261118182105.1633603-21-ardb+git@google.com \
--to=ardb+git@google.com \
--cc=aou@eecs.berkeley.edu \
--cc=ardb@kernel.org \
--cc=chenhuacai@kernel.org \
--cc=jgg@nvidia.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=loongarch@lists.linux.dev \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox