Re: [PATCH 2/5] powerpc/64s: Use .machine power4 around dcbt

2024-02-29 Thread Segher Boessenkool
On Thu, Feb 29, 2024 at 11:25:18PM +1100, Michael Ellerman wrote:
> There are multiple decodings for the "dcbt" mnemonic, so the assembler
> has to pick one.
> 
> That requires passing -many to the assembler, which is not recommended.
> 
> Without -many the clang 14 / binutils 2.38 build fails with:
> 
>   arch/powerpc/kernel/exceptions-64s.S:2976: Error: junk at end of line: 
> `0b01010'
>   clang: error: assembler command failed with exit code 1 (use -v to see 
> invocation)
> 
> Fix it by adding .machine directives around the use of dcbt to specify
> which encoding is desired.
> 
> Signed-off-by: Michael Ellerman 

Looks good, thanks!

Acked-by: Segher Boessenkool 


Segher


[PATCH 2/5] powerpc/64s: Use .machine power4 around dcbt

2024-02-29 Thread Michael Ellerman
There are multiple decodings for the "dcbt" mnemonic, so the assembler
has to pick one.

That requires passing -many to the assembler, which is not recommended.

Without -many the clang 14 / binutils 2.38 build fails with:

  arch/powerpc/kernel/exceptions-64s.S:2976: Error: junk at end of line: 
`0b01010'
  clang: error: assembler command failed with exit code 1 (use -v to see 
invocation)

Fix it by adding .machine directives around the use of dcbt to specify
which encoding is desired.

Signed-off-by: Michael Ellerman 
---
 arch/powerpc/include/asm/ppc_asm.h | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/include/asm/ppc_asm.h 
b/arch/powerpc/include/asm/ppc_asm.h
index 78c7548eac1e..1d1018c1e482 100644
--- a/arch/powerpc/include/asm/ppc_asm.h
+++ b/arch/powerpc/include/asm/ppc_asm.h
@@ -508,11 +508,16 @@ END_FTR_SECTION_NESTED(CPU_FTR_CELL_TB_BUG, 
CPU_FTR_CELL_TB_BUG, 96)
  */
 #define DCBT_BOOK3S_STOP_ALL_STREAM_IDS(scratch)   \
lis scratch,0x6000@h;   \
-   dcbt0,scratch,0b01010
+   .machine push;  \
+   .machine power4;\
+   dcbt0,scratch,0b01010;  \
+   .machine pop;
 
 #define DCBT_SETUP_STREAMS(from, from_parms, to, to_parms, scratch)\
lis scratch,0x8000; /* GO=1 */  \
clrldi  scratch,scratch,32; \
+   .machine push;  \
+   .machine power4;\
/* setup read stream 0 */   \
dcbt0,from,0b01000; /* addr from */ \
dcbt0,from_parms,0b01010;   /* length and depth from */ \
@@ -520,7 +525,8 @@ END_FTR_SECTION_NESTED(CPU_FTR_CELL_TB_BUG, 
CPU_FTR_CELL_TB_BUG, 96)
dcbtst  0,to,0b01000;   /* addr to */   \
dcbtst  0,to_parms,0b01010; /* length and depth to */   \
eieio;  \
-   dcbt0,scratch,0b01010;  /* all streams GO */
+   dcbt0,scratch,0b01010;  /* all streams GO */\
+   .machine pop;
 
 /*
  * toreal/fromreal/tophys/tovirt macros. 32-bit BookE makes them
-- 
2.43.2