linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] ARM: drop WASM to work around LLVM issue
@ 2019-03-17 23:05 Stefan Agner
  2019-03-17 23:05 ` [PATCH v2 2/2] ARM: drop -mauto-it Stefan Agner
  2019-03-18 18:09 ` [PATCH v2 1/2] ARM: drop WASM to work around LLVM issue Nick Desaulniers
  0 siblings, 2 replies; 4+ messages in thread
From: Stefan Agner @ 2019-03-17 23:05 UTC (permalink / raw)
  To: linux
  Cc: robin.murphy, will.deacon, ndesaulniers, natechancellor, arnd,
	ard.biesheuvel, nicolas.pitre, thierry.reding, julien.thierry,
	mark.rutland, linux-kernel, linux-arm-kernel, Stefan Agner

Currently LLVM's integrated assembler does not recognize .w form
of the pld instructions (LLVM Bug 40972 [0]):

  ./arch/arm/include/asm/processor.h:133:5: error: invalid instruction
                          "pldw.w\t%a0 \n"
                           ^
  <inline asm>:2:1: note: instantiated into assembly here
  pldw.w  [r0]
  ^
  1 error generated.

The W macro for generating wide instructions when targeting Thumb-2
is not strictly required for the preload data instructions (pld, pldw)
since they are only available as wide instructions. The GNU assembler
works with or without the .w appended when compiling an Thumb-2 kernel.

Drop the macro to work around LLVM Bug 40972 issue.

[0] https://bugs.llvm.org/show_bug.cgi?id=40972

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
Changes in v2:
- Reword commit message to reflect the fact that this is a work around
  for LLVM.

 arch/arm/include/asm/processor.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/processor.h b/arch/arm/include/asm/processor.h
index 57fe73ea0f72..5d06f75ffad4 100644
--- a/arch/arm/include/asm/processor.h
+++ b/arch/arm/include/asm/processor.h
@@ -135,8 +135,8 @@ static inline void prefetchw(const void *ptr)
 	__asm__ __volatile__(
 		".arch_extension	mp\n"
 		__ALT_SMP_ASM(
-			WASM(pldw)		"\t%a0",
-			WASM(pld)		"\t%a0"
+			"pldw\t%a0",
+			"pld\t%a0"
 		)
 		:: "p" (ptr));
 }
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] ARM: drop -mauto-it
  2019-03-17 23:05 [PATCH v2 1/2] ARM: drop WASM to work around LLVM issue Stefan Agner
@ 2019-03-17 23:05 ` Stefan Agner
  2019-03-18 18:09 ` [PATCH v2 1/2] ARM: drop WASM to work around LLVM issue Nick Desaulniers
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Agner @ 2019-03-17 23:05 UTC (permalink / raw)
  To: linux
  Cc: robin.murphy, will.deacon, ndesaulniers, natechancellor, arnd,
	ard.biesheuvel, nicolas.pitre, thierry.reding, julien.thierry,
	mark.rutland, linux-kernel, linux-arm-kernel, Stefan Agner

The assembler option -mauto-it is no longer a valid option. The last
remaining references have been removed from the documentation in
July 2009 [0].

The currently supported binutils version is 2.20 (released in
September 2009) or higher where gas supports -mimplicit-it=always.
Drop the fallback to -mauto-it and use -mimplicit-it=always only.

[0] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=529707530657a333a304c651c808ea630c955223

Signed-off-by: Stefan Agner <stefan@agner.ch>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
---
Changes in v2:
- Drop $(comma) since we are no longer use the call to as-option.

 arch/arm/Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index df3ad82d312c..eb9d38e77cf0 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -113,8 +113,7 @@ CFLAGS_ABI	+=-funwind-tables
 endif
 
 ifeq ($(CONFIG_THUMB2_KERNEL),y)
-AFLAGS_AUTOIT	:=$(call as-option,-Wa$(comma)-mimplicit-it=always,-Wa$(comma)-mauto-it)
-CFLAGS_ISA	:=-mthumb $(AFLAGS_AUTOIT)
+CFLAGS_ISA	:=-mthumb -Wa,-mimplicit-it=always
 AFLAGS_ISA	:=$(CFLAGS_ISA) -Wa$(comma)-mthumb
 # Work around buggy relocation from gas if requested:
 ifeq ($(CONFIG_THUMB2_AVOID_R_ARM_THM_JUMP11),y)
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] ARM: drop WASM to work around LLVM issue
  2019-03-17 23:05 [PATCH v2 1/2] ARM: drop WASM to work around LLVM issue Stefan Agner
  2019-03-17 23:05 ` [PATCH v2 2/2] ARM: drop -mauto-it Stefan Agner
@ 2019-03-18 18:09 ` Nick Desaulniers
  2019-03-19 22:07   ` Stefan Agner
  1 sibling, 1 reply; 4+ messages in thread
From: Nick Desaulniers @ 2019-03-18 18:09 UTC (permalink / raw)
  To: Stefan Agner
  Cc: Russell King, Robin Murphy, Will Deacon, Nathan Chancellor,
	Arnd Bergmann, Ard Biesheuvel, Nicolas Pitre, Thierry Reding,
	julien.thierry, Mark Rutland, LKML, Linux ARM

On Sun, Mar 17, 2019 at 4:05 PM Stefan Agner <stefan@agner.ch> wrote:
>
> Currently LLVM's integrated assembler does not recognize .w form
> of the pld instructions (LLVM Bug 40972 [0]):
>
>   ./arch/arm/include/asm/processor.h:133:5: error: invalid instruction
>                           "pldw.w\t%a0 \n"
>                            ^
>   <inline asm>:2:1: note: instantiated into assembly here
>   pldw.w  [r0]
>   ^
>   1 error generated.
>
> The W macro for generating wide instructions when targeting Thumb-2
> is not strictly required for the preload data instructions (pld, pldw)
> since they are only available as wide instructions. The GNU assembler
> works with or without the .w appended when compiling an Thumb-2 kernel.
>
> Drop the macro to work around LLVM Bug 40972 issue.
>
> [0] https://bugs.llvm.org/show_bug.cgi?id=40972
>
> Signed-off-by: Stefan Agner <stefan@agner.ch>

Thanks for the bug report and patch.
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

Just curious, there are only 3 other expansion sites of this macro.
Are any of those problematic?  Looks like nop.w, sev.w and b.w?

> ---
> Changes in v2:
> - Reword commit message to reflect the fact that this is a work around
>   for LLVM.
>
>  arch/arm/include/asm/processor.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/include/asm/processor.h b/arch/arm/include/asm/processor.h
> index 57fe73ea0f72..5d06f75ffad4 100644
> --- a/arch/arm/include/asm/processor.h
> +++ b/arch/arm/include/asm/processor.h
> @@ -135,8 +135,8 @@ static inline void prefetchw(const void *ptr)
>         __asm__ __volatile__(
>                 ".arch_extension        mp\n"
>                 __ALT_SMP_ASM(
> -                       WASM(pldw)              "\t%a0",
> -                       WASM(pld)               "\t%a0"
> +                       "pldw\t%a0",
> +                       "pld\t%a0"
>                 )
>                 :: "p" (ptr));
>  }
> --
> 2.21.0
>


-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] ARM: drop WASM to work around LLVM issue
  2019-03-18 18:09 ` [PATCH v2 1/2] ARM: drop WASM to work around LLVM issue Nick Desaulniers
@ 2019-03-19 22:07   ` Stefan Agner
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Agner @ 2019-03-19 22:07 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Russell King, Robin Murphy, Will Deacon, Nathan Chancellor,
	Arnd Bergmann, Ard Biesheuvel, Nicolas Pitre, Thierry Reding,
	julien.thierry, Mark Rutland, LKML, Linux ARM

On 18.03.2019 19:09, Nick Desaulniers wrote:
> On Sun, Mar 17, 2019 at 4:05 PM Stefan Agner <stefan@agner.ch> wrote:
>>
>> Currently LLVM's integrated assembler does not recognize .w form
>> of the pld instructions (LLVM Bug 40972 [0]):
>>
>>   ./arch/arm/include/asm/processor.h:133:5: error: invalid instruction
>>                           "pldw.w\t%a0 \n"
>>                            ^
>>   <inline asm>:2:1: note: instantiated into assembly here
>>   pldw.w  [r0]
>>   ^
>>   1 error generated.
>>
>> The W macro for generating wide instructions when targeting Thumb-2
>> is not strictly required for the preload data instructions (pld, pldw)
>> since they are only available as wide instructions. The GNU assembler
>> works with or without the .w appended when compiling an Thumb-2 kernel.
>>
>> Drop the macro to work around LLVM Bug 40972 issue.
>>
>> [0] https://bugs.llvm.org/show_bug.cgi?id=40972
>>
>> Signed-off-by: Stefan Agner <stefan@agner.ch>
> 
> Thanks for the bug report and patch.
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> 
> Just curious, there are only 3 other expansion sites of this macro.
> Are any of those problematic?  Looks like nop.w, sev.w and b.w?
> 

All three sites are in inline assembly, and I did a bunch of successful
Thumb2 builds using the integrated assembler, so I think all those sites
have been assembled by LLVM successfully.

Also confirmed those three instructions with the reproducer example from
the LLVM bug above.

--
Stefan

>> ---
>> Changes in v2:
>> - Reword commit message to reflect the fact that this is a work around
>>   for LLVM.
>>
>>  arch/arm/include/asm/processor.h | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/arm/include/asm/processor.h b/arch/arm/include/asm/processor.h
>> index 57fe73ea0f72..5d06f75ffad4 100644
>> --- a/arch/arm/include/asm/processor.h
>> +++ b/arch/arm/include/asm/processor.h
>> @@ -135,8 +135,8 @@ static inline void prefetchw(const void *ptr)
>>         __asm__ __volatile__(
>>                 ".arch_extension        mp\n"
>>                 __ALT_SMP_ASM(
>> -                       WASM(pldw)              "\t%a0",
>> -                       WASM(pld)               "\t%a0"
>> +                       "pldw\t%a0",
>> +                       "pld\t%a0"
>>                 )
>>                 :: "p" (ptr));
>>  }
>> --
>> 2.21.0
>>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-03-19 22:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-17 23:05 [PATCH v2 1/2] ARM: drop WASM to work around LLVM issue Stefan Agner
2019-03-17 23:05 ` [PATCH v2 2/2] ARM: drop -mauto-it Stefan Agner
2019-03-18 18:09 ` [PATCH v2 1/2] ARM: drop WASM to work around LLVM issue Nick Desaulniers
2019-03-19 22:07   ` Stefan Agner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).