Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B79BC432BE for ; Wed, 25 Aug 2021 23:55:38 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id DD86B60F5B for ; Wed, 25 Aug 2021 23:55:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DD86B60F5B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C8E4381F7B; Thu, 26 Aug 2021 01:55:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id D06EE81F7B; Thu, 26 Aug 2021 01:55:30 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id E4CA98081E for ; Thu, 26 Aug 2021 01:55:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=andre.przywara@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AD7EC31B; Wed, 25 Aug 2021 16:55:24 -0700 (PDT) Received: from slackpad.fritz.box (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E55BB3F5A1; Wed, 25 Aug 2021 16:55:23 -0700 (PDT) Date: Thu, 26 Aug 2021 00:55:09 +0100 From: Andre Przywara To: Samuel Holland Cc: u-boot@lists.denx.de, Tom Rini , Jagan Teki Subject: Re: [PATCH v2] ARM: Prevent the compiler from using NEON registers Message-ID: <20210826005509.0e5a1e66@slackpad.fritz.box> In-Reply-To: <20210822005402.18113-1-samuel@sholland.org> References: <20210822005402.18113-1-samuel@sholland.org> Organization: Arm Ltd. X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.31; x86_64-slackware-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean On Sat, 21 Aug 2021 19:54:02 -0500 Samuel Holland wrote: Hi Samuel, thanks for the update. > For ARMv8-A, NEON is standard, so the compiler can use it even when no > special target flags are provided. That is not entirely true, NEON is architecturally an optional feature, it's just so prevalent that GCC decided to include it in the default "armv8-a" arch definition: https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html -march=name > For example, it can use stores from > NEON registers to zero-initialize large structures. GCC 11 decides to > do this inside the DRAM init code for the Allwinner H6. > > However, GCC 11 has a bug where it generates misaligned NEON register > stores even with -mstrict-align. Since the MMU is not enabled this early > in SPL, the misaligned store causes an exception and breaks booting. For the records: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101934 > Work around this issue by restricting the compiler to using GPRs only, > not vector registers. This prevents any future surprises relating to > NEON use as well. While one could argue that this is papering over a compiler bug, we actually have no guarantee that *every* ARMv8 target core we compile for has NEON support. Cortex-A53 (and even A55) for instance allow to not include NEON during the integration process, so any access to NEON registers would crash there already. > Signed-off-by: Samuel Holland Acked-by: Andre Przywara Cheers, Andre > --- > > Changes in v2: > - Updated commit message to describe problem more precisely > > arch/arm/config.mk | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/arm/config.mk b/arch/arm/config.mk > index 16c63e12667..964c6b026ec 100644 > --- a/arch/arm/config.mk > +++ b/arch/arm/config.mk > @@ -25,6 +25,7 @@ endif > > PLATFORM_RELFLAGS += -fno-common -ffixed-r9 > PLATFORM_RELFLAGS += $(call cc-option, -msoft-float) \ > + $(call cc-option,-mgeneral-regs-only) \ > $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) > > # LLVM support