From patchwork Wed Nov 7 09:40:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Murzin X-Patchwork-Id: 10672059 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D8498109C for ; Wed, 7 Nov 2018 09:41:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C74332B936 for ; Wed, 7 Nov 2018 09:41:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB27B2B944; Wed, 7 Nov 2018 09:41:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 39D912B93F for ; Wed, 7 Nov 2018 09:41:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=y++myUW9pyQMMZZvB5LCfNiZxShPV6AN/9GL4jocWIU=; b=NWOsVHmNxuZQQxBY3eX+2G6otV 7Le+iqfAAPhQChZ9ZLBotwFX/EVZg7zmhIXVzWfz+hNGEs9HXXimlMMEZyd68ffb8u35cAVCBI8U7 WSHT0WDW+tMG1Rh0dTXovjTUknM1eM5RVIjVUZDAtX8SUdOJI+3VHfmWq71Wl/NLMwVv0py7sqf5a mMF5FL6A9jnqWKSY19bsQ3xl5ev03kzvwLuDsps4rB3ZW3mBhN8uIQEHkgVxn/262gwk6tuGMV9wv 9EyMpOV0NJAN4fLLzGJ9yIhrLz/5yWSlmMhXNHLiNeO5pqzeo6kTWtqYlmb/xiKD24kFy/Zpw8AVM CIFlv2lA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gKKKv-0000Cc-OU; Wed, 07 Nov 2018 09:41:21 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gKKKD-0007lJ-Jf for linux-arm-kernel@bombadil.infradead.org; Wed, 07 Nov 2018 09:40:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=B4f2RgVxEN3FhAkJ0lSvl6m+dNRFQ1U0KAtAKKvn7e8=; b=y04lJ4znZfeFLpqULT/+uqJlX lA0D6PsX42EhRVCE3XYQlApjIy4koNxD1rz7sPD65t6q21jg0H7Sty3y8fsJTEqtbdq1G5PKQ3We2 fVTCybs+jdtv5JTJ/M+/EPO+iOY1Ym+syyogMocviapzWZ6hOOIRXkSryYOW97Qa/C9ahmmmSEUwK q1GbBZ9YGdksV1lHipXDN89EDZErLZZ0Q3bYZh7W2Oj5fItfIA6SsdABl39vKnfuKGQ1gRLurEn7k xk+pw1BcevH2t5J2vZllnJ755xzXmyM8CZE0iIFqWvENTy0CR2llYxpLdtHuEQEdnXe/TeeUDbaF1 XNrR9XJSw==; Received: from foss.arm.com ([217.140.101.70]) by merlin.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gKKKA-0003je-TV for linux-arm-kernel@lists.infradead.org; Wed, 07 Nov 2018 09:40:35 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2DF3715BE; Wed, 7 Nov 2018 01:40:22 -0800 (PST) Received: from login2.euhpc.arm.com (login2.euhpc.arm.com [10.6.27.34]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E7E753F718; Wed, 7 Nov 2018 01:40:20 -0800 (PST) From: Vladimir Murzin To: linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 2/4] arm64: lse: expose dependency on gas via Kconfig Date: Wed, 7 Nov 2018 09:40:06 +0000 Message-Id: <1541583608-26375-3-git-send-email-vladimir.murzin@arm.com> X-Mailer: git-send-email 2.0.0 In-Reply-To: <1541583608-26375-1-git-send-email-vladimir.murzin@arm.com> References: <1541583608-26375-1-git-send-email-vladimir.murzin@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181107_044035_098864_2585A2D3 X-CRM114-Status: GOOD ( 15.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yamada.masahiro@socionext.com, kbuild-all@01.org, Will Deacon , linux-crypto@vger.kernel.org, linux-kbuild@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP So we can simply hide LSE support if dependency is not satisfied. Cc: Will Deacon Signed-off-by: Vladimir Murzin --- arch/arm64/Kconfig | 1 + arch/arm64/Makefile | 13 ++----------- arch/arm64/include/asm/atomic.h | 2 +- arch/arm64/include/asm/lse.h | 6 +++--- arch/arm64/kernel/cpufeature.c | 4 ++-- 5 files changed, 9 insertions(+), 17 deletions(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 964f682..7978aee 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -1072,6 +1072,7 @@ config ARM64_PAN config ARM64_LSE_ATOMICS bool "Atomic instructions" default y + depends on $(as-instr,.arch_extension lse) help As part of the Large System Extensions, ARMv8.1 introduces new atomic instructions that are designed specifically to scale in diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile index b4e994c..3054757 100644 --- a/arch/arm64/Makefile +++ b/arch/arm64/Makefile @@ -32,15 +32,6 @@ endif KBUILD_DEFCONFIG := defconfig -# Check for binutils support for specific extensions -lseinstr := $(call as-instr,.arch_extension lse,-DCONFIG_AS_LSE=1) - -ifeq ($(CONFIG_ARM64_LSE_ATOMICS), y) - ifeq ($(lseinstr),) -$(warning LSE atomics not supported by binutils) - endif -endif - ifeq ($(CONFIG_ARM64), y) brokengasinst := $(call as-instr,1:\n.inst 0\n.rept . - 1b\n\nnop\n.endr\n,,-DCONFIG_BROKEN_GAS_INST=1) @@ -49,9 +40,9 @@ $(warning Detected assembler with broken .inst; disassembly will be unreliable) endif endif -KBUILD_CFLAGS += -mgeneral-regs-only $(lseinstr) $(brokengasinst) +KBUILD_CFLAGS += -mgeneral-regs-only $(brokengasinst) KBUILD_CFLAGS += -fno-asynchronous-unwind-tables -KBUILD_AFLAGS += $(lseinstr) $(brokengasinst) +KBUILD_AFLAGS += $(brokengasinst) KBUILD_CFLAGS += $(call cc-option,-mabi=lp64) KBUILD_AFLAGS += $(call cc-option,-mabi=lp64) diff --git a/arch/arm64/include/asm/atomic.h b/arch/arm64/include/asm/atomic.h index 9bca54d..9d8d029 100644 --- a/arch/arm64/include/asm/atomic.h +++ b/arch/arm64/include/asm/atomic.h @@ -30,7 +30,7 @@ #define __ARM64_IN_ATOMIC_IMPL -#if defined(CONFIG_ARM64_LSE_ATOMICS) && defined(CONFIG_AS_LSE) +#ifdef CONFIG_ARM64_LSE_ATOMICS #include #else #include diff --git a/arch/arm64/include/asm/lse.h b/arch/arm64/include/asm/lse.h index 8262325..1fd31c7 100644 --- a/arch/arm64/include/asm/lse.h +++ b/arch/arm64/include/asm/lse.h @@ -2,7 +2,7 @@ #ifndef __ASM_LSE_H #define __ASM_LSE_H -#if defined(CONFIG_AS_LSE) && defined(CONFIG_ARM64_LSE_ATOMICS) +#ifdef CONFIG_ARM64_LSE_ATOMICS #include #include @@ -36,7 +36,7 @@ ALTERNATIVE(llsc, lse, ARM64_HAS_LSE_ATOMICS) #endif /* __ASSEMBLER__ */ -#else /* CONFIG_AS_LSE && CONFIG_ARM64_LSE_ATOMICS */ +#else /* CONFIG_ARM64_LSE_ATOMICS */ #ifdef __ASSEMBLER__ @@ -53,5 +53,5 @@ #define ARM64_LSE_ATOMIC_INSN(llsc, lse) llsc #endif /* __ASSEMBLER__ */ -#endif /* CONFIG_AS_LSE && CONFIG_ARM64_LSE_ATOMICS */ +#endif /* CONFIG_ARM64_LSE_ATOMICS */ #endif /* __ASM_LSE_H */ diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 74e9dcb..46f1bac 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -1170,7 +1170,7 @@ static void cpu_clear_disr(const struct arm64_cpu_capabilities *__unused) .cpu_enable = cpu_enable_pan, }, #endif /* CONFIG_ARM64_PAN */ -#if defined(CONFIG_AS_LSE) && defined(CONFIG_ARM64_LSE_ATOMICS) +#ifdef CONFIG_ARM64_LSE_ATOMICS { .desc = "LSE atomic instructions", .capability = ARM64_HAS_LSE_ATOMICS, @@ -1181,7 +1181,7 @@ static void cpu_clear_disr(const struct arm64_cpu_capabilities *__unused) .sign = FTR_UNSIGNED, .min_field_value = 2, }, -#endif /* CONFIG_AS_LSE && CONFIG_ARM64_LSE_ATOMICS */ +#endif /* CONFIG_ARM64_LSE_ATOMICS */ { .desc = "Software prefetching using PRFM", .capability = ARM64_HAS_NO_HW_PREFETCH,