All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb@kernel.org>
To: linux-efi@vger.kernel.org
Cc: Ard Biesheuvel <ardb@kernel.org>,
	Huacai Chen <chenhuacai@loongson.cn>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Jeremy Linton <jeremy.linton@arm.com>,
	Atish Patra <atishp@atishpatra.org>,
	Lennart Poettering <lennart@poettering.net>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>
Subject: [PATCH 0/4] efi: Improve command line initrd loader support
Date: Tue, 27 Sep 2022 10:58:38 +0200	[thread overview]
Message-ID: <20220927085842.2860715-1-ardb@kernel.org> (raw)

Given that the command line initrd loader can only load files from the
same simple FS volume from which the kernel itself was loaded, it was
not flexible enough for use in loaders such as GRUB that don't even
implement the FS volume abstraction, and load images as anonymous
buffers in memory. As x86 mixed mode was based on a GRUB specific EFI
handover protocol, and the simple FS protocol method prototypes were not
mixed mode safe, the initrd command line loader did not work for mixed
mode at all.

For this reason, we support arch specific methods (bootparam, DT) as
well, and have added support for a generic method based on the LoadFile2
protocol, which is much easier to implement and use.

However, there are cases where the command line loader is useful,
especially when using fully generic loaders such as the UEFI shell.
Here, it is generally not possible to use Linux specific structs or data
structures, or implement the Linux specific LoadFile2 protocol
implementation for initrd loading.

So let's fix the issues with the initrd command line loader:
- add the ability to use fully qualified device paths as the initrd=
  argument, so that the initrd image can reside on any simple FS volume,
  even if the kernel itself was not loaded from one;
- fix the mixed mode issues, by using the mixed mode wrappers for the
  protocol invocations, and defining some recipes for the prototypes
  that cannot be marshalled 1:1

The above means that mixed mode loaders that boot via the compat entry
point (e.g., systemd-boot) can use the initrd= command line option as
before to pass the initrd, if desired.

With those fixes in place, let's remove the deprecation notice, and
permit the feature to be enabled on LoongArch and RISC-V as well.

Note that LoadFile2 is still preferred, and will continue to take
precedence. It is also the only generic method that cannot be compiled
out.

Cc: Huacai Chen <chenhuacai@loongson.cn>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Jeremy Linton <jeremy.linton@arm.com>
Cc: Atish Patra <atishp@atishpatra.org>
Cc: Lennart Poettering <lennart@poettering.net>
Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>

Ard Biesheuvel (4):
  efi: libstub: Implement devicepath support for initrd commandline
    loader
  efi: libstub: Permit mixed mode return types other than efi_status_t
  efi: libstub: Add mixed mode support to command line initrd loader
  efi: libstub: Undeprecate the command line initrd loader

 arch/x86/boot/compressed/efi_thunk_64.S        |   6 --
 arch/x86/include/asm/efi.h                     |  49 +++++----
 drivers/firmware/efi/Kconfig                   |  13 ++-
 drivers/firmware/efi/libstub/efi-stub-helper.c |   2 +-
 drivers/firmware/efi/libstub/efistub.h         | 112 ++++++++++++++------
 drivers/firmware/efi/libstub/file.c            | 105 +++++++++++++-----
 include/linux/efi.h                            |   6 ++
 7 files changed, 202 insertions(+), 91 deletions(-)

-- 
2.35.1


             reply	other threads:[~2022-09-27  8:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-27  8:58 Ard Biesheuvel [this message]
2022-09-27  8:58 ` [PATCH 1/4] efi: libstub: Implement devicepath support for initrd commandline loader Ard Biesheuvel
2022-09-27  8:58 ` [PATCH 2/4] efi: libstub: Permit mixed mode return types other than efi_status_t Ard Biesheuvel
2022-09-27  8:58 ` [PATCH 3/4] efi: libstub: Add mixed mode support to command line initrd loader Ard Biesheuvel
2022-09-27  8:58 ` [PATCH 4/4] efi: libstub: Undeprecate the " 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=20220927085842.2860715-1-ardb@kernel.org \
    --to=ardb@kernel.org \
    --cc=atishp@atishpatra.org \
    --cc=chenhuacai@loongson.cn \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jeremy.linton@arm.com \
    --cc=lennart@poettering.net \
    --cc=linux-efi@vger.kernel.org \
    --cc=palmer@dabbelt.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.