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

Mark Kettenis mark.kettenis at xs4all.nl
Mon Jul 22 18:59:59 UTC 2019


> From: Heinrich Schuchardt <xypron.glpk at gmx.de>
> Date: Sat, 20 Jul 2019 13:23:13 +0200
> 
> 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().

Thanks for the pointer.  I added code to OpenBSD's BOOTARM.EFI to
disable the caches and MMU such that the kernel ends up being started
in the same state as before.

That still leaves us with the L2 cache issue though.  A U-Boot with
CONFIG_SYS_L2CACHE_OFF set works, whereas without it doesn't.


More information about the U-Boot mailing list