Skip to contentSkip to conversation

uapi: enforce non-asm rule for 128-bit bitmasks macros

PATCH In review Yury Norov 2 participants 3 messages Aug 3, 2024 – Aug 5, 2024 Bitmap API

lore
Share & tools
lore

Yury Norov

author maintainer
#0 lore raw

PATCH 1/1 uapi: enforce non-asm rule for 128-bit bitmasks macros

The macros wouldn't work in all assembler flavors for reasons described in the comments on top of declarations. Enforce it for more by adding !__ASSEMBLY__ guard.

---
 include/linux/bits.h       | 2 ++
 include/uapi/linux/const.h | 2 ++
 2 files changed, 4 insertions(+)
include/linux/bits.h +2 -0
index bf99feb5570e..60044b608817 100644
@@ -36,6 +36,7 @@
 #define GENMASK_ULL(h, l) \
 	(GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l))
 
+#if !defined(__ASSEMBLY__)
 /*
  * Missing asm support
  *
@@ -48,5 +49,6 @@
  */
 #define GENMASK_U128(h, l) \
 	(GENMASK_INPUT_CHECK(h, l) + __GENMASK_U128(h, l))
+#endif
 
 #endif	/* __LINUX_BITS_H */
include/uapi/linux/const.h +2 -0
index 5be12e8f8f9c..e16be0d37746 100644
@@ -28,6 +28,7 @@
 #define _BITUL(x)	(_UL(1) << (x))
 #define _BITULL(x)	(_ULL(1) << (x))
 
+#if !defined(__ASSEMBLY__)
 /*
  * Missing asm support
  *
@@ -42,6 +43,7 @@
  * GENMASK_U128() which would then start supporting asm code.
  */
 #define _BIT128(x)	((unsigned __int128)(1) << (x))
+#endif
 
 #define __ALIGN_KERNEL(x, a)		__ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
 #define __ALIGN_KERNEL_MASK(x, mask)	(((x) + (mask)) & ~(mask))
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Yury Norov

The macros wouldn't work in all assembler flavors for reasons described in the comments on top of declarations. Enforce it for more by adding !__ASSEMBLY__ guard.

Right, this makes sense, should have added in the original patch itself.

Quoted 2 lines
Quoted 44 lines
---
 include/linux/bits.h       | 2 ++
 include/uapi/linux/const.h | 2 ++
 2 files changed, 4 insertions(+)
include/linux/bits.h +2 -0
index bf99feb5570e..60044b608817 100644
@@ -36,6 +36,7 @@
 #define GENMASK_ULL(h, l) \
 	(GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l))
 
+#if !defined(__ASSEMBLY__)
 /*
  * Missing asm support
  *
@@ -48,5 +49,6 @@
  */
 #define GENMASK_U128(h, l) \
 	(GENMASK_INPUT_CHECK(h, l) + __GENMASK_U128(h, l))
+#endif
 
 #endif	/* __LINUX_BITS_H */
include/uapi/linux/const.h +2 -0
index 5be12e8f8f9c..e16be0d37746 100644
@@ -28,6 +28,7 @@
 #define _BITUL(x)	(_UL(1) << (x))
 #define _BITULL(x)	(_ULL(1) << (x))
 
+#if !defined(__ASSEMBLY__)
 /*
  * Missing asm support
  *
@@ -42,6 +43,7 @@
  * GENMASK_U128() which would then start supporting asm code.
  */
 #define _BIT128(x)	((unsigned __int128)(1) << (x))
+#endif
 
 #define __ALIGN_KERNEL(x, a)		__ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
 #define __ALIGN_KERNEL_MASK(x, mask)	(((x) + (mask)) & ~(mask))
author maintainer
#2 lore raw
Quoted 11 lines · Anshuman Khandual
Quoted 3 lines · Yury Norov

The macros wouldn't work in all assembler flavors for reasons described in the comments on top of declarations. Enforce it for more by adding !__ASSEMBLY__ guard.

Right, this makes sense, should have added in the original patch itself.

Quoted 2 lines

Thanks, adding in bitmap-for-next.

Thanks,
Yury