Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp997915yba; Thu, 4 Apr 2019 02:04:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqye6vlW7491skolmrVQMxdla9hkTUqE1IH30tsFOQ8ANGsFKkQ61i1ar+xNbqFURv7pUf93 X-Received: by 2002:a17:902:2a89:: with SMTP id j9mr5185301plb.272.1554368668083; Thu, 04 Apr 2019 02:04:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554368668; cv=none; d=google.com; s=arc-20160816; b=filgfnyybdus+fOy/NX+vt9jrwFOZCLJF04SbbBx676VRkJ0W3V464G4S0/khElMlX me/87Jok+VOZXGtx7pBSIbZuFdjrV+rH/qpNmSOap7enFh+ddfe16qWCrNa38vs4rGSS UaeV/Q1EuGsp32q6PetEvP3Ila9r9O9Ohsm0831SN5HT4AlaQM0pyqyUnuZIsAQ7Qt/K a9e9lNSWFOL9wh2GLmSKzKV+EmnIWT0amP4YwMIGS7qK0Xhc0w/6PRSlaNqsDJ/upfUl mbk8OhDVwF7WJPj+Im3ERmZ7/g6G+fXK5zfGChvJM7pR/yJvtvthkPg9HlJXSWn4YoGk g/ZQ== 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=TmtoZDb2ChnXr/s6Gk5t+dcZxEdje8LRPAc2de9RYdQ=; b=LQr/gpT/2DmvRfeICjJ2tuH8Z1HOZcD6YlTgvBOtqBV/nea8kFRtMDy7rOOGSdPn/K T/XZcbiCCrNiPkJCfai4HxmWW9DtOuarW+rH4jzEpi2zWe5Fj0RWSs2kKfA6oMOzTSKi wnlWvMp/QDB8C7KmOAKa8A9ZPmtEf/AoqDeJDJMpLsk6+ngKqno6/hjm7Eju67+oddeY l7QSRbd7rE+CIOBPOjvdrGKi3f6/Ei8J/wLf/bAHqI9R29uOxj34l9i4TkUr2ryMq1Kw uoBA/7fs82SvIE2rjCoC9hG1vkQ3q42d36CzzhWRZPdfPU85Hb8Yy6hXfrMXSv2JK8xP 6Riw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QI9T1utW; 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 k126si15790991pgk.109.2019.04.04.02.04.12; Thu, 04 Apr 2019 02:04:28 -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=QI9T1utW; 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 S1731583AbfDDJDj (ORCPT + 99 others); Thu, 4 Apr 2019 05:03:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:41318 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730336AbfDDJDh (ORCPT ); Thu, 4 Apr 2019 05:03: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 06CFA218C3; Thu, 4 Apr 2019 09:03:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554368616; bh=rmuXzoWvkZUn5Hl8/veqIe2B1lvgxyErzhATU+0rZrY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QI9T1utW7vbUrH+CFsxGxAgGMfbJ9kvv1P5iVToLM7+dRhHwC0TAoiaPidl51lWGt z82OEO13wmLwq7rP8yPSDw/DQPxoO9tPVaVy3rWmX5b2k0LrgnZAi30YlrmEiamYe4 gizcgJRuNtROtPJRX+oZuCX9CtStynw36UAdraRY= 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.19 105/187] ARM: 8833/1: Ensure that NEON code always compiles with Clang Date: Thu, 4 Apr 2019 10:47:22 +0200 Message-Id: <20190404084608.196931443@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190404084603.119654039@linuxfoundation.org> References: <20190404084603.119654039@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.19-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 ad25fd1872c7..0bff0176db2c 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 7ed43eaa02ef..5e0d55c54100 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