Re: [PATCH v2 1/3] ARM: use arch_extension directive instead of arch argument
On 09.04.2019 16:50, Tony Lindgren wrote: > Hi, > > * Stefan Agner [190408 20:59]: >> --- 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) > > I think we should also change the AFLAGS_sleep24xx.o above the > same way but with armv6 flags. This can be build tested with > omap2plus_defconfig. >From what I can tell, since those do not add the sec extension they should work fine for LLVM's integrated assembler. But I agree, for consistency it would be nice to get rid of them the same way too. A bit further up, there is also: AFLAGS_sram242x.o :=-Wa,-march=armv6 AFLAGS_sram243x.o :=-Wa,-march=armv6 I think those explicit arch definitions are not even necessary since ARCH_OMAP2 depends on ARCH_MULTI_V6, which cannot be built with pre v6 architecture. So the minimum architecture we build for will be armv6... In a quick test omap2plus_defconfig builds fine without those AFLAGS. I will put it through some more testing and drop those flags in v3. -- Stefan > > Regards, > > Tony
Re: [PATCH v2 1/3] ARM: use arch_extension directive instead of arch argument
On 09.04.2019 14:25, Måns Rullgård wrote: > Stefan Agner writes: > >> 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 >> --- >> Changes since v1: >> - Explicitly specify assembler architecture as armv7-a to avoid >> build issues when bulding v6/v7 multi arch kernel. >> >> 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| 2 ++ >> arch/arm/mach-tango/Makefile | 3 --- >> arch/arm/mach-tango/smc.S | 1 + >> 18 files changed, 19 insertions(+), 30 deletions(-) > > [...] > >> 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-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-tango/smc.S b/arch/arm/mach-tango/smc.S >> index 361a8dc89804..cf2d21e5226c 100644 >> --- a/arch/arm/mach-tango/smc.S >> +++ b/arch/arm/mach-tango/smc.S >> @@ -1,6 +1,7 @@ >> /* SPDX-License-Identifier: GPL-2.0 */ >> #include >> >> +.arch_extension sec >> ENTRY(tango_smc) >> push{lr} >> mov ip, r1 Actually, mach-tango uses dsb and needs the .arch directive. Will fix in v3. -- Stefan > > Is there some reason these three don't need the .arch directive?
Re: [PATCH v2 1/3] ARM: use arch_extension directive instead of arch argument
On 09.04.2019 14:25, Måns Rullgård wrote: > Stefan Agner writes: > >> 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 >> --- >> Changes since v1: >> - Explicitly specify assembler architecture as armv7-a to avoid >> build issues when bulding v6/v7 multi arch kernel. >> >> 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| 2 ++ >> arch/arm/mach-tango/Makefile | 3 --- >> arch/arm/mach-tango/smc.S | 1 + >> 18 files changed, 19 insertions(+), 30 deletions(-) > > [...] > >> 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-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-tango/smc.S b/arch/arm/mach-tango/smc.S >> index 361a8dc89804..cf2d21e5226c 100644 >> --- a/arch/arm/mach-tango/smc.S >> +++ b/arch/arm/mach-tango/smc.S >> @@ -1,6 +1,7 @@ >> /* SPDX-License-Identifier: GPL-2.0 */ >> #include >> >> +.arch_extension sec >> ENTRY(tango_smc) >> push{lr} >> mov ip, r1 > > Is there some reason these three don't need the .arch directive? They all do not use a memory barrier instruction (e.g. dmb) which caused issues on the other files. -- Stefan
Re: [PATCH v2 1/3] ARM: use arch_extension directive instead of arch argument
Hi, * Stefan Agner [190408 20:59]: > --- 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) I think we should also change the AFLAGS_sleep24xx.o above the same way but with armv6 flags. This can be build tested with omap2plus_defconfig. Regards, Tony
Re: [PATCH v2 1/3] ARM: use arch_extension directive instead of arch argument
Stefan Agner writes: > 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 > --- > Changes since v1: > - Explicitly specify assembler architecture as armv7-a to avoid > build issues when bulding v6/v7 multi arch kernel. > > 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| 2 ++ > arch/arm/mach-tango/Makefile | 3 --- > arch/arm/mach-tango/smc.S | 1 + > 18 files changed, 19 insertions(+), 30 deletions(-) [...] > 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-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-tango/smc.S b/arch/arm/mach-tango/smc.S > index 361a8dc89804..cf2d21e5226c 100644 > --- a/arch/arm/mach-tango/smc.S > +++ b/arch/arm/mach-tango/smc.S > @@ -1,6 +1,7 @@ > /* SPDX-License-Identifier: GPL-2.0 */ > #include > > + .arch_extension sec > ENTRY(tango_smc) > push{lr} > mov ip, r1 Is there some reason these three don't need the .arch directive? -- Måns Rullgård
[PATCH v2 1/3] ARM: use arch_extension directive instead of arch argument
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 --- Changes since v1: - Explicitly specify assembler architecture as armv7-a to avoid build issues when bulding v6/v7 multi arch kernel. 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| 2 ++ arch/arm/mach-tango/Makefile | 3 --- arch/arm/mach-tango/smc.S | 1 + 18 files changed, 19 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 := $