[U-Boot] [PATCH 1/1] efi_loader: remove efi_exit_caches()

Heinrich Schuchardt xypron.glpk at gmx.de
Sat Jul 20 11:23:13 UTC 2019


On 7/20/19 1:59 AM, Jonathan Gray wrote:
> On Fri, Jul 19, 2019 at 08:25:45PM +0200, Heinrich Schuchardt wrote:
>> In GRUB before 2.04 a bug existed which did not allow booting some ARM32
>> boards if U-Boot did not disable caches, cf.
>> https://lists.linaro.org/pipermail/cross-distro/2019-July/000933.html
>>
>> In ExitBootServices() we were disabling the caches by calling
>> cleanup_before_linux(). This workaround is not needed anymore.
>
> It is required for at least OpenBSD, FreeBSD and NetBSD.
> Which are all now forced to carry patches to be able to use U-Boot.

Please, compare function run_loadfile() in files
sys/arch/arm64/stand/efiboot/exec.c and
sys/arch/armv7/stand/efiboot/exec.c of openbsd/src.

On arm64 after loading the kernel you flush the data and instruction
caches. On armv7 you don't. As the UEFI spec requires caches to be
switched on this is bound to fail. You should be good if you flush
caches like you do on arm64.

You can find the relevant code for GRUB in
grub-core/kern/arm/cache.S and
grub-core/kern/arm/cache.c

After GRUB loads the Linux kernel it calls
grub_arch_sync_caches ((void *) linux_addr, linux_size);
in function linux_boot().

FreeBSD simply calls LoadImage() and StartImage() when booting and
leaves the cleanup of caches to the firmware (i.e. EDK2 or U-Boot).

https://github.com/freebsd/freebsd/blob/master/stand/efi/boot1/boot1.c#L133

Best regards

Heinrich


More information about the U-Boot mailing list