Skip to content

Commit a923a26

Browse files
maciej-w-rozyckitsbogend
authored andcommitted
MIPS: Fix assembly error from MIPSr2 code used within MIPS_ISA_ARCH_LEVEL
Fix assembly errors like: {standard input}: Assembler messages: {standard input}:287: Error: opcode not supported on this processor: mips3 (mips3) `dins $10,$7,32,32' {standard input}:680: Error: opcode not supported on this processor: mips3 (mips3) `dins $10,$7,32,32' {standard input}:1274: Error: opcode not supported on this processor: mips3 (mips3) `dins $12,$9,32,32' {standard input}:2175: Error: opcode not supported on this processor: mips3 (mips3) `dins $10,$7,32,32' make[1]: *** [scripts/Makefile.build:277: mm/highmem.o] Error 1 with code produced from `__cmpxchg64' for MIPS64r2 CPU configurations using CONFIG_32BIT and CONFIG_PHYS_ADDR_T_64BIT. This is due to MIPS_ISA_ARCH_LEVEL downgrading the assembly architecture to `r4000' i.e. MIPS III for MIPS64r2 configurations, while there is a block of code containing a DINS MIPS64r2 instruction conditionalized on MIPS_ISA_REV >= 2 within the scope of the downgrade. The assembly architecture override code pattern has been put there for LL/SC instructions, so that code compiles for configurations that select a processor to build for that does not support these instructions while still providing run-time support for processors that do, dynamically switched by non-constant `cpu_has_llsc'. It went in with linux-mips.org commit aac8aa7 ("Enable a suitable ISA for the assembler around ll/sc so that code builds even for processors that don't support the instructions. Plus minor formatting fixes.") back in 2005. Fix the problem by wrapping these instructions along with the adjacent SYNC instructions only, following the practice established with commit cfd54de ("MIPS: Avoid move psuedo-instruction whilst using MIPS_ISA_LEVEL") and commit 378ed6f ("MIPS: Avoid using .set mips0 to restore ISA"). Strictly speaking the SYNC instructions do not have to be wrapped as they are only used as a Loongson3 erratum workaround, so they will be enabled in the assembler by default, but do this so as to keep code consistent with other places. Reported-by: kernel test robot <[email protected]> Signed-off-by: Maciej W. Rozycki <[email protected]> Fixes: c7e2d71 ("MIPS: Fix set_pte() for Netlogic XLR using cmpxchg64()") Cc: [email protected] # v5.1+ Signed-off-by: Thomas Bogendoerfer <[email protected]>
1 parent d6c7c37 commit a923a26

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

arch/mips/include/asm/cmpxchg.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ static inline unsigned long __cmpxchg64(volatile void *ptr,
249249
/* Load 64 bits from ptr */
250250
" " __SYNC(full, loongson3_war) " \n"
251251
"1: lld %L0, %3 # __cmpxchg64 \n"
252+
" .set pop \n"
252253
/*
253254
* Split the 64 bit value we loaded into the 2 registers that hold the
254255
* ret variable.
@@ -276,12 +277,14 @@ static inline unsigned long __cmpxchg64(volatile void *ptr,
276277
" or %L1, %L1, $at \n"
277278
" .set at \n"
278279
# endif
280+
" .set push \n"
281+
" .set " MIPS_ISA_ARCH_LEVEL " \n"
279282
/* Attempt to store new at ptr */
280283
" scd %L1, %2 \n"
281284
/* If we failed, loop! */
282285
"\t" __SC_BEQZ "%L1, 1b \n"
283-
" .set pop \n"
284286
"2: " __SYNC(full, loongson3_war) " \n"
287+
" .set pop \n"
285288
: "=&r"(ret),
286289
"=&r"(tmp),
287290
"=" GCC_OFF_SMALL_ASM() (*(unsigned long long *)ptr)

0 commit comments

Comments
 (0)