Skip to content

Commit 6cb8607

Browse files
committed
tools headers: Sync linux/bits.h with the kernel source
To pick up the changes in this cset: 104ea1c bits: unify the non-asm GENMASK*() 6d44712 bits: split the definition of the asm and non-asm GENMASK*() This addresses these perf build warnings: Warning: Kernel ABI header differences: diff -u tools/include/linux/bits.h include/linux/bits.h Please see tools/include/uapi/README for further details. Cc: Yury Norov <[email protected]> Signed-off-by: Namhyung Kim <[email protected]>
1 parent bd842ff commit 6cb8607

File tree

1 file changed

+6
-23
lines changed

1 file changed

+6
-23
lines changed

tools/include/linux/bits.h

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
#ifndef __LINUX_BITS_H
33
#define __LINUX_BITS_H
44

5-
#include <linux/const.h>
65
#include <vdso/bits.h>
76
#include <uapi/linux/bits.h>
8-
#include <asm/bitsperlong.h>
97

108
#define BIT_MASK(nr) (UL(1) << ((nr) % BITS_PER_LONG))
119
#define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
@@ -50,10 +48,14 @@
5048
(type_max(t) << (l) & \
5149
type_max(t) >> (BITS_PER_TYPE(t) - 1 - (h)))))
5250

51+
#define GENMASK(h, l) GENMASK_TYPE(unsigned long, h, l)
52+
#define GENMASK_ULL(h, l) GENMASK_TYPE(unsigned long long, h, l)
53+
5354
#define GENMASK_U8(h, l) GENMASK_TYPE(u8, h, l)
5455
#define GENMASK_U16(h, l) GENMASK_TYPE(u16, h, l)
5556
#define GENMASK_U32(h, l) GENMASK_TYPE(u32, h, l)
5657
#define GENMASK_U64(h, l) GENMASK_TYPE(u64, h, l)
58+
#define GENMASK_U128(h, l) GENMASK_TYPE(u128, h, l)
5759

5860
/*
5961
* Fixed-type variants of BIT(), with additional checks like GENMASK_TYPE(). The
@@ -79,28 +81,9 @@
7981
* BUILD_BUG_ON_ZERO is not available in h files included from asm files,
8082
* disable the input check if that is the case.
8183
*/
82-
#define GENMASK_INPUT_CHECK(h, l) 0
84+
#define GENMASK(h, l) __GENMASK(h, l)
85+
#define GENMASK_ULL(h, l) __GENMASK_ULL(h, l)
8386

8487
#endif /* !defined(__ASSEMBLY__) */
8588

86-
#define GENMASK(h, l) \
87-
(GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
88-
#define GENMASK_ULL(h, l) \
89-
(GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l))
90-
91-
#if !defined(__ASSEMBLY__)
92-
/*
93-
* Missing asm support
94-
*
95-
* __GENMASK_U128() depends on _BIT128() which would not work
96-
* in the asm code, as it shifts an 'unsigned __int128' data
97-
* type instead of direct representation of 128 bit constants
98-
* such as long and unsigned long. The fundamental problem is
99-
* that a 128 bit constant will get silently truncated by the
100-
* gcc compiler.
101-
*/
102-
#define GENMASK_U128(h, l) \
103-
(GENMASK_INPUT_CHECK(h, l) + __GENMASK_U128(h, l))
104-
#endif
105-
10689
#endif /* __LINUX_BITS_H */

0 commit comments

Comments
 (0)