mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Imre Kaloz <kaloz@kernel.org>
To: Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	linux-mips@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 1/5] MIPS: Use SC_BEQZ in the futex and sysmips ll/sc loops
Date: Mon, 26 Oct 2026 14:41:41 +0100	[thread overview]
Message-ID: <20261026134147.15988-2-kaloz@kernel.org> (raw)
In-Reply-To: <20261026134147.15988-1-kaloz@kernel.org>

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@kernel.org>
---

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


  reply	other threads:[~2026-10-26 13:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-26 13:41 [PATCH 0/5] MIPS: Select the R10000 LL/SC workaround at boot Imre Kaloz
2026-10-26 13:41 ` Imre Kaloz [this message]
2026-10-26 13:41 ` [PATCH 2/5] " Imre Kaloz
2026-10-26 13:41 ` [PATCH 3/5] MIPS: SGI-IP27: Report all CPUs to the R10000 LL/SC workaround Imre Kaloz
2026-10-26 13:41 ` [PATCH 4/5] MIPS: tlbex: Follow the boot-time R10000 LL/SC choice Imre Kaloz
2026-10-26 13:41 ` [PATCH 5/5] bpf, mips: " Imre Kaloz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261026134147.15988-2-kaloz@kernel.org \
    --to=kaloz@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=tsbogend@alpha.franken.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®