]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
ARM: arm11: Add C wrapper for allow_unaligned()
authorMarek Vasut <marex@denx.de>
Sat, 1 Jul 2023 15:26:19 +0000 (17:26 +0200)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Sat, 1 Jul 2023 15:29:15 +0000 (17:29 +0200)
Rename current assembler implementation of allow_unaligned() to
arm11_arch_cp15_allow_unaligned() and add it into arm11.h header,
then add C wrapper of allow_unaligned().

This fixes misbehavior when linking U-Boot, where the CPU specific
allow_unaligned() implementation was ignored and instead the
__weak allow_unaligned() implementation from lib/efi_loader/efi_setup.c
was used, which led to "data abort" just before booting Linux via tftp,
in efi_dp_from_file() -> path_to_uefi() -> utf16_put() .

The problem is triggerd by c7c0ca37673 ("efi_loader: fix efi_dp_from_file()") .
Adding the wrapper fixes the problem.

Fixes: d47a774680d ("arm: arm11: allow unaligned memory access")
Signed-off-by: Marek Vasut <marex@denx.de>
arch/arm/cpu/arm11/cpu.c
arch/arm/cpu/arm11/sctlr.S
arch/arm/include/asm/arm11.h [new file with mode: 0644]

index ffe35111d589729c7cb94c8580f46254e0725883..1e16b89d0066349a5e257e0c364cb477b909324a 100644 (file)
@@ -20,6 +20,7 @@
 #include <irq_func.h>
 #include <asm/cache.h>
 #include <asm/system.h>
+#include <asm/arm11.h>
 
 static void cache_flush(void);
 
@@ -43,6 +44,11 @@ int cleanup_before_linux (void)
        return 0;
 }
 
+void allow_unaligned(void)
+{
+       arm11_arch_cp15_allow_unaligned();
+}
+
 static void cache_flush(void)
 {
        unsigned long i = 0;
index 74a7fc4a25b63dc867cf492e1db69bf9070fefcc..8722f8380c8c5ce27b6ffeb7a974db250699c5c0 100644 (file)
@@ -8,7 +8,7 @@
 #include <linux/linkage.h>
 
 /*
- * void allow_unaligned(void) - allow unaligned access
+ * void arm11_arch_cp15_allow_unaligned(void) - allow unaligned access
  *
  * This routine sets the enable unaligned data support flag and clears the
  * aligned flag in the system control register.
  * data abort or undefined behavior but is handled by the CPU.
  * For details see the "ARM Architecture Reference Manual" for ARMv6.
  */
-ENTRY(allow_unaligned)
+ENTRY(arm11_arch_cp15_allow_unaligned)
        mrc     p15, 0, r0, c1, c0, 0   @ load system control register
        orr     r0, r0, #1 << 22        @ set unaligned data support flag
        bic     r0, r0, #2              @ clear aligned flag
        mcr     p15, 0, r0, c1, c0, 0   @ write system control register
        bx      lr                      @ return
-ENDPROC(allow_unaligned)
+ENDPROC(arm11_arch_cp15_allow_unaligned)
diff --git a/arch/arm/include/asm/arm11.h b/arch/arm/include/asm/arm11.h
new file mode 100644 (file)
index 0000000..5276f73
--- /dev/null
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2023 Marek Vasut <marex@denx.de>
+ */
+#ifndef ARM11_H
+#define ARM11_H
+
+#ifndef __ASSEMBLY__
+void arm11_arch_cp15_allow_unaligned(void);
+#endif /* ! __ASSEMBLY__ */
+
+#endif /* ARM11_H */