[PATCH 1/5] MIPS: Use SC_BEQZ in the futex and sysmips ll/sc loops
From: Imre Kaloz
Date: Mon Oct 26 2026 - 09:46:15 EST
The R10000 variants of the futex operations and of
sysmips(MIPS_ATOMIC_SET) open-code the beqzl that SC_BEQZ expands to
under CONFIG_WAR_R10000_LLSC. Use SC_BEQZ, so they follow any change
to it.
No functional change.
Signed-off-by: Imre Kaloz <kaloz@xxxxxxxxxx>
---
Notes:
checkpatch warns about whitespace before the quoted newlines: the
replaced lines keep the column alignment of the surrounding asm, as the
beqzl lines they replace did.
arch/mips/include/asm/futex.h | 5 +++--
arch/mips/kernel/syscall.c | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/arch/mips/include/asm/futex.h b/arch/mips/include/asm/futex.h
index 05832eb240fa..9bfae351b82e 100644
--- a/arch/mips/include/asm/futex.h
+++ b/arch/mips/include/asm/futex.h
@@ -12,6 +12,7 @@
#include <linux/futex.h>
#include <linux/uaccess.h>
+#include <asm/asm.h>
#include <asm/asm-eva.h>
#include <asm/barrier.h>
#include <asm/compiler.h>
@@ -35,7 +36,7 @@
" " insn " \n" \
" .set arch=r4000 \n" \
"2: sc $1, %2 \n" \
- " beqzl $1, 1b \n" \
+ " " __stringify(SC_BEQZ) " $1, 1b \n" \
__stringify(__WEAK_LLSC_MB) " \n" \
"3: \n" \
" .insn \n" \
@@ -151,7 +152,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
" move $1, %z5 \n"
" .set arch=r4000 \n"
"2: sc $1, %2 \n"
- " beqzl $1, 1b \n"
+ " " __stringify(SC_BEQZ) " $1, 1b \n"
__stringify(__WEAK_LLSC_MB) " \n"
"3: \n"
" .insn \n"
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index 1bfc34a2e5b3..cdc03322839f 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -115,7 +115,7 @@ static inline int mips_atomic_set(unsigned long addr, unsigned long new)
"1: ll %[old], (%[addr]) \n"
" move %[tmp], %[new] \n"
"2: sc %[tmp], (%[addr]) \n"
- " beqzl %[tmp], 1b \n"
+ " " __stringify(SC_BEQZ) " %[tmp], 1b \n"
"3: \n"
" .insn \n"
" .section .fixup,\"ax\" \n"
--
2.47.3