Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp993484yba; Thu, 4 Apr 2019 01:59:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqx9bfzn1j+ts/dy/f03JcGAOHTbgLaAuq3m8LQl6OgleaiMGe/Q78bUyQSZ60VNe3N1jP0d X-Received: by 2002:a17:902:9a83:: with SMTP id w3mr5175796plp.241.1554368350477; Thu, 04 Apr 2019 01:59:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554368350; cv=none; d=google.com; s=arc-20160816; b=Mhx1TCF6lUkda5HC5633RWg+eGjS1JqNzm9n6KGh6i1n9wQoExK0cYXabCdzNBrZlH A+jPM52w3k51VfA9GXjXm3XaEETEi1qlMMdjJ8l0+m018WtdoLJvk9nRjoxdwxBvd23f QaSnBfZtso3pnIQ18g90ZGiVo3NTnyeBWxYmI9SNeK6yp3q4/XGvIpkFQ+EeMxoQI6Ux 4UasHHZH1YyvJfpN9q9ysilHNcwHx/OsBUSKQvVx1P3SRmQd6T9T8ZsclkoMP7aedq/q qcNI+NFgpOGscckD8TAH1+Wqq5FKcBOSLw5ZV+A+81KWF1/LA5xYxN3YdisJrsj6E7/U g2Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pzh9xFw5RGzn9mewHHBlftEzuLy8YBMC6UxO6J5bEBs=; b=gLX//H+OFX2QQnXxaE7YkecCCNlhEXJkvaOtu+gHEO5MUfZHam3lmTl3H+JGVz0C1W AisJ8JYJ/4atY0YIjfCndCQH7kkUhtsGqBhPN14timwJKxWMtOXcm1BO25iDxyCCNQki kb+E3fqeFCt88Aypyx+nM8klQ+R3xnpDXb0rAXO4gAEZ9gdhfxkMptOU9CcyIT7VxL1L j5rb+G1eLyaMhoXdpRjNK5cNmc1kAHehYqZ3zuF/hAymPfFpA9H55JOIyoRgIS71MWn5 7VL2i3PKw+ZPbgjD30fGnPp12g/XBXa6/M8bJn86Mv6n2cIsbZuESoMIg6+RxQDOqzS8 yKtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="XTL/Dnvg"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r199si16833816pfc.271.2019.04.04.01.58.55; Thu, 04 Apr 2019 01:59:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="XTL/Dnvg"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729861AbfDDI4j (ORCPT + 99 others); Thu, 4 Apr 2019 04:56:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:60032 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730499AbfDDI4h (ORCPT ); Thu, 4 Apr 2019 04:56:37 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C03FF2183E; Thu, 4 Apr 2019 08:56:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554368196; bh=NM0vFnfdt+P2aLD6igYFt8vlnA2DAZjXGghX5BOuq0k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XTL/DnvgeLd93QvF4HBar4pWg/oonQG3r4X71wMvg03oSbsx+ntEdP8PPi+z9Zcmg aLDkU2odqRzIweFfbh9tYOJGaF1gpIwj+n6RphDZmGGld7b3stMl9dkhJ1eRWXy3AR WYGO2eJpQJuvueqUCXRXa6MJ1M5LQl5sHoKHjmBg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ard Biesheuvel , Nathan Chancellor , Nicolas Pitre , Nick Desaulniers , Stefan Agner , Russell King , Sasha Levin Subject: [PATCH 4.14 072/121] ARM: 8833/1: Ensure that NEON code always compiles with Clang Date: Thu, 4 Apr 2019 10:47:40 +0200 Message-Id: <20190404084549.188075259@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190404084545.245659903@linuxfoundation.org> References: <20190404084545.245659903@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit de9c0d49d85dc563549972edc5589d195cd5e859 ] While building arm32 allyesconfig, I ran into the following errors: arch/arm/lib/xor-neon.c:17:2: error: You should compile this file with '-mfloat-abi=softfp -mfpu=neon' In file included from lib/raid6/neon1.c:27: /home/nathan/cbl/prebuilt/lib/clang/8.0.0/include/arm_neon.h:28:2: error: "NEON support not enabled" Building V=1 showed NEON_FLAGS getting passed along to Clang but __ARM_NEON__ was not getting defined. Ultimately, it boils down to Clang only defining __ARM_NEON__ when targeting armv7, rather than armv6k, which is the '-march' value for allyesconfig. >From lib/Basic/Targets/ARM.cpp in the Clang source: // This only gets set when Neon instructions are actually available, unlike // the VFP define, hence the soft float and arch check. This is subtly // different from gcc, we follow the intent which was that it should be set // when Neon instructions are actually available. if ((FPU & NeonFPU) && !SoftFloat && ArchVersion >= 7) { Builder.defineMacro("__ARM_NEON", "1"); Builder.defineMacro("__ARM_NEON__"); // current AArch32 NEON implementations do not support double-precision // floating-point even when it is present in VFP. Builder.defineMacro("__ARM_NEON_FP", "0x" + Twine::utohexstr(HW_FP & ~HW_FP_DP)); } Ard Biesheuvel recommended explicitly adding '-march=armv7-a' at the beginning of the NEON_FLAGS definitions so that __ARM_NEON__ always gets definined by Clang. This doesn't functionally change anything because that code will only run where NEON is supported, which is implicitly armv7. Link: https://github.com/ClangBuiltLinux/linux/issues/287 Suggested-by: Ard Biesheuvel Signed-off-by: Nathan Chancellor Acked-by: Nicolas Pitre Reviewed-by: Nick Desaulniers Reviewed-by: Stefan Agner Signed-off-by: Russell King Signed-off-by: Sasha Levin --- Documentation/arm/kernel_mode_neon.txt | 4 ++-- arch/arm/lib/Makefile | 2 +- arch/arm/lib/xor-neon.c | 2 +- lib/raid6/Makefile | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Documentation/arm/kernel_mode_neon.txt b/Documentation/arm/kernel_mode_neon.txt index 525452726d31..b9e060c5b61e 100644 --- a/Documentation/arm/kernel_mode_neon.txt +++ b/Documentation/arm/kernel_mode_neon.txt @@ -6,7 +6,7 @@ TL;DR summary * Use only NEON instructions, or VFP instructions that don't rely on support code * Isolate your NEON code in a separate compilation unit, and compile it with - '-mfpu=neon -mfloat-abi=softfp' + '-march=armv7-a -mfpu=neon -mfloat-abi=softfp' * Put kernel_neon_begin() and kernel_neon_end() calls around the calls into your NEON code * Don't sleep in your NEON code, and be aware that it will be executed with @@ -87,7 +87,7 @@ instructions appearing in unexpected places if no special care is taken. Therefore, the recommended and only supported way of using NEON/VFP in the kernel is by adhering to the following rules: * isolate the NEON code in a separate compilation unit and compile it with - '-mfpu=neon -mfloat-abi=softfp'; + '-march=armv7-a -mfpu=neon -mfloat-abi=softfp'; * issue the calls to kernel_neon_begin(), kernel_neon_end() as well as the calls into the unit containing the NEON code from a compilation unit which is *not* built with the GCC flag '-mfpu=neon' set. diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile index 4cb0b9624d8f..4cf026f3f00d 100644 --- a/arch/arm/lib/Makefile +++ b/arch/arm/lib/Makefile @@ -39,7 +39,7 @@ $(obj)/csumpartialcopy.o: $(obj)/csumpartialcopygeneric.S $(obj)/csumpartialcopyuser.o: $(obj)/csumpartialcopygeneric.S ifeq ($(CONFIG_KERNEL_MODE_NEON),y) - NEON_FLAGS := -mfloat-abi=softfp -mfpu=neon + NEON_FLAGS := -march=armv7-a -mfloat-abi=softfp -mfpu=neon CFLAGS_xor-neon.o += $(NEON_FLAGS) obj-$(CONFIG_XOR_BLOCKS) += xor-neon.o endif diff --git a/arch/arm/lib/xor-neon.c b/arch/arm/lib/xor-neon.c index 2c40aeab3eaa..c691b901092f 100644 --- a/arch/arm/lib/xor-neon.c +++ b/arch/arm/lib/xor-neon.c @@ -14,7 +14,7 @@ MODULE_LICENSE("GPL"); #ifndef __ARM_NEON__ -#error You should compile this file with '-mfloat-abi=softfp -mfpu=neon' +#error You should compile this file with '-march=armv7-a -mfloat-abi=softfp -mfpu=neon' #endif /* diff --git a/lib/raid6/Makefile b/lib/raid6/Makefile index ad523be0313b..e0f3b38d6dcb 100644 --- a/lib/raid6/Makefile +++ b/lib/raid6/Makefile @@ -40,7 +40,7 @@ endif ifeq ($(CONFIG_KERNEL_MODE_NEON),y) NEON_FLAGS := -ffreestanding ifeq ($(ARCH),arm) -NEON_FLAGS += -mfloat-abi=softfp -mfpu=neon +NEON_FLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=neon endif CFLAGS_recov_neon_inner.o += $(NEON_FLAGS) ifeq ($(ARCH),arm64) -- 2.19.1