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 CCAF7EB64DC for ; Sat, 1 Jul 2023 13:01:18 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 020BA861F4; Sat, 1 Jul 2023 15:00:56 +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=1688216457; bh=J1dmk17rJ5AKvYwGwB6UhOrH5BqHvSHQ4MeVeTGuixg=; h=From:To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=a30B1+/G/W1+4cUiLaomLTHXeHfMuTYJpXQkAvCFFY4jlcTVuPYHrCU31evU+FHAG G+leIuP6jrPR7yfjpZD1agBmWYmL8eysZ3ur7Z5RPHn8s6Fldb1x1leWnV5Nu/uUx0 gAGRwnnTD7iwcH4HiZQ8J7JFiQn3Mn84a8XdC72jE9U7sE0I9VbxrWfUMulQdPPsxO AvPH8Lyy0V1U8fyaz12MC/iqJbSNp9CFguqlbnMhEhkYz8ErR3G9fwuRLR70nan6NI g/+ct2r/5P91ADH2r72/mgFqskaR2nmblOy8HWZ4vTPjUVMU/+wZV4IftMajUEP0It ewgZa3XedECSg== 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 CFA46861AC; Sat, 1 Jul 2023 15:00:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1688216443; bh=J1dmk17rJ5AKvYwGwB6UhOrH5BqHvSHQ4MeVeTGuixg=; h=From:To:Cc:Subject:Date:From; b=ieqY2EeCfFHTeeXdyzCHd99jkbUBGfYTiJEu7fkP0KkbZsmaiGGzgRnzAG9ZeCx84 b4QE5/BFs8k3y0aWGpVImfh7fLI3MK22R/uXqUNNsE8MVcKKecPO0i3gNQCZOicwex p415ff66lzMF6iq8RdupGs6YCW9Yg682FWOw3xhNwEFU8IArsVR9hcBkLk9Oo/90f0 ht9ni+uq/UHeGI4ktiQKWNl/fuwRkeM5/SFCvqXtV+h47MDfUTHuAMeSo2J1lW/55A loT6sx2bj2ODEUSox5tgGyr3y+yZQwhacz9S9bLR/diSj9r/ff+bw9uS1zGzZQpzeW sOp+znilZsqHA== From: Marek Vasut To: u-boot@lists.denx.de Cc: trini@konsulko.com, Marek Vasut , Fabio Estevam , Heinrich Schuchardt , Simon Glass Subject: [PATCH 1/2] ARM: armv7: Add C wrapper for allow_unaligned() Date: Sat, 1 Jul 2023 15:00:27 +0200 Message-Id: <20230701130028.214122-1-marex@denx.de> X-Mailer: git-send-email 2.40.1 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 v7_arch_cp15_allow_unaligned() and add it into armv7.h header, then add C wrapper of allow_unaligned(). This fixes misbehavior when linking U-Boot on ARMv7a i.MX6Q, 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/armv7/cpu.c | 5 +++++ arch/arm/cpu/armv7/sctlr.S | 6 +++--- arch/arm/include/asm/armv7.h | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/arch/arm/cpu/armv7/cpu.c b/arch/arm/cpu/armv7/cpu.c index 68807d20997..6259ffa5108 100644 --- a/arch/arm/cpu/armv7/cpu.c +++ b/arch/arm/cpu/armv7/cpu.c @@ -83,3 +83,8 @@ int cleanup_before_linux(void) { return cleanup_before_linux_select(CBL_ALL); } + +void allow_unaligned(void) +{ + v7_arch_cp15_allow_unaligned(); +} diff --git a/arch/arm/cpu/armv7/sctlr.S b/arch/arm/cpu/armv7/sctlr.S index bd56e41afe1..d44b21498f6 100644 --- a/arch/arm/cpu/armv7/sctlr.S +++ b/arch/arm/cpu/armv7/sctlr.S @@ -8,15 +8,15 @@ #include /* - * void allow_unaligned(void) - allow unaligned access + * void v7_arch_cp15_allow_unaligned(void) - allow unaligned access * * This routine clears the aligned flag in the system control register. * After calling this routine unaligned access does no longer lead to a * data abort but is handled by the CPU. */ -ENTRY(allow_unaligned) +ENTRY(v7_arch_cp15_allow_unaligned) mrc p15, 0, r0, c1, c0, 0 @ load system control register 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(v7_arch_cp15_allow_unaligned) diff --git a/arch/arm/include/asm/armv7.h b/arch/arm/include/asm/armv7.h index 2fb824b69e2..c002998ac0b 100644 --- a/arch/arm/include/asm/armv7.h +++ b/arch/arm/include/asm/armv7.h @@ -156,6 +156,7 @@ void v7_arch_cp15_set_l2aux_ctrl(u32 l2auxctrl, u32 cpu_midr, u32 cpu_rev); void v7_arch_cp15_set_acr(u32 acr, u32 cpu_midr, u32 cpu_rev_comb, u32 cpu_variant, u32 cpu_rev); +void v7_arch_cp15_allow_unaligned(void); #endif /* ! __ASSEMBLY__ */ #endif -- 2.40.1