ARM: use arch_extension directive instead of arch argument
authorStefan Agner <stefan@agner.ch>
Mon, 27 May 2019 22:40:50 +0000 (00:40 +0200)
committerOlof Johansson <olof@lixom.net>
Wed, 19 Jun 2019 16:44:25 +0000 (09:44 -0700)
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 <stefan@agner.ch>
Acked-by: Mans Rullgard <mans@mansr.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Olof Johansson <olof@lixom.net>
18 files changed:
arch/arm/mach-bcm/Makefile
arch/arm/mach-bcm/bcm_kona_smc.c
arch/arm/mach-exynos/Makefile
arch/arm/mach-exynos/exynos-smc.S
arch/arm/mach-exynos/sleep.S
arch/arm/mach-highbank/Makefile
arch/arm/mach-highbank/smc.S
arch/arm/mach-keystone/Makefile
arch/arm/mach-keystone/smc.S
arch/arm/mach-omap2/Makefile
arch/arm/mach-omap2/omap-headsmp.S
arch/arm/mach-omap2/omap-smc.S
arch/arm/mach-omap2/sleep33xx.S
arch/arm/mach-omap2/sleep34xx.S
arch/arm/mach-omap2/sleep43xx.S
arch/arm/mach-omap2/sleep44xx.S
arch/arm/mach-tango/Makefile
arch/arm/mach-tango/smc.S

index 8fd23b263c602b92bf0c95790061d4a12abb4b3b..b59c813b1af45a1cea45471b6b517ed563814149 100644 (file)
@@ -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
index a55a7ecf146a277df8c55603837b67d6fdc30a03..541e850a736c99929788395ffca3b3d8f5a1ed3d 100644 (file)
@@ -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)
index 264dbaa89c3db721478fe7f2ba001b01a2883523..5ccf9d7e58d4238497c3a34b1c20c8f3a4f9a310 100644 (file)
@@ -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_MCPM)             += mcpm-exynos.o
 CFLAGS_mcpm-exynos.o           += -march=armv7-a
index d259532ba937ef94df22a586f3fd79e937d2df24..6da31e6a7acbc74397020a2bf9498f8eb223a3f5 100644 (file)
@@ -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
index 2783c3a0c06ac679959bb2ddd3af5c708052374c..ed93f91853b8cddc3c3e869adeaee1bcb1fe3650 100644 (file)
@@ -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
index 7e6732c16862fe87695c07c480fc91f3dfe2531e..71cc68041d92565abef4c0bb520b6d657dfd385c 100644 (file)
@@ -1,7 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0-only
 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
index 407d17baaaa9d6c7f67ddf843087e1a6fbe28427..860a79135b7b6412aa5eef6299410ad5c346166b 100644 (file)
@@ -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
index f8b0dccac8dca21a51460e1c30e847f13f9272a4..739b38be569683c52d137c280d7733cd63750531 100644 (file)
@@ -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
index d15de8179fabcee3ebe665658348bf4aead2a5e3..ec03dc4992703fe390194f7301ece1125af9a47e 100644 (file)
@@ -21,6 +21,7 @@
  *
  * Return: Non zero value on failure
  */
+       .arch_extension sec
 ENTRY(keystone_cpu_smc)
        stmfd   sp!, {r4-r11, lr}
        smc     #0
index 85d1b13c9215b89da7087e19b2aefe0ceb68e515..f1d283995b316d06ddf41e27f6255bbcac71a0ab 100644 (file)
@@ -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
 
index 4c6f14cf92a82e3dbf8d7ceeb985686feb79e924..b26c0daaa3c1ec736ce4b46a0362b3b793c143f6 100644 (file)
@@ -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]
index 72506e6cf9e7423f946d83e61b5aca66d2fee0c0..a14aee5e81d125d4c6096db7720614865d326b5c 100644 (file)
@@ -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
index 47a816468cdb45a2cf55b3751dfd8dd82c1c40c3..68fee339d3f12755bf0172bc27eac07e2743838e 100644 (file)
@@ -24,6 +24,7 @@
 #define BIT(nr)                        (1 << (nr))
 
        .arm
+       .arch armv7-a
        .align 3
 
 ENTRY(am33xx_do_wfi)
index 75ea4723ec0e888aa939f03a2be7347f61cd7f85..ac1324c6453b5b121a4466b833787a1a9086d2cd 100644 (file)
@@ -83,6 +83,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
index 0c1031442571ff3933789ba72068429782f1e144..c1f4e4852644e7e1e917e216d20fd50485c57530 100644 (file)
@@ -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)
index 0cae3b0702089a75b610ce88bcc0888e68e8c676..fb559d3de1f28e2e1bbc6926099a1c7a1c12c462 100644 (file)
 #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
index da6c633d3cc04b337d0679afbd2a3118c7049b16..97cd04508fa1731ca9147c106ddc3f58a1a58344 100644 (file)
@@ -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
index 361a8dc898042f2bbfeed0be7634c921518cfb5a..b1752aaa72bcbf0267a81e80728aa0999bfd0a87 100644 (file)
@@ -1,6 +1,8 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 #include <linux/linkage.h>
 
+       .arch armv7-a
+       .arch_extension sec
 ENTRY(tango_smc)
        push    {lr}
        mov     ip, r1