mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@kernel.org>
To: x86@kernel.org
Cc: linux-kernel@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Borislav Petkov <bp@alien8.de>, "H. Peter Anvin" <hpa@zytor.com>,
	Uros Bizjak <ubizjak@gmail.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ingo Molnar <mingo@kernel.org>
Subject: [PATCH 06/20] x86/asm: Remove CC_SET()
Date: Fri, 14 Mar 2025 14:41:19 -0700	[thread overview]
Message-ID: <fc92a93060fe0f17bbc9fcb2d447463fd3f9296c.1741988314.git.jpoimboe@kernel.org> (raw)
In-Reply-To: <cover.1741988314.git.jpoimboe@kernel.org>

Now that flag output operands are unconditionally supported, CC_SET() is
just a comment.  Remove it.

Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
---
 arch/x86/boot/bitops.h               | 2 +-
 arch/x86/boot/boot.h                 | 4 ++--
 arch/x86/boot/string.c               | 2 +-
 arch/x86/include/asm/archrandom.h    | 2 --
 arch/x86/include/asm/asm.h           | 3 +--
 arch/x86/include/asm/bitops.h        | 6 ------
 arch/x86/include/asm/cmpxchg.h       | 4 ----
 arch/x86/include/asm/cmpxchg_32.h    | 2 --
 arch/x86/include/asm/cmpxchg_64.h    | 1 -
 arch/x86/include/asm/percpu.h        | 4 ----
 arch/x86/include/asm/rmwcc.h         | 2 +-
 arch/x86/include/asm/sev.h           | 1 -
 arch/x86/include/asm/signal.h        | 2 +-
 arch/x86/include/asm/special_insns.h | 1 -
 arch/x86/include/asm/uaccess.h       | 1 -
 tools/arch/x86/include/asm/asm.h     | 5 ++---
 16 files changed, 9 insertions(+), 33 deletions(-)

diff --git a/arch/x86/boot/bitops.h b/arch/x86/boot/bitops.h
index 8518ae214c9b..4f773e0957b0 100644
--- a/arch/x86/boot/bitops.h
+++ b/arch/x86/boot/bitops.h
@@ -27,7 +27,7 @@ static inline bool variable_test_bit(int nr, const void *addr)
 	bool v;
 	const u32 *p = addr;
 
-	asm("btl %2,%1" CC_SET(c) : CC_OUT(c) (v) : "m" (*p), "Ir" (nr));
+	asm("btl %2,%1" : CC_OUT(c) (v) : "m" (*p), "Ir" (nr));
 	return v;
 }
 
diff --git a/arch/x86/boot/boot.h b/arch/x86/boot/boot.h
index 0f24f7ebec9b..a35823039847 100644
--- a/arch/x86/boot/boot.h
+++ b/arch/x86/boot/boot.h
@@ -155,14 +155,14 @@ static inline void wrgs32(u32 v, addr_t addr)
 static inline bool memcmp_fs(const void *s1, addr_t s2, size_t len)
 {
 	bool diff;
-	asm volatile("fs; repe; cmpsb" CC_SET(nz)
+	asm volatile("fs; repe; cmpsb"
 		     : CC_OUT(nz) (diff), "+D" (s1), "+S" (s2), "+c" (len));
 	return diff;
 }
 static inline bool memcmp_gs(const void *s1, addr_t s2, size_t len)
 {
 	bool diff;
-	asm volatile("gs; repe; cmpsb" CC_SET(nz)
+	asm volatile("gs; repe; cmpsb"
 		     : CC_OUT(nz) (diff), "+D" (s1), "+S" (s2), "+c" (len));
 	return diff;
 }
diff --git a/arch/x86/boot/string.c b/arch/x86/boot/string.c
index 84f7a883ce1e..c0cc6d1a7030 100644
--- a/arch/x86/boot/string.c
+++ b/arch/x86/boot/string.c
@@ -32,7 +32,7 @@
 int memcmp(const void *s1, const void *s2, size_t len)
 {
 	bool diff;
-	asm("repe; cmpsb" CC_SET(nz)
+	asm("repe; cmpsb"
 	    : CC_OUT(nz) (diff), "+D" (s1), "+S" (s2), "+c" (len));
 	return diff;
 }
diff --git a/arch/x86/include/asm/archrandom.h b/arch/x86/include/asm/archrandom.h
index 02bae8e0758b..813a99b6ec7b 100644
--- a/arch/x86/include/asm/archrandom.h
+++ b/arch/x86/include/asm/archrandom.h
@@ -23,7 +23,6 @@ static inline bool __must_check rdrand_long(unsigned long *v)
 	unsigned int retry = RDRAND_RETRY_LOOPS;
 	do {
 		asm volatile("rdrand %[out]"
-			     CC_SET(c)
 			     : CC_OUT(c) (ok), [out] "=r" (*v));
 		if (ok)
 			return true;
@@ -35,7 +34,6 @@ static inline bool __must_check rdseed_long(unsigned long *v)
 {
 	bool ok;
 	asm volatile("rdseed %[out]"
-		     CC_SET(c)
 		     : CC_OUT(c) (ok), [out] "=r" (*v));
 	return ok;
 }
diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h
index fdebd4356860..619817841f4c 100644
--- a/arch/x86/include/asm/asm.h
+++ b/arch/x86/include/asm/asm.h
@@ -128,10 +128,9 @@ static __always_inline __pure void *rip_rel_ptr(void *p)
 #endif
 
 /*
- * Macros to generate condition code outputs from inline assembly,
+ * Generate condition code outputs from inline assembly.
  * The output operand must be type "bool".
  */
-#define CC_SET(c) "\n\t/* output condition code " #c "*/\n"
 #define CC_OUT(c) "=@cc" #c
 
 #ifdef __KERNEL__
diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h
index b96d45944c59..67b86e7c1ea3 100644
--- a/arch/x86/include/asm/bitops.h
+++ b/arch/x86/include/asm/bitops.h
@@ -99,7 +99,6 @@ static __always_inline bool arch_xor_unlock_is_negative_byte(unsigned long mask,
 {
 	bool negative;
 	asm volatile(LOCK_PREFIX "xorb %2,%1"
-		CC_SET(s)
 		: CC_OUT(s) (negative), WBYTE_ADDR(addr)
 		: "iq" ((char)mask) : "memory");
 	return negative;
@@ -149,7 +148,6 @@ arch___test_and_set_bit(unsigned long nr, volatile unsigned long *addr)
 	bool oldbit;
 
 	asm(__ASM_SIZE(bts) " %2,%1"
-	    CC_SET(c)
 	    : CC_OUT(c) (oldbit)
 	    : ADDR, "Ir" (nr) : "memory");
 	return oldbit;
@@ -175,7 +173,6 @@ arch___test_and_clear_bit(unsigned long nr, volatile unsigned long *addr)
 	bool oldbit;
 
 	asm volatile(__ASM_SIZE(btr) " %2,%1"
-		     CC_SET(c)
 		     : CC_OUT(c) (oldbit)
 		     : ADDR, "Ir" (nr) : "memory");
 	return oldbit;
@@ -187,7 +184,6 @@ arch___test_and_change_bit(unsigned long nr, volatile unsigned long *addr)
 	bool oldbit;
 
 	asm volatile(__ASM_SIZE(btc) " %2,%1"
-		     CC_SET(c)
 		     : CC_OUT(c) (oldbit)
 		     : ADDR, "Ir" (nr) : "memory");
 
@@ -211,7 +207,6 @@ static __always_inline bool constant_test_bit_acquire(long nr, const volatile un
 	bool oldbit;
 
 	asm volatile("testb %2,%1"
-		     CC_SET(nz)
 		     : CC_OUT(nz) (oldbit)
 		     : "m" (((unsigned char *)addr)[nr >> 3]),
 		       "i" (1 << (nr & 7))
@@ -225,7 +220,6 @@ static __always_inline bool variable_test_bit(long nr, volatile const unsigned l
 	bool oldbit;
 
 	asm volatile(__ASM_SIZE(bt) " %2,%1"
-		     CC_SET(c)
 		     : CC_OUT(c) (oldbit)
 		     : "m" (*(unsigned long *)addr), "Ir" (nr) : "memory");
 
diff --git a/arch/x86/include/asm/cmpxchg.h b/arch/x86/include/asm/cmpxchg.h
index fd8afc1f5f6b..e801dc982a64 100644
--- a/arch/x86/include/asm/cmpxchg.h
+++ b/arch/x86/include/asm/cmpxchg.h
@@ -166,7 +166,6 @@ extern void __add_wrong_size(void)
 	{								\
 		volatile u8 *__ptr = (volatile u8 *)(_ptr);		\
 		asm volatile(lock "cmpxchgb %[new], %[ptr]"		\
-			     CC_SET(z)					\
 			     : CC_OUT(z) (success),			\
 			       [ptr] "+m" (*__ptr),			\
 			       [old] "+a" (__old)			\
@@ -178,7 +177,6 @@ extern void __add_wrong_size(void)
 	{								\
 		volatile u16 *__ptr = (volatile u16 *)(_ptr);		\
 		asm volatile(lock "cmpxchgw %[new], %[ptr]"		\
-			     CC_SET(z)					\
 			     : CC_OUT(z) (success),			\
 			       [ptr] "+m" (*__ptr),			\
 			       [old] "+a" (__old)			\
@@ -190,7 +188,6 @@ extern void __add_wrong_size(void)
 	{								\
 		volatile u32 *__ptr = (volatile u32 *)(_ptr);		\
 		asm volatile(lock "cmpxchgl %[new], %[ptr]"		\
-			     CC_SET(z)					\
 			     : CC_OUT(z) (success),			\
 			       [ptr] "+m" (*__ptr),			\
 			       [old] "+a" (__old)			\
@@ -202,7 +199,6 @@ extern void __add_wrong_size(void)
 	{								\
 		volatile u64 *__ptr = (volatile u64 *)(_ptr);		\
 		asm volatile(lock "cmpxchgq %[new], %[ptr]"		\
-			     CC_SET(z)					\
 			     : CC_OUT(z) (success),			\
 			       [ptr] "+m" (*__ptr),			\
 			       [old] "+a" (__old)			\
diff --git a/arch/x86/include/asm/cmpxchg_32.h b/arch/x86/include/asm/cmpxchg_32.h
index 6d7afee2fa07..50f973ca635d 100644
--- a/arch/x86/include/asm/cmpxchg_32.h
+++ b/arch/x86/include/asm/cmpxchg_32.h
@@ -46,7 +46,6 @@ static __always_inline u64 __cmpxchg64_local(volatile u64 *ptr, u64 old, u64 new
 	bool ret;							\
 									\
 	asm volatile(_lock "cmpxchg8b %[ptr]"				\
-		     CC_SET(e)						\
 		     : CC_OUT(e) (ret),					\
 		       [ptr] "+m" (*(_ptr)),				\
 		       "+a" (o.low), "+d" (o.high)			\
@@ -125,7 +124,6 @@ static __always_inline u64 arch_cmpxchg64_local(volatile u64 *ptr, u64 old, u64
 		ALTERNATIVE(_lock_loc					\
 			    "call cmpxchg8b_emu",			\
 			    _lock "cmpxchg8b %a[ptr]", X86_FEATURE_CX8) \
-		CC_SET(e)						\
 		: ALT_OUTPUT_SP(CC_OUT(e) (ret),			\
 				"+a" (o.low), "+d" (o.high))		\
 		: "b" (n.low), "c" (n.high),				\
diff --git a/arch/x86/include/asm/cmpxchg_64.h b/arch/x86/include/asm/cmpxchg_64.h
index 5e241306db26..03ab7699648c 100644
--- a/arch/x86/include/asm/cmpxchg_64.h
+++ b/arch/x86/include/asm/cmpxchg_64.h
@@ -66,7 +66,6 @@ static __always_inline u128 arch_cmpxchg128_local(volatile u128 *ptr, u128 old,
 	bool ret;							\
 									\
 	asm volatile(_lock "cmpxchg16b %[ptr]"				\
-		     CC_SET(e)						\
 		     : CC_OUT(e) (ret),					\
 		       [ptr] "+m" (*(_ptr)),				\
 		       "+a" (o.low), "+d" (o.high)			\
diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h
index 462d071c87d4..9c95f2576df1 100644
--- a/arch/x86/include/asm/percpu.h
+++ b/arch/x86/include/asm/percpu.h
@@ -294,7 +294,6 @@ do {									\
 									\
 	asm qual (__pcpu_op_##size("cmpxchg") "%[nval], "		\
 		  __percpu_arg([var])					\
-		  CC_SET(z)						\
 		  : CC_OUT(z) (success),				\
 		    [oval] "+a" (pco_old__),				\
 		    [var] "+m" (__my_cpu_var(_var))			\
@@ -352,7 +351,6 @@ do {									\
 	asm_inline qual (						\
 		ALTERNATIVE("call this_cpu_cmpxchg8b_emu",		\
 			    "cmpxchg8b " __percpu_arg([var]), X86_FEATURE_CX8) \
-		CC_SET(z)						\
 		: ALT_OUTPUT_SP(CC_OUT(z) (success),			\
 				[var] "+m" (__my_cpu_var(_var)),	\
 				"+a" (old__.low), "+d" (old__.high))	\
@@ -421,7 +419,6 @@ do {									\
 	asm_inline qual (						\
 		ALTERNATIVE("call this_cpu_cmpxchg16b_emu",		\
 			    "cmpxchg16b " __percpu_arg([var]), X86_FEATURE_CX16) \
-		CC_SET(z)						\
 		: ALT_OUTPUT_SP(CC_OUT(z) (success),			\
 				[var] "+m" (__my_cpu_var(_var)),	\
 				"+a" (old__.low), "+d" (old__.high))	\
@@ -570,7 +567,6 @@ do {									\
 	bool oldbit;							\
 									\
 	asm volatile("btl %[nr], " __percpu_arg([var])			\
-		     CC_SET(c)						\
 		     : CC_OUT(c) (oldbit)				\
 		     : [var] "m" (__my_cpu_var(_var)),			\
 		       [nr] "rI" (_nr));				\
diff --git a/arch/x86/include/asm/rmwcc.h b/arch/x86/include/asm/rmwcc.h
index a54303e3dfa1..081311e22438 100644
--- a/arch/x86/include/asm/rmwcc.h
+++ b/arch/x86/include/asm/rmwcc.h
@@ -9,7 +9,7 @@
 #define __GEN_RMWcc(fullop, _var, cc, clobbers, ...)			\
 ({									\
 	bool c;								\
-	asm volatile (fullop CC_SET(cc)					\
+	asm volatile (fullop						\
 			: [var] "+m" (_var), CC_OUT(cc) (c)		\
 			: __VA_ARGS__ : clobbers);			\
 	c;								\
diff --git a/arch/x86/include/asm/sev.h b/arch/x86/include/asm/sev.h
index ba7999f66abe..5bd058d3e133 100644
--- a/arch/x86/include/asm/sev.h
+++ b/arch/x86/include/asm/sev.h
@@ -440,7 +440,6 @@ static inline int pvalidate(unsigned long vaddr, bool rmp_psize, bool validate)
 
 	/* "pvalidate" mnemonic support in binutils 2.36 and newer */
 	asm volatile(".byte 0xF2, 0x0F, 0x01, 0xFF\n\t"
-		     CC_SET(c)
 		     : CC_OUT(c) (no_rmpupdate), "=a"(rc)
 		     : "a"(vaddr), "c"(rmp_psize), "d"(validate)
 		     : "memory", "cc");
diff --git a/arch/x86/include/asm/signal.h b/arch/x86/include/asm/signal.h
index 4a4043ca6493..e0d37bf00f27 100644
--- a/arch/x86/include/asm/signal.h
+++ b/arch/x86/include/asm/signal.h
@@ -83,7 +83,7 @@ static inline int __const_sigismember(sigset_t *set, int _sig)
 static inline int __gen_sigismember(sigset_t *set, int _sig)
 {
 	bool ret;
-	asm("btl %2,%1" CC_SET(c)
+	asm("btl %2,%1"
 	    : CC_OUT(c) (ret) : "m"(*set), "Ir"(_sig-1));
 	return ret;
 }
diff --git a/arch/x86/include/asm/special_insns.h b/arch/x86/include/asm/special_insns.h
index b905076cf7f6..9c1cc0ef8f3c 100644
--- a/arch/x86/include/asm/special_insns.h
+++ b/arch/x86/include/asm/special_insns.h
@@ -274,7 +274,6 @@ static inline int enqcmds(void __iomem *dst, const void *src)
 	 * See movdir64b()'s comment on operand specification.
 	 */
 	asm volatile(".byte 0xf3, 0x0f, 0x38, 0xf8, 0x02, 0x66, 0x90"
-		     CC_SET(z)
 		     : CC_OUT(z) (zf), "+m" (*__dst)
 		     : "m" (*__src), "a" (__dst), "d" (__src));
 
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
index 3a7755c1a441..c37063121aaa 100644
--- a/arch/x86/include/asm/uaccess.h
+++ b/arch/x86/include/asm/uaccess.h
@@ -417,7 +417,6 @@ do {									\
 	__typeof__(*(_ptr)) __new = (_new);				\
 	asm volatile("\n"						\
 		     "1: " LOCK_PREFIX "cmpxchg"itype" %[new], %[ptr]\n"\
-		     CC_SET(z)						\
 		     "2:\n"						\
 		     _ASM_EXTABLE_TYPE_REG(1b, 2b, EX_TYPE_EFAULT_REG,	\
 					   %[errout])			\
diff --git a/tools/arch/x86/include/asm/asm.h b/tools/arch/x86/include/asm/asm.h
index f66cf34f6197..b97b3b53045f 100644
--- a/tools/arch/x86/include/asm/asm.h
+++ b/tools/arch/x86/include/asm/asm.h
@@ -109,11 +109,10 @@
 #endif
 
 /*
- * Macros to generate condition code outputs from inline assembly,
+ * Generate condition code outputs from inline assembly.
  * The output operand must be type "bool".
  */
-# define CC_SET(c) "\n\t/* output condition code " #c "*/\n"
-# define CC_OUT(c) "=@cc" #c
+#define CC_OUT(c) "=@cc" #c
 
 #ifdef __KERNEL__
 
-- 
2.48.1


  parent reply	other threads:[~2025-03-14 21:41 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-14 21:41 [PATCH 00/20] x86: Cleanup alternative_io() and friends, prep for asm_call() Josh Poimboeuf
2025-03-14 21:41 ` [PATCH 01/20] x86/cpu: Use named asm operands in prefetch[w]() Josh Poimboeuf
2025-03-14 21:41 ` [PATCH 02/20] x86/apic: Use named asm operands in native_apic_mem_write() Josh Poimboeuf
2025-03-14 21:41 ` [PATCH 03/20] x86/mm: Use named asm operands in task_size_max() Josh Poimboeuf
2025-03-14 21:41 ` [PATCH 04/20] x86/cpu: Use named asm operands in clflushopt() Josh Poimboeuf
2025-03-14 23:46   ` Linus Torvalds
2025-03-15  0:07     ` Josh Poimboeuf
2025-03-15  8:42       ` Ingo Molnar
2025-03-15  9:25         ` Ingo Molnar
2025-03-14 21:41 ` [PATCH 05/20] x86/asm: Always use flag output operands Josh Poimboeuf
2025-03-14 21:41 ` Josh Poimboeuf [this message]
2025-03-15  9:25   ` [PATCH 06/20] x86/asm: Remove CC_SET() Uros Bizjak
2025-03-14 21:41 ` [PATCH 07/20] x86/alternative: Remove operand numbering restrictions Josh Poimboeuf
2025-03-14 21:41 ` [PATCH 08/20] x86/asm: Replace ASM_{OUTPUT,INPUT}() with ARG() Josh Poimboeuf
2025-03-14 21:41 ` [PATCH 09/20] x86/alternative: Simplify alternative_io() interface Josh Poimboeuf
2025-03-14 21:41 ` [PATCH 10/20] x86/alternative: Add alternative_2_io() Josh Poimboeuf
2025-03-14 21:41 ` [PATCH 11/20] x86/alternative: Make alternative() a wrapper around alternative_io() Josh Poimboeuf
2025-03-14 21:41 ` [PATCH 12/20] x86/cpu: Use alternative_io() in prefetch[w]() Josh Poimboeuf
2025-03-14 21:41 ` [PATCH 13/20] x86/alternative: Remove alternative_input() Josh Poimboeuf
2025-03-14 21:41 ` [PATCH 14/20] x86/barrier: Use alternative_io() in 32-bit barrier functions Josh Poimboeuf
2025-03-14 23:49   ` Linus Torvalds
2025-03-14 23:54     ` Linus Torvalds
2025-03-15  0:09       ` Josh Poimboeuf
2025-03-15  0:16         ` Linus Torvalds
2025-03-15  8:47           ` Ingo Molnar
2025-03-15  0:05     ` Josh Poimboeuf
2025-03-15  9:14       ` Ingo Molnar
2025-03-17 20:04       ` David Laight
2025-03-18  0:11         ` Josh Poimboeuf
2025-03-18 22:06           ` David Laight
2025-03-18 22:29             ` Josh Poimboeuf
2025-03-15  8:52     ` Ingo Molnar
2025-03-14 21:41 ` [PATCH 15/20] x86/cpu/amd: Use named asm operands in asm_clear_divider() Josh Poimboeuf
2025-03-15  9:01   ` Uros Bizjak
2025-03-15 10:00     ` Uros Bizjak
2025-03-14 21:41 ` [PATCH 16/20] x86/cpu: Use alternative_io() in amd_clear_divider() Josh Poimboeuf
2025-03-15  9:03   ` Uros Bizjak
2025-03-14 21:41 ` [PATCH 17/20] x86/smap: Use named asm operands in smap_{save,restore}() Josh Poimboeuf
2025-03-14 22:51   ` Andrew Cooper
2025-03-14 23:56     ` Andrew Cooper
2025-03-14 21:41 ` [PATCH 18/20] x86/smap: Use alternative_io() " Josh Poimboeuf
2025-03-15  9:09   ` Uros Bizjak
2025-03-14 21:41 ` [PATCH 19/20] x86/uaccess: Use alternative_io() in __untagged_addr() Josh Poimboeuf
2025-03-15  9:12   ` Uros Bizjak
2025-03-14 21:41 ` [PATCH 20/20] x86/msr: Use alternative_2_io() in rdtsc_ordered() Josh Poimboeuf
2025-03-14 22:25 ` [PATCH 00/20] x86: Cleanup alternative_io() and friends, prep for asm_call() Josh Poimboeuf
2025-03-15  9:52   ` Uros Bizjak

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=fc92a93060fe0f17bbc9fcb2d447463fd3f9296c.1741988314.git.jpoimboe@kernel.org \
    --to=jpoimboe@kernel.org \
    --cc=andrew.cooper3@citrix.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=torvalds@linux-foundation.org \
    --cc=ubizjak@gmail.com \
    --cc=x86@kernel.org \
    /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®