All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
To: Daniel Kiper <daniel.kiper@oracle.com>
Cc: Leif Lindholm <leif@nuviainc.com>,
	Grant Likely <grant.likely@arm.com>,
	grub-devel@gnu.org, Heinrich Schuchardt <xypron.glpk@gmx.de>
Subject: Re: [PATCH 0/2] efi: device tree fix-up
Date: Mon, 2 Aug 2021 15:00:55 +0200	[thread overview]
Message-ID: <175518e1-9d7a-0f69-41c7-042ba55bf87d@canonical.com> (raw)
In-Reply-To: <20210204131558.1048-1-xypron.glpk@gmx.de>

Hello Daniel,

I sent this series when you were in the middle of getting GRUB-2.06 out. 
Unfortunately I did not see any feedback yet. Could you, please, share 
your thoughts.

Best regards

Heinrich

On 04.02.21 14:15, Heinrich Schuchardt wrote:
> Operating systems need a description of the hardware. This description can
> either be supplied via ACPI tables or via device-trees. On the ARM
> architecture ACPI tables are not avaialable for most devices.
> 
> In an ideal world device-trees would be defined once by the hardware
> manufacturer and would not be subject to change.
> 
> In reality device-trees or subject to frequent changes. Linux has a long
> record of breaking forward and backwards compatibility between device-
> trees and the kernel. So for booting it is wise to use the specific device-
> tree that comes with the operation system. This requires reading the
> device-tree from file.
> 
> One approach is to leave loading the device-tree file to the firmware. This
> works fine if the firmware is loading the triple of kernel, initrd, and
> device-tree. This is what Debian does with the flash-kernel package. It
> provides a boot script for U-Boot that loads the most recent kernel,
> initrd, and device-tree.
> 
> Before passing the device-tree to the operating as an EFI configuration
> table the firmware goes through the following steps:
> 
> * Fix-ups are applied to the device-tree. Examples of the changes include
>    the memory size and the RISC-V boot hart. Without the changes the
>    operating system may not boot at all or crash later.
> 
> * Memory reservations are added to the memory map according to the
>    /reserved-memory node and the memory reservation block of the
>    device-tree. Without these reservations the operating system may crash.
> 
> When using GRUB it is not known beforehand which operating system the user
> will choose. To guarantee compatibility with the operating system GRUB has
> to take control of the device-tree loading.
> 
> GRUB has a devicetree command to load a device-tree which is then passed as
> EFI configuration table to the operating systems. But GRUB lacks the
> information needed to apply fix-ups to the device-tree. Further memory
> reservations are not executed.
> 
> What is needed is to pass the device-tree loaded by GRUB via the
> devicetree command to the firmware to execute fix-ups and memory
> reservations.
> 
> U-Boot v2020.04-rc1 provides an EFI protocol for this purpose which has
> been defined in the EFI_DT_FIXUP_PROTOCOL specification [1].
> 
> With the first patch in the series the devicetree command is enhanced. It
> checks if an instance of the EFI_DT_FIXUP_PROTOCOL is available. If yes,
> the Fixup() method of the protocol is called when the boot command is
> invoked. The fixed-up device-tree is passed to the operating system as
> EFI configuration table.
> 
> The second patch adjusts the 10_linux template for grub-mkconfig. If
> GRUB_LOAD_DEVICETREE=true in /etc/default/grub, it looks for file
> dtb-${version} matching the Linux version. If the file (or file dtb as
> fallback) is found, a devicetree command is added to grub.cfg.
> 
> [1] EFI_DT_FIXUP_PROTOCOL specification
>      https://github.com/U-Boot-EFI/EFI_DT_FIXUP_PROTOCOL
> 
> Heinrich Schuchardt (2):
>    efi: EFI Device Tree Fixup Protocol
>    10_linux: support loading device trees
> 
>   docs/grub.texi             |  6 ++++++
>   grub-core/loader/efi/fdt.c | 35 ++++++++++++++++++++++++++++++++++-
>   include/grub/efi/api.h     | 22 ++++++++++++++++++++++
>   util/grub-mkconfig.in      |  1 +
>   util/grub.d/10_linux.in    | 23 +++++++++++++++++++++++
>   5 files changed, 86 insertions(+), 1 deletion(-)
> 
> --
> 2.30.0
> 


  parent reply	other threads:[~2021-08-02 14:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-04 13:15 [PATCH 0/2] efi: device tree fix-up Heinrich Schuchardt
2021-02-04 13:15 ` [PATCH 1/2] efi: EFI Device Tree Fixup Protocol Heinrich Schuchardt
2021-02-04 13:15 ` [PATCH 2/2] 10_linux: support loading device trees Heinrich Schuchardt
2021-08-02 13:00 ` Heinrich Schuchardt [this message]
2021-08-02 15:18   ` [PATCH 0/2] efi: device tree fix-up Daniel Kiper
2021-08-13 16:22     ` Heinrich Schuchardt
2021-08-13 20:22       ` Daniel Kiper
2021-08-13 22:38         ` Heinrich Schuchardt
2021-08-16  7:04           ` Ard Biesheuvel
2021-08-16  8:58             ` Heinrich Schuchardt
2021-08-16  9:26               ` 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=175518e1-9d7a-0f69-41c7-042ba55bf87d@canonical.com \
    --to=heinrich.schuchardt@canonical.com \
    --cc=daniel.kiper@oracle.com \
    --cc=grant.likely@arm.com \
    --cc=grub-devel@gnu.org \
    --cc=leif@nuviainc.com \
    --cc=xypron.glpk@gmx.de \
    /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.