From mboxrd@z Thu Jan 1 00:00:00 1970 From: Heinrich Schuchardt Date: Sat, 20 Jul 2019 13:23:13 +0200 Subject: [U-Boot] [PATCH 1/1] efi_loader: remove efi_exit_caches() In-Reply-To: <20190719235915.GB16510@largo.jsg.id.au> References: <20190719182545.15662-1-xypron.glpk@gmx.de> <20190719235915.GB16510@largo.jsg.id.au> Message-ID: <7d4a678c-54b1-74cf-93a4-5fad587fc4fa@gmx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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