public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/1] efi_loader: restrict EFI_LOADER to armv7 and armv8 on ARM
@ 2019-11-17 10:00 Heinrich Schuchardt
  2019-11-19 15:30 ` Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Heinrich Schuchardt @ 2019-11-17 10:00 UTC (permalink / raw)
  To: u-boot

fatload USB was reported to fail on the Sheevaplug. Debugging showed that
this was caused by an incorrect unaligned write to memory in
path_to_uefi().

UEFI on ARM requires that unaligned memory access is enabled.

* ARMv5 does not support unaligned access at all.
* ARMv6 supports unaligned access when we clear the A flag and set the
  U flag.
* On ARMv7 unaligned access is possible when clearing the aligned flag,
  which we do in function allow_unaligned() (arch/arm/cpu/armv7/sctlr.S).
  For none of the other cpus in arch/arm/cpu/ we have implemented a
  similar function.
* ARMv8 allows unaligned access.

Let EFI_LOADER on ARM depend on SYS_CPU=armv7 or SYS_CPU=armv8.

Once we have implemented allow_unaligned() for other ARM CPUs we can add
these to Kconfig.

Reported-by: Gray Remlin <gryrmln@gmail.com>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 lib/efi_loader/Kconfig | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index c7027a9676..2f40e485ef 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -1,6 +1,9 @@
 config EFI_LOADER
 	bool "Support running UEFI applications"
-	depends on (ARM || X86 || RISCV || SANDBOX) && OF_LIBFDT
+	depends on OF_LIBFDT && ( \
+		ARM && (SYS_CPU = armv7 || \
+			SYS_CPU = armv8) || \
+		X86 || RISCV || SANDBOX)
 	# We need EFI_STUB_64BIT to be set on x86_64 with EFI_STUB
 	depends on !EFI_STUB || !X86_64 || EFI_STUB_64BIT
 	# We need EFI_STUB_32BIT to be set on x86_32 with EFI_STUB
--
2.24.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] [PATCH 1/1] efi_loader: restrict EFI_LOADER to armv7 and armv8 on ARM
  2019-11-17 10:00 [U-Boot] [PATCH 1/1] efi_loader: restrict EFI_LOADER to armv7 and armv8 on ARM Heinrich Schuchardt
@ 2019-11-19 15:30 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2019-11-19 15:30 UTC (permalink / raw)
  To: u-boot

On Sun, Nov 17, 2019 at 11:00:40AM +0100, Heinrich Schuchardt wrote:

> fatload USB was reported to fail on the Sheevaplug. Debugging showed that
> this was caused by an incorrect unaligned write to memory in
> path_to_uefi().
> 
> UEFI on ARM requires that unaligned memory access is enabled.
> 
> * ARMv5 does not support unaligned access at all.
> * ARMv6 supports unaligned access when we clear the A flag and set the
>   U flag.
> * On ARMv7 unaligned access is possible when clearing the aligned flag,
>   which we do in function allow_unaligned() (arch/arm/cpu/armv7/sctlr.S).
>   For none of the other cpus in arch/arm/cpu/ we have implemented a
>   similar function.
> * ARMv8 allows unaligned access.
> 
> Let EFI_LOADER on ARM depend on SYS_CPU=armv7 or SYS_CPU=armv8.
> 
> Once we have implemented allow_unaligned() for other ARM CPUs we can add
> these to Kconfig.
> 
> Reported-by: Gray Remlin <gryrmln@gmail.com>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191119/cad063ef/attachment.sig>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-19 15:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-17 10:00 [U-Boot] [PATCH 1/1] efi_loader: restrict EFI_LOADER to armv7 and armv8 on ARM Heinrich Schuchardt
2019-11-19 15:30 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox