[PATCH 15/15] x86/percpu: Remove !CONFIG_X86_CX8 methods

Ingo Molnar
2025-12-14T08:48:18Z

From: Uros Bizjak <ubizjak@gmail.com>

Adjust the constraints to the non-alternatives asm() statement.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "Ahmed S . Darwish" <darwi@linutronix.de>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Arnd Bergmann <arnd@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H . Peter Anvin" <hpa@zytor.com>
Cc: John Ogness <john.ogness@linutronix.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/15696bb3-126b-ef71-f838-80e1e1c1b0aa@gmail.com
---
arch/x86/include/asm/percpu.h | 25 ++++++++++---------------
1 file changed, 10 insertions(+), 15 deletions(-)

diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h
index 725d0eff7acd..4c84ae0ea261 100644
--- a/arch/x86/include/asm/percpu.h
+++ b/arch/x86/include/asm/percpu.h
@@ -335,13 +335,10 @@ do { \
old__.var = _oval; \
new__.var = _nval; \
\
- asm_inline qual ( \
- ALTERNATIVE("call this_cpu_cmpxchg8b_emu", \
- "cmpxchg8b " __percpu_arg([var]), X86_FEATURE_CX8) \
- : ALT_OUTPUT_SP([var] "+m" (__my_cpu_var(_var)), \
- "+a" (old__.low), "+d" (old__.high)) \
- : "b" (new__.low), "c" (new__.high), \
- "S" (&(_var)) \
+ asm qual ("cmpxchg8b " __percpu_arg([var]) \
+ : "+m" (__my_cpu_var(_var)), \
+ "+a" (old__.low), "+d" (old__.high) \
+ : "b" (new__.low), "c" (new__.high) \
: "memory"); \
\
old__.var; \
@@ -364,14 +361,12 @@ do { \
old__.var = *_oval; \
new__.var = _nval; \
\
- asm_inline qual ( \
- ALTERNATIVE("call this_cpu_cmpxchg8b_emu", \
- "cmpxchg8b " __percpu_arg([var]), X86_FEATURE_CX8) \
- : ALT_OUTPUT_SP("=@ccz" (success), \
- [var] "+m" (__my_cpu_var(_var)), \
- "+a" (old__.low), "+d" (old__.high)) \
- : "b" (new__.low), "c" (new__.high), \
- "S" (&(_var)) \
+ asm qual ("cmpxchg8b " __percpu_arg([var]) \
+ CC_SET(z) \
+ : CC_OUT(z) (success), \
+ [var] "+m" (__my_cpu_var(_var)), \
+ "+a" (old__.low), "+d" (old__.high) \
+ : "b" (new__.low), "c" (new__.high) \
: "memory"); \
if (unlikely(!success)) \
*_oval = old__.var; \
--
2.51.0