Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 08800EB64DC for ; Sat, 1 Jul 2023 13:00:51 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 94959861D9; Sat, 1 Jul 2023 15:00:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1688216449; bh=UfNsdWwO1SLWQjpffOODnZU8ER8pZ4avhEEGHo5ALBU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ALCpGQ5MDlZF+5eSxJK2fVh5Af4PTCmO1bkRiscO8u1WxzvzD6Jmpw+7lZUN7Y5jw R+gfRAvfZpn1iBb76K4QfAV62Dl0Qu1+a8DgwPemV/osc8k4kc69MKdUzCJSMKKEWp mmoLLMBzloaND+q4Ohps7eADYjZuy5VhDj/lnFywhlqVZ4lQYjEnVlG/nbbCU6QWcS nwwRgz4YvJfzOGF8kNkVaaxOMjWmbU8oqKmJelXupvLe3brL7INDNCSwKfzIeAiT/f MErC3nzktAiHmd6/pOrUIKkXPKIZC2+2+Xoi/2mEW/L7HLSj20gOM/lfIsDyozun3m JQ7DXWstDRkeA== Received: from tr.lan (ip-86-49-120-218.bb.vodafone.cz [86.49.120.218]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 5970C861D9; Sat, 1 Jul 2023 15:00:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1688216444; bh=UfNsdWwO1SLWQjpffOODnZU8ER8pZ4avhEEGHo5ALBU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XivzgvGDPRNtqIeVlCRex1WIzpQTR745Ab4sKKgvCJo27Sp1zUgekw431jOyHuLca wg2i9WOZvTFKoiRblMuzNx0p/r98W1JXmIgJIow3oDhyQd+wTiaV3p5p75G7rTqT1k wMBwYxzrTSe5jq2+0EV7IxKXhV5XacKeRiLl050a/fwnqIoI3a/J9iwirGS/Ljfkhq rfa881GME8qbrUFos3M+NBG/3xhfKoYHxGxsYZIVA+lqC0Y7MxFsZsEee9b8ceG9T1 pCsUh+HSwmffZgXUKcU3cJnMB5306ee8Kd/+nqvr9NEDs4HPKrimdMBFoSqsxqVget HiWQnBHbxb9iQ== From: Marek Vasut To: u-boot@lists.denx.de Cc: trini@konsulko.com, Marek Vasut , Fabio Estevam , Heinrich Schuchardt , Simon Glass Subject: [PATCH 2/2] ARM: arm11: Add C wrapper for allow_unaligned() Date: Sat, 1 Jul 2023 15:00:28 +0200 Message-Id: <20230701130028.214122-2-marex@denx.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230701130028.214122-1-marex@denx.de> References: <20230701130028.214122-1-marex@denx.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean 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() . Adding the wrapper fixes the problem. Fixes: c7c0ca37673 ("efi_loader: fix efi_dp_from_file()") Signed-off-by: Marek Vasut --- Cc: Fabio Estevam Cc: Heinrich Schuchardt Cc: Simon Glass Cc: Tom Rini --- arch/arm/cpu/arm11/cpu.c | 6 ++++++ arch/arm/cpu/arm11/sctlr.S | 6 +++--- arch/arm/include/asm/arm11.h | 12 ++++++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 arch/arm/include/asm/arm11.h diff --git a/arch/arm/cpu/arm11/cpu.c b/arch/arm/cpu/arm11/cpu.c index ffe35111d58..1e16b89d006 100644 --- a/arch/arm/cpu/arm11/cpu.c +++ b/arch/arm/cpu/arm11/cpu.c @@ -20,6 +20,7 @@ #include #include #include +#include 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; diff --git a/arch/arm/cpu/arm11/sctlr.S b/arch/arm/cpu/arm11/sctlr.S index 74a7fc4a25b..8722f8380c8 100644 --- a/arch/arm/cpu/arm11/sctlr.S +++ b/arch/arm/cpu/arm11/sctlr.S @@ -8,7 +8,7 @@ #include /* - * 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. @@ -16,10 +16,10 @@ * 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 index 00000000000..5276f735ef9 --- /dev/null +++ b/arch/arm/include/asm/arm11.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (C) 2023 Marek Vasut + */ +#ifndef ARM11_H +#define ARM11_H + +#ifndef __ASSEMBLY__ +void arm11_arch_cp15_allow_unaligned(void); +#endif /* ! __ASSEMBLY__ */ + +#endif /* ARM11_H */ -- 2.40.1