From mboxrd@z Thu Jan 1 00:00:00 1970 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=-7.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED 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 95DD0C10F03 for ; Tue, 23 Apr 2019 20:19:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4970A208E4 for ; Tue, 23 Apr 2019 20:19:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=agner.ch header.i=@agner.ch header.b="LlPsVx3/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727322AbfDWUT4 (ORCPT ); Tue, 23 Apr 2019 16:19:56 -0400 Received: from mail.kmu-office.ch ([178.209.48.109]:36984 "EHLO mail.kmu-office.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726088AbfDWUTz (ORCPT ); Tue, 23 Apr 2019 16:19:55 -0400 Received: from webmail.kmu-office.ch (unknown [IPv6:2a02:418:6a02::a3]) by mail.kmu-office.ch (Postfix) with ESMTPSA id E262D5C1EBF; Tue, 23 Apr 2019 22:19:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1556050790; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pA15yy7/STfrhzuYJLZPf/C6z5t8qWv6rQv9NMaeUNM=; b=LlPsVx3/B38n4ew3BIO7VmHg7TamhFKZMi903yFec621NKeF2urPiPqTcpnA0eU0Y9gbP1 tRgkGdayHPRzrZKzJDJ6iz9SaRFaeqsvVyAIdEBqjtwNp11psBHyBFVD8C2u+VmvLEQD+R OlrsHKN4TZ9NvKcKq2DTBftqciNsrLQ= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Date: Tue, 23 Apr 2019 22:19:50 +0200 From: Stefan Agner To: arnd@arndb.de, arm@kernel.org, tony@atomide.com Cc: linux@armlinux.org.uk, ard.biesheuvel@linaro.org, robin.murphy@arm.com, nicolas.pitre@linaro.org, f.fainelli@gmail.com, rjui@broadcom.com, sbranden@broadcom.com, bcm-kernel-feedback-list@broadcom.com, kgene@kernel.org, krzk@kernel.org, robh@kernel.org, ssantosh@kernel.org, jason@lakedaemon.net, andrew@lunn.ch, gregory.clement@bootlin.com, sebastian.hesselbarth@gmail.com, marc.w.gonzalez@free.fr, mans@mansr.com, ndesaulniers@google.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 1/4] ARM: use arch_extension directive instead of arch argument In-Reply-To: References: Message-ID: <2f3d0fa7ba599f46960ad3e7419477fd@agner.ch> X-Sender: stefan@agner.ch User-Agent: Roundcube Webmail/1.3.7 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11.04.2019 09:54, Stefan Agner wrote: > The LLVM Target parser currently does not allow to specify the security > extension as part of -march (see also LLVM Bug 40186 [0]). When trying > to use Clang with LLVM's integrated assembler, this leads to build > errors such as this: > clang-8: error: the clang compiler does not support '-Wa,-march=armv7-a+sec' > > Use ".arch_extension sec" to enable the security extension in a more > portable fasion. Also make sure to use ".arch armv7-a" in case a v6/v7 > multi-platform kernel is being built. > > Note that this is technically not exactly the same as the old code > checked for availabilty of the security extension by calling as-instr. > However, there are already other sites which use ".arch_extension sec" > unconditionally, hence de-facto we need an assembler capable of > ".arch_extension sec" already today (arch/arm/mm/proc-v7.S). The > arch extension "sec" is available since binutils 2.21 according to > its documentation [1]. > > [0] https://bugs.llvm.org/show_bug.cgi?id=40186 > [1] https://sourceware.org/binutils/docs-2.21/as/ARM-Options.html > > Signed-off-by: Stefan Agner > Acked-by: Mans Rullgard > Acked-by: Arnd Bergmann > Acked-by: Krzysztof Kozlowski Arnd, Tony, Patch 3 and 4 got merged by Gregory. I think the other two patches are ready to be merged too. I think they should go in together to avoid merge conflicts. Tony, if you agree, can you Ack patch 2 so they can get merged through arm-soc? -- Stefan > --- > Changes since v1: > - Explicitly specify assembler architecture as armv7-a to avoid > build issues when bulding v6/v7 multi arch kernel. > > Changes since v2: > - Add armv7-a also in mach-tango > - Move .arch armv7-a outside of ifdef'ed area in sleep44xx.S > to make the kernel compile also without CONFIG_SMP/PM. > > arch/arm/mach-bcm/Makefile | 3 --- > arch/arm/mach-bcm/bcm_kona_smc.c | 2 -- > arch/arm/mach-exynos/Makefile | 4 ---- > arch/arm/mach-exynos/exynos-smc.S | 3 ++- > arch/arm/mach-exynos/sleep.S | 3 ++- > arch/arm/mach-highbank/Makefile | 3 --- > arch/arm/mach-highbank/smc.S | 3 ++- > arch/arm/mach-keystone/Makefile | 3 --- > arch/arm/mach-keystone/smc.S | 1 + > arch/arm/mach-omap2/Makefile | 8 -------- > arch/arm/mach-omap2/omap-headsmp.S | 2 ++ > arch/arm/mach-omap2/omap-smc.S | 3 ++- > arch/arm/mach-omap2/sleep33xx.S | 1 + > arch/arm/mach-omap2/sleep34xx.S | 2 ++ > arch/arm/mach-omap2/sleep43xx.S | 2 ++ > arch/arm/mach-omap2/sleep44xx.S | 3 +++ > arch/arm/mach-tango/Makefile | 3 --- > arch/arm/mach-tango/smc.S | 2 ++ > 18 files changed, 21 insertions(+), 30 deletions(-) > > diff --git a/arch/arm/mach-bcm/Makefile b/arch/arm/mach-bcm/Makefile > index 8fd23b263c60..b59c813b1af4 100644 > --- a/arch/arm/mach-bcm/Makefile > +++ b/arch/arm/mach-bcm/Makefile > @@ -40,9 +40,6 @@ obj-$(CONFIG_ARCH_BCM_MOBILE_L2_CACHE) += kona_l2_cache.o > > # Support for secure monitor traps > obj-$(CONFIG_ARCH_BCM_MOBILE_SMC) += bcm_kona_smc.o > -ifeq ($(call as-instr,.arch_extension sec,as_has_sec),as_has_sec) > -CFLAGS_bcm_kona_smc.o += -Wa,-march=armv7-a+sec -DREQUIRES_SEC > -endif > > # BCM2835 > obj-$(CONFIG_ARCH_BCM2835) += board_bcm2835.o > diff --git a/arch/arm/mach-bcm/bcm_kona_smc.c b/arch/arm/mach-bcm/bcm_kona_smc.c > index a55a7ecf146a..541e850a736c 100644 > --- a/arch/arm/mach-bcm/bcm_kona_smc.c > +++ b/arch/arm/mach-bcm/bcm_kona_smc.c > @@ -125,9 +125,7 @@ static int bcm_kona_do_smc(u32 service_id, u32 buffer_phys) > __asmeq("%2", "r4") > __asmeq("%3", "r5") > __asmeq("%4", "r6") > -#ifdef REQUIRES_SEC > ".arch_extension sec\n" > -#endif > " smc #0\n" > : "=r" (ip), "=r" (r0) > : "r" (r4), "r" (r5), "r" (r6) > diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile > index cd00c82a1add..44de9f36fd1b 100644 > --- a/arch/arm/mach-exynos/Makefile > +++ b/arch/arm/mach-exynos/Makefile > @@ -14,9 +14,5 @@ obj-$(CONFIG_PM_SLEEP) += suspend.o > > obj-$(CONFIG_SMP) += platsmp.o headsmp.o > > -plus_sec := $(call as-instr,.arch_extension sec,+sec) > -AFLAGS_exynos-smc.o :=-Wa,-march=armv7-a$(plus_sec) > -AFLAGS_sleep.o :=-Wa,-march=armv7-a$(plus_sec) > - > obj-$(CONFIG_EXYNOS5420_MCPM) += mcpm-exynos.o > CFLAGS_mcpm-exynos.o += -march=armv7-a > diff --git a/arch/arm/mach-exynos/exynos-smc.S > b/arch/arm/mach-exynos/exynos-smc.S > index d259532ba937..6da31e6a7acb 100644 > --- a/arch/arm/mach-exynos/exynos-smc.S > +++ b/arch/arm/mach-exynos/exynos-smc.S > @@ -10,7 +10,8 @@ > /* > * Function signature: void exynos_smc(u32 cmd, u32 arg1, u32 arg2, u32 arg3) > */ > - > + .arch armv7-a > + .arch_extension sec > ENTRY(exynos_smc) > stmfd sp!, {r4-r11, lr} > dsb > diff --git a/arch/arm/mach-exynos/sleep.S b/arch/arm/mach-exynos/sleep.S > index 2783c3a0c06a..ed93f91853b8 100644 > --- a/arch/arm/mach-exynos/sleep.S > +++ b/arch/arm/mach-exynos/sleep.S > @@ -44,7 +44,8 @@ ENTRY(exynos_cpu_resume) > ENDPROC(exynos_cpu_resume) > > .align > - > + .arch armv7-a > + .arch_extension sec > ENTRY(exynos_cpu_resume_ns) > mrc p15, 0, r0, c0, c0, 0 > ldr r1, =CPU_MASK > diff --git a/arch/arm/mach-highbank/Makefile b/arch/arm/mach-highbank/Makefile > index 55840f414d3e..e7741b883d13 100644 > --- a/arch/arm/mach-highbank/Makefile > +++ b/arch/arm/mach-highbank/Makefile > @@ -1,6 +1,3 @@ > obj-y := highbank.o system.o smc.o > > -plus_sec := $(call as-instr,.arch_extension sec,+sec) > -AFLAGS_smc.o :=-Wa,-march=armv7-a$(plus_sec) > - > obj-$(CONFIG_PM_SLEEP) += pm.o > diff --git a/arch/arm/mach-highbank/smc.S b/arch/arm/mach-highbank/smc.S > index 407d17baaaa9..860a79135b7b 100644 > --- a/arch/arm/mach-highbank/smc.S > +++ b/arch/arm/mach-highbank/smc.S > @@ -16,7 +16,8 @@ > * the monitor API number. > * Function signature : void highbank_smc1(u32 fn, u32 arg) > */ > - > + .arch armv7-a > + .arch_extension sec > ENTRY(highbank_smc1) > stmfd sp!, {r4-r11, lr} > mov r12, r0 > diff --git a/arch/arm/mach-keystone/Makefile b/arch/arm/mach-keystone/Makefile > index f8b0dccac8dc..739b38be5696 100644 > --- a/arch/arm/mach-keystone/Makefile > +++ b/arch/arm/mach-keystone/Makefile > @@ -1,9 +1,6 @@ > # SPDX-License-Identifier: GPL-2.0 > obj-y := keystone.o smc.o > > -plus_sec := $(call as-instr,.arch_extension sec,+sec) > -AFLAGS_smc.o :=-Wa,-march=armv7-a$(plus_sec) > - > obj-$(CONFIG_SMP) += platsmp.o > > # PM domain driver for Keystone SOCs > diff --git a/arch/arm/mach-keystone/smc.S b/arch/arm/mach-keystone/smc.S > index d15de8179fab..ec03dc499270 100644 > --- a/arch/arm/mach-keystone/smc.S > +++ b/arch/arm/mach-keystone/smc.S > @@ -21,6 +21,7 @@ > * > * Return: Non zero value on failure > */ > + .arch_extension sec > ENTRY(keystone_cpu_smc) > stmfd sp!, {r4-r11, lr} > smc #0 > diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile > index 85d1b13c9215..f1d283995b31 100644 > --- a/arch/arm/mach-omap2/Makefile > +++ b/arch/arm/mach-omap2/Makefile > @@ -41,11 +41,6 @@ obj-$(CONFIG_SOC_OMAP5) += $(omap-4-5-common) > $(smp-y) sleep44xx.o > obj-$(CONFIG_SOC_AM43XX) += $(omap-4-5-common) > obj-$(CONFIG_SOC_DRA7XX) += $(omap-4-5-common) $(smp-y) sleep44xx.o > > -plus_sec := $(call as-instr,.arch_extension sec,+sec) > -AFLAGS_omap-headsmp.o :=-Wa,-march=armv7-a$(plus_sec) > -AFLAGS_omap-smc.o :=-Wa,-march=armv7-a$(plus_sec) > -AFLAGS_sleep44xx.o :=-Wa,-march=armv7-a$(plus_sec) > - > # Functions loaded to SRAM > obj-$(CONFIG_SOC_OMAP2420) += sram242x.o > obj-$(CONFIG_SOC_OMAP2430) += sram243x.o > @@ -95,9 +90,6 @@ obj-$(CONFIG_POWER_AVS_OMAP) += sr_device.o > obj-$(CONFIG_POWER_AVS_OMAP_CLASS3) += smartreflex-class3.o > > AFLAGS_sleep24xx.o :=-Wa,-march=armv6 > -AFLAGS_sleep34xx.o :=-Wa,-march=armv7-a$(plus_sec) > -AFLAGS_sleep33xx.o :=-Wa,-march=armv7-a$(plus_sec) > -AFLAGS_sleep43xx.o :=-Wa,-march=armv7-a$(plus_sec) > > endif > > diff --git a/arch/arm/mach-omap2/omap-headsmp.S > b/arch/arm/mach-omap2/omap-headsmp.S > index 4c6f14cf92a8..b26c0daaa3c1 100644 > --- a/arch/arm/mach-omap2/omap-headsmp.S > +++ b/arch/arm/mach-omap2/omap-headsmp.S > @@ -58,6 +58,8 @@ ENDPROC(omap5_secondary_startup) > * omap5_secondary_startup if the primary CPU was put into HYP mode by > * the boot loader. > */ > + .arch armv7-a > + .arch_extension sec > ENTRY(omap5_secondary_hyp_startup) > wait_2: ldr r2, =AUX_CORE_BOOT0_PA @ read from AuxCoreBoot0 > ldr r0, [r2] > diff --git a/arch/arm/mach-omap2/omap-smc.S b/arch/arm/mach-omap2/omap-smc.S > index 72506e6cf9e7..a14aee5e81d1 100644 > --- a/arch/arm/mach-omap2/omap-smc.S > +++ b/arch/arm/mach-omap2/omap-smc.S > @@ -23,7 +23,8 @@ > * link register "lr". > * Function signature : void omap_smc1(u32 fn, u32 arg) > */ > - > + .arch armv7-a > + .arch_extension sec > ENTRY(omap_smc1) > stmfd sp!, {r2-r12, lr} > mov r12, r0 > diff --git a/arch/arm/mach-omap2/sleep33xx.S b/arch/arm/mach-omap2/sleep33xx.S > index 47a816468cdb..68fee339d3f1 100644 > --- a/arch/arm/mach-omap2/sleep33xx.S > +++ b/arch/arm/mach-omap2/sleep33xx.S > @@ -24,6 +24,7 @@ > #define BIT(nr) (1 << (nr)) > > .arm > + .arch armv7-a > .align 3 > > ENTRY(am33xx_do_wfi) > diff --git a/arch/arm/mach-omap2/sleep34xx.S b/arch/arm/mach-omap2/sleep34xx.S > index 22daf4efed68..4927304b5902 100644 > --- a/arch/arm/mach-omap2/sleep34xx.S > +++ b/arch/arm/mach-omap2/sleep34xx.S > @@ -97,6 +97,8 @@ ENDPROC(enable_omap3630_toggle_l2_on_restore) > * > * r0 = physical address of the parameters > */ > + .arch armv7-a > + .arch_extension sec > ENTRY(save_secure_ram_context) > stmfd sp!, {r4 - r11, lr} @ save registers on stack > mov r3, r0 @ physical address of parameters > diff --git a/arch/arm/mach-omap2/sleep43xx.S b/arch/arm/mach-omap2/sleep43xx.S > index 5b9343b58fc7..31dda92d9d03 100644 > --- a/arch/arm/mach-omap2/sleep43xx.S > +++ b/arch/arm/mach-omap2/sleep43xx.S > @@ -56,6 +56,8 @@ > #define RTC_PMIC_EXT_WAKEUP_EN BIT(0) > > .arm > + .arch armv7-a > + .arch_extension sec > .align 3 > > ENTRY(am43xx_do_wfi) > diff --git a/arch/arm/mach-omap2/sleep44xx.S b/arch/arm/mach-omap2/sleep44xx.S > index 0cae3b070208..fb559d3de1f2 100644 > --- a/arch/arm/mach-omap2/sleep44xx.S > +++ b/arch/arm/mach-omap2/sleep44xx.S > @@ -21,8 +21,11 @@ > #include "omap44xx.h" > #include "omap4-sar-layout.h" > > + .arch armv7-a > + > #if defined(CONFIG_SMP) && defined(CONFIG_PM) > > + .arch_extension sec > .macro DO_SMC > dsb > smc #0 > diff --git a/arch/arm/mach-tango/Makefile b/arch/arm/mach-tango/Makefile > index da6c633d3cc0..97cd04508fa1 100644 > --- a/arch/arm/mach-tango/Makefile > +++ b/arch/arm/mach-tango/Makefile > @@ -1,7 +1,4 @@ > # SPDX-License-Identifier: GPL-2.0 > -plus_sec := $(call as-instr,.arch_extension sec,+sec) > -AFLAGS_smc.o := -Wa,-march=armv7-a$(plus_sec) > - > obj-y += setup.o smc.o > obj-$(CONFIG_SMP) += platsmp.o > obj-$(CONFIG_SUSPEND) += pm.o > diff --git a/arch/arm/mach-tango/smc.S b/arch/arm/mach-tango/smc.S > index 361a8dc89804..b1752aaa72bc 100644 > --- a/arch/arm/mach-tango/smc.S > +++ b/arch/arm/mach-tango/smc.S > @@ -1,6 +1,8 @@ > /* SPDX-License-Identifier: GPL-2.0 */ > #include > > + .arch armv7-a > + .arch_extension sec > ENTRY(tango_smc) > push {lr} > mov ip, r1 From mboxrd@z Thu Jan 1 00:00:00 1970 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=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 4B914C282DD for ; Tue, 23 Apr 2019 20:20:16 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 188A8208E4 for ; Tue, 23 Apr 2019 20:20:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mQpEbrSH"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=agner.ch header.i=@agner.ch header.b="LlPsVx3/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 188A8208E4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=agner.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Message-ID:References:In-Reply-To: Subject:To:From:Date:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RN78QfMgZppQltoEMaojYjxG+y51V1Laluen9WHY1a0=; b=mQpEbrSHciwT50 dZypibKNDIURd/2QkFY/lmQKo/HEbYEf2zLeOlliKmJmnYqfyXmBasbFHCmy9XuvJFjuTkoRxAFDl 6oJCRd9yEr7BFAARb54s4pgfbzMRWDNzJzv5PHqJfy+/oIr0soK6s2x7tJb4ZyRmX9GhpE07ydHYm aTPziPBR8+XQw5sDuOXOmZkbkLngjcPEpY7ia0leFH/YS0S7QbvEbCzwrJl/BqheXiS54G3tqUCtJ BG1+DWlgksea/M+z9uEU6gTid+olSlP9bPPljkifuy8GTBuGVL4dxXh9/nYaj/nZ48nH8WAucqQhJ 47+UFzatu2qsRCc/M5yw==; 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 1hJ1tZ-0001wZ-9g; Tue, 23 Apr 2019 20:20:01 +0000 Received: from mail.kmu-office.ch ([2a02:418:6a02::a2]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hJ1tU-0001vr-DB for linux-arm-kernel@lists.infradead.org; Tue, 23 Apr 2019 20:19:59 +0000 Received: from webmail.kmu-office.ch (unknown [IPv6:2a02:418:6a02::a3]) by mail.kmu-office.ch (Postfix) with ESMTPSA id E262D5C1EBF; Tue, 23 Apr 2019 22:19:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1556050790; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pA15yy7/STfrhzuYJLZPf/C6z5t8qWv6rQv9NMaeUNM=; b=LlPsVx3/B38n4ew3BIO7VmHg7TamhFKZMi903yFec621NKeF2urPiPqTcpnA0eU0Y9gbP1 tRgkGdayHPRzrZKzJDJ6iz9SaRFaeqsvVyAIdEBqjtwNp11psBHyBFVD8C2u+VmvLEQD+R OlrsHKN4TZ9NvKcKq2DTBftqciNsrLQ= MIME-Version: 1.0 Date: Tue, 23 Apr 2019 22:19:50 +0200 From: Stefan Agner To: arnd@arndb.de, arm@kernel.org, tony@atomide.com Subject: Re: [PATCH v3 1/4] ARM: use arch_extension directive instead of arch argument In-Reply-To: References: Message-ID: <2f3d0fa7ba599f46960ad3e7419477fd@agner.ch> X-Sender: stefan@agner.ch User-Agent: Roundcube Webmail/1.3.7 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190423_131957_411419_BFB89E3F X-CRM114-Status: GOOD ( 22.98 ) 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: nicolas.pitre@linaro.org, robh@kernel.org, f.fainelli@gmail.com, mans@mansr.com, jason@lakedaemon.net, sbranden@broadcom.com, ard.biesheuvel@linaro.org, rjui@broadcom.com, gregory.clement@bootlin.com, marc.w.gonzalez@free.fr, ndesaulniers@google.com, linux@armlinux.org.uk, krzk@kernel.org, linux-kernel@vger.kernel.org, andrew@lunn.ch, kgene@kernel.org, bcm-kernel-feedback-list@broadcom.com, ssantosh@kernel.org, robin.murphy@arm.com, linux-arm-kernel@lists.infradead.org, sebastian.hesselbarth@gmail.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 11.04.2019 09:54, Stefan Agner wrote: > The LLVM Target parser currently does not allow to specify the security > extension as part of -march (see also LLVM Bug 40186 [0]). When trying > to use Clang with LLVM's integrated assembler, this leads to build > errors such as this: > clang-8: error: the clang compiler does not support '-Wa,-march=armv7-a+sec' > > Use ".arch_extension sec" to enable the security extension in a more > portable fasion. Also make sure to use ".arch armv7-a" in case a v6/v7 > multi-platform kernel is being built. > > Note that this is technically not exactly the same as the old code > checked for availabilty of the security extension by calling as-instr. > However, there are already other sites which use ".arch_extension sec" > unconditionally, hence de-facto we need an assembler capable of > ".arch_extension sec" already today (arch/arm/mm/proc-v7.S). The > arch extension "sec" is available since binutils 2.21 according to > its documentation [1]. > > [0] https://bugs.llvm.org/show_bug.cgi?id=40186 > [1] https://sourceware.org/binutils/docs-2.21/as/ARM-Options.html > > Signed-off-by: Stefan Agner > Acked-by: Mans Rullgard > Acked-by: Arnd Bergmann > Acked-by: Krzysztof Kozlowski Arnd, Tony, Patch 3 and 4 got merged by Gregory. I think the other two patches are ready to be merged too. I think they should go in together to avoid merge conflicts. Tony, if you agree, can you Ack patch 2 so they can get merged through arm-soc? -- Stefan > --- > Changes since v1: > - Explicitly specify assembler architecture as armv7-a to avoid > build issues when bulding v6/v7 multi arch kernel. > > Changes since v2: > - Add armv7-a also in mach-tango > - Move .arch armv7-a outside of ifdef'ed area in sleep44xx.S > to make the kernel compile also without CONFIG_SMP/PM. > > arch/arm/mach-bcm/Makefile | 3 --- > arch/arm/mach-bcm/bcm_kona_smc.c | 2 -- > arch/arm/mach-exynos/Makefile | 4 ---- > arch/arm/mach-exynos/exynos-smc.S | 3 ++- > arch/arm/mach-exynos/sleep.S | 3 ++- > arch/arm/mach-highbank/Makefile | 3 --- > arch/arm/mach-highbank/smc.S | 3 ++- > arch/arm/mach-keystone/Makefile | 3 --- > arch/arm/mach-keystone/smc.S | 1 + > arch/arm/mach-omap2/Makefile | 8 -------- > arch/arm/mach-omap2/omap-headsmp.S | 2 ++ > arch/arm/mach-omap2/omap-smc.S | 3 ++- > arch/arm/mach-omap2/sleep33xx.S | 1 + > arch/arm/mach-omap2/sleep34xx.S | 2 ++ > arch/arm/mach-omap2/sleep43xx.S | 2 ++ > arch/arm/mach-omap2/sleep44xx.S | 3 +++ > arch/arm/mach-tango/Makefile | 3 --- > arch/arm/mach-tango/smc.S | 2 ++ > 18 files changed, 21 insertions(+), 30 deletions(-) > > diff --git a/arch/arm/mach-bcm/Makefile b/arch/arm/mach-bcm/Makefile > index 8fd23b263c60..b59c813b1af4 100644 > --- a/arch/arm/mach-bcm/Makefile > +++ b/arch/arm/mach-bcm/Makefile > @@ -40,9 +40,6 @@ obj-$(CONFIG_ARCH_BCM_MOBILE_L2_CACHE) += kona_l2_cache.o > > # Support for secure monitor traps > obj-$(CONFIG_ARCH_BCM_MOBILE_SMC) += bcm_kona_smc.o > -ifeq ($(call as-instr,.arch_extension sec,as_has_sec),as_has_sec) > -CFLAGS_bcm_kona_smc.o += -Wa,-march=armv7-a+sec -DREQUIRES_SEC > -endif > > # BCM2835 > obj-$(CONFIG_ARCH_BCM2835) += board_bcm2835.o > diff --git a/arch/arm/mach-bcm/bcm_kona_smc.c b/arch/arm/mach-bcm/bcm_kona_smc.c > index a55a7ecf146a..541e850a736c 100644 > --- a/arch/arm/mach-bcm/bcm_kona_smc.c > +++ b/arch/arm/mach-bcm/bcm_kona_smc.c > @@ -125,9 +125,7 @@ static int bcm_kona_do_smc(u32 service_id, u32 buffer_phys) > __asmeq("%2", "r4") > __asmeq("%3", "r5") > __asmeq("%4", "r6") > -#ifdef REQUIRES_SEC > ".arch_extension sec\n" > -#endif > " smc #0\n" > : "=r" (ip), "=r" (r0) > : "r" (r4), "r" (r5), "r" (r6) > diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile > index cd00c82a1add..44de9f36fd1b 100644 > --- a/arch/arm/mach-exynos/Makefile > +++ b/arch/arm/mach-exynos/Makefile > @@ -14,9 +14,5 @@ obj-$(CONFIG_PM_SLEEP) += suspend.o > > obj-$(CONFIG_SMP) += platsmp.o headsmp.o > > -plus_sec := $(call as-instr,.arch_extension sec,+sec) > -AFLAGS_exynos-smc.o :=-Wa,-march=armv7-a$(plus_sec) > -AFLAGS_sleep.o :=-Wa,-march=armv7-a$(plus_sec) > - > obj-$(CONFIG_EXYNOS5420_MCPM) += mcpm-exynos.o > CFLAGS_mcpm-exynos.o += -march=armv7-a > diff --git a/arch/arm/mach-exynos/exynos-smc.S > b/arch/arm/mach-exynos/exynos-smc.S > index d259532ba937..6da31e6a7acb 100644 > --- a/arch/arm/mach-exynos/exynos-smc.S > +++ b/arch/arm/mach-exynos/exynos-smc.S > @@ -10,7 +10,8 @@ > /* > * Function signature: void exynos_smc(u32 cmd, u32 arg1, u32 arg2, u32 arg3) > */ > - > + .arch armv7-a > + .arch_extension sec > ENTRY(exynos_smc) > stmfd sp!, {r4-r11, lr} > dsb > diff --git a/arch/arm/mach-exynos/sleep.S b/arch/arm/mach-exynos/sleep.S > index 2783c3a0c06a..ed93f91853b8 100644 > --- a/arch/arm/mach-exynos/sleep.S > +++ b/arch/arm/mach-exynos/sleep.S > @@ -44,7 +44,8 @@ ENTRY(exynos_cpu_resume) > ENDPROC(exynos_cpu_resume) > > .align > - > + .arch armv7-a > + .arch_extension sec > ENTRY(exynos_cpu_resume_ns) > mrc p15, 0, r0, c0, c0, 0 > ldr r1, =CPU_MASK > diff --git a/arch/arm/mach-highbank/Makefile b/arch/arm/mach-highbank/Makefile > index 55840f414d3e..e7741b883d13 100644 > --- a/arch/arm/mach-highbank/Makefile > +++ b/arch/arm/mach-highbank/Makefile > @@ -1,6 +1,3 @@ > obj-y := highbank.o system.o smc.o > > -plus_sec := $(call as-instr,.arch_extension sec,+sec) > -AFLAGS_smc.o :=-Wa,-march=armv7-a$(plus_sec) > - > obj-$(CONFIG_PM_SLEEP) += pm.o > diff --git a/arch/arm/mach-highbank/smc.S b/arch/arm/mach-highbank/smc.S > index 407d17baaaa9..860a79135b7b 100644 > --- a/arch/arm/mach-highbank/smc.S > +++ b/arch/arm/mach-highbank/smc.S > @@ -16,7 +16,8 @@ > * the monitor API number. > * Function signature : void highbank_smc1(u32 fn, u32 arg) > */ > - > + .arch armv7-a > + .arch_extension sec > ENTRY(highbank_smc1) > stmfd sp!, {r4-r11, lr} > mov r12, r0 > diff --git a/arch/arm/mach-keystone/Makefile b/arch/arm/mach-keystone/Makefile > index f8b0dccac8dc..739b38be5696 100644 > --- a/arch/arm/mach-keystone/Makefile > +++ b/arch/arm/mach-keystone/Makefile > @@ -1,9 +1,6 @@ > # SPDX-License-Identifier: GPL-2.0 > obj-y := keystone.o smc.o > > -plus_sec := $(call as-instr,.arch_extension sec,+sec) > -AFLAGS_smc.o :=-Wa,-march=armv7-a$(plus_sec) > - > obj-$(CONFIG_SMP) += platsmp.o > > # PM domain driver for Keystone SOCs > diff --git a/arch/arm/mach-keystone/smc.S b/arch/arm/mach-keystone/smc.S > index d15de8179fab..ec03dc499270 100644 > --- a/arch/arm/mach-keystone/smc.S > +++ b/arch/arm/mach-keystone/smc.S > @@ -21,6 +21,7 @@ > * > * Return: Non zero value on failure > */ > + .arch_extension sec > ENTRY(keystone_cpu_smc) > stmfd sp!, {r4-r11, lr} > smc #0 > diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile > index 85d1b13c9215..f1d283995b31 100644 > --- a/arch/arm/mach-omap2/Makefile > +++ b/arch/arm/mach-omap2/Makefile > @@ -41,11 +41,6 @@ obj-$(CONFIG_SOC_OMAP5) += $(omap-4-5-common) > $(smp-y) sleep44xx.o > obj-$(CONFIG_SOC_AM43XX) += $(omap-4-5-common) > obj-$(CONFIG_SOC_DRA7XX) += $(omap-4-5-common) $(smp-y) sleep44xx.o > > -plus_sec := $(call as-instr,.arch_extension sec,+sec) > -AFLAGS_omap-headsmp.o :=-Wa,-march=armv7-a$(plus_sec) > -AFLAGS_omap-smc.o :=-Wa,-march=armv7-a$(plus_sec) > -AFLAGS_sleep44xx.o :=-Wa,-march=armv7-a$(plus_sec) > - > # Functions loaded to SRAM > obj-$(CONFIG_SOC_OMAP2420) += sram242x.o > obj-$(CONFIG_SOC_OMAP2430) += sram243x.o > @@ -95,9 +90,6 @@ obj-$(CONFIG_POWER_AVS_OMAP) += sr_device.o > obj-$(CONFIG_POWER_AVS_OMAP_CLASS3) += smartreflex-class3.o > > AFLAGS_sleep24xx.o :=-Wa,-march=armv6 > -AFLAGS_sleep34xx.o :=-Wa,-march=armv7-a$(plus_sec) > -AFLAGS_sleep33xx.o :=-Wa,-march=armv7-a$(plus_sec) > -AFLAGS_sleep43xx.o :=-Wa,-march=armv7-a$(plus_sec) > > endif > > diff --git a/arch/arm/mach-omap2/omap-headsmp.S > b/arch/arm/mach-omap2/omap-headsmp.S > index 4c6f14cf92a8..b26c0daaa3c1 100644 > --- a/arch/arm/mach-omap2/omap-headsmp.S > +++ b/arch/arm/mach-omap2/omap-headsmp.S > @@ -58,6 +58,8 @@ ENDPROC(omap5_secondary_startup) > * omap5_secondary_startup if the primary CPU was put into HYP mode by > * the boot loader. > */ > + .arch armv7-a > + .arch_extension sec > ENTRY(omap5_secondary_hyp_startup) > wait_2: ldr r2, =AUX_CORE_BOOT0_PA @ read from AuxCoreBoot0 > ldr r0, [r2] > diff --git a/arch/arm/mach-omap2/omap-smc.S b/arch/arm/mach-omap2/omap-smc.S > index 72506e6cf9e7..a14aee5e81d1 100644 > --- a/arch/arm/mach-omap2/omap-smc.S > +++ b/arch/arm/mach-omap2/omap-smc.S > @@ -23,7 +23,8 @@ > * link register "lr". > * Function signature : void omap_smc1(u32 fn, u32 arg) > */ > - > + .arch armv7-a > + .arch_extension sec > ENTRY(omap_smc1) > stmfd sp!, {r2-r12, lr} > mov r12, r0 > diff --git a/arch/arm/mach-omap2/sleep33xx.S b/arch/arm/mach-omap2/sleep33xx.S > index 47a816468cdb..68fee339d3f1 100644 > --- a/arch/arm/mach-omap2/sleep33xx.S > +++ b/arch/arm/mach-omap2/sleep33xx.S > @@ -24,6 +24,7 @@ > #define BIT(nr) (1 << (nr)) > > .arm > + .arch armv7-a > .align 3 > > ENTRY(am33xx_do_wfi) > diff --git a/arch/arm/mach-omap2/sleep34xx.S b/arch/arm/mach-omap2/sleep34xx.S > index 22daf4efed68..4927304b5902 100644 > --- a/arch/arm/mach-omap2/sleep34xx.S > +++ b/arch/arm/mach-omap2/sleep34xx.S > @@ -97,6 +97,8 @@ ENDPROC(enable_omap3630_toggle_l2_on_restore) > * > * r0 = physical address of the parameters > */ > + .arch armv7-a > + .arch_extension sec > ENTRY(save_secure_ram_context) > stmfd sp!, {r4 - r11, lr} @ save registers on stack > mov r3, r0 @ physical address of parameters > diff --git a/arch/arm/mach-omap2/sleep43xx.S b/arch/arm/mach-omap2/sleep43xx.S > index 5b9343b58fc7..31dda92d9d03 100644 > --- a/arch/arm/mach-omap2/sleep43xx.S > +++ b/arch/arm/mach-omap2/sleep43xx.S > @@ -56,6 +56,8 @@ > #define RTC_PMIC_EXT_WAKEUP_EN BIT(0) > > .arm > + .arch armv7-a > + .arch_extension sec > .align 3 > > ENTRY(am43xx_do_wfi) > diff --git a/arch/arm/mach-omap2/sleep44xx.S b/arch/arm/mach-omap2/sleep44xx.S > index 0cae3b070208..fb559d3de1f2 100644 > --- a/arch/arm/mach-omap2/sleep44xx.S > +++ b/arch/arm/mach-omap2/sleep44xx.S > @@ -21,8 +21,11 @@ > #include "omap44xx.h" > #include "omap4-sar-layout.h" > > + .arch armv7-a > + > #if defined(CONFIG_SMP) && defined(CONFIG_PM) > > + .arch_extension sec > .macro DO_SMC > dsb > smc #0 > diff --git a/arch/arm/mach-tango/Makefile b/arch/arm/mach-tango/Makefile > index da6c633d3cc0..97cd04508fa1 100644 > --- a/arch/arm/mach-tango/Makefile > +++ b/arch/arm/mach-tango/Makefile > @@ -1,7 +1,4 @@ > # SPDX-License-Identifier: GPL-2.0 > -plus_sec := $(call as-instr,.arch_extension sec,+sec) > -AFLAGS_smc.o := -Wa,-march=armv7-a$(plus_sec) > - > obj-y += setup.o smc.o > obj-$(CONFIG_SMP) += platsmp.o > obj-$(CONFIG_SUSPEND) += pm.o > diff --git a/arch/arm/mach-tango/smc.S b/arch/arm/mach-tango/smc.S > index 361a8dc89804..b1752aaa72bc 100644 > --- a/arch/arm/mach-tango/smc.S > +++ b/arch/arm/mach-tango/smc.S > @@ -1,6 +1,8 @@ > /* SPDX-License-Identifier: GPL-2.0 */ > #include > > + .arch armv7-a > + .arch_extension sec > ENTRY(tango_smc) > push {lr} > mov ip, r1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel