tools: Copy the bitops files accessed from the kernel and check for drift
tip-bot for Arnaldo Carvalho de Melo
merge botCommit-ID: de1e17b1d0c81be472039798698b517c8a68b516 Gitweb: http://git.kernel.org/tip/de1e17b1d0c81be472039798698b517c8a68b516 Author: Arnaldo Carvalho de Melo <[email protected]> AuthorDate: Mon, 18 Jul 2016 18:13:22 -0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Mon, 18 Jul 2016 18:33:41 -0300
tools: Copy the bitops files accessed from the kernel and check for drift
copy some more kernel files accessed from tools/, check for drift.
Cc Adrian Hunter <[email protected]>
Cc David Ahern <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Wang Nan <[email protected]>
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
--- tools/include/asm-generic/bitops/__fls.h | 44 +++++++++++++++++++++++- tools/include/asm-generic/bitops/arch_hweight.h | 26 +++++++++++++- tools/include/asm-generic/bitops/const_hweight.h | 44 +++++++++++++++++++++++- tools/include/asm-generic/bitops/fls.h | 42 +++++++++++++++++++++- tools/include/asm-generic/bitops/fls64.h | 37 +++++++++++++++++++- tools/perf/MANIFEST | 5 --- tools/perf/Makefile.perf | 15 ++++++++ 7 files changed, 203 insertions(+), 10 deletions(-)
tools/include/asm-generic/bitops/__fls.h +43 -1
@@ -1 +1,43 @@ -#include "../../../../include/asm-generic/bitops/__fls.h" +#ifndef _ASM_GENERIC_BITOPS___FLS_H_ +#define _ASM_GENERIC_BITOPS___FLS_H_ + +#include <asm/types.h> + +/** +* __fls - find last (most-significant) set bit in a long word +* @word: the word to search +* +* Undefined if no set bit exists, so code should check against 0 first. +*/ +static __always_inline unsigned long __fls (unsigned long word) +{ +int num =BITS_PER_LONG -1 ; + +#if BITS_PER_LONG ==64 +if (!(word & (~0ul <<32 ))) { + num -=32 ; + word <<=32 ; + } +#endif +if (!(word & (~0ul << (BITS_PER_LONG -16 )))) { + num -=16 ; + word <<=16 ; + } +if (!(word & (~0ul << (BITS_PER_LONG -8 )))) { + num -=8 ; + word <<=8 ; + } +if (!(word & (~0ul << (BITS_PER_LONG -4 )))) { + num -=4 ; + word <<=4 ; + } +if (!(word & (~0ul << (BITS_PER_LONG -2 )))) { + num -=2 ; + word <<=2 ; + } +if (!(word & (~0ul << (BITS_PER_LONG -1 )))) + num -=1 ; +return num; +} + +#endif /* _ASM_GENERIC_BITOPS___FLS_H_ */
tools/include/asm-generic/bitops/arch_hweight.h +25 -1
@@ -1 +1,25 @@ -#include "../../../../include/asm-generic/bitops/arch_hweight.h" +#ifndef _ASM_GENERIC_BITOPS_ARCH_HWEIGHT_H_ +#define _ASM_GENERIC_BITOPS_ARCH_HWEIGHT_H_ + +#include <asm/types.h> + +static inline unsigned int __arch_hweight32 (unsigned int w) +{ +return __sw_hweight32 (w); +} + +static inline unsigned int __arch_hweight16 (unsigned int w) +{ +return __sw_hweight16 (w); +} + +static inline unsigned int __arch_hweight8 (unsigned int w) +{ +return __sw_hweight8 (w); +} + +static inline unsigned long __arch_hweight64 (__u64 w) +{ +return __sw_hweight64 (w); +} +#endif /* _ASM_GENERIC_BITOPS_HWEIGHT_H_ */
tools/include/asm-generic/bitops/const_hweight.h +43 -1
44 lines not on this page · raw message
tools/include/asm-generic/bitops/fls.h +41 -1
42 lines not on this page · raw message
tools/include/asm-generic/bitops/fls64.h +36 -1
@@ -1 +1,36 @@ -#include "../../../../include/asm-generic/bitops/fls64.h" +#ifndef _ASM_GENERIC_BITOPS_FLS64_H_ +#define _ASM_GENERIC_BITOPS_FLS64_H_ + +#include <asm/types.h> + +/** +* fls64 - find last set bit in a 64-bit word +* @x: the word to search +* +* This is defined in a similar way as the libc and compiler builtin +* ffsll, but returns the position of the most significant set bit. +* +* fls64(value) returns 0 if value is 0 or the position of the last +* set bit if value is nonzero. The last (most significant) bit is +* at position 64. +*/ +#if BITS_PER_LONG ==32 +static __always_inline int fls64(__u64 x) +{ +__u32 h = x >>32 ; +if (h) +return fls (h) +32 ; +return fls (x); +} +#elif BITS_PER_LONG ==64 +static __always_inline int fls64(__u64 x) +{ +if (x ==0 ) +return 0 ; +return __fls (x) +1 ; +} +#else +#error BITS_PER_LONG not 32 or 64 +#endif + +#endif /* _ASM_GENERIC_BITOPS_FLS64_H_ */
tools/perf/MANIFEST +0 -5
@@ -77,11 +77,6 @@ tools/include/linux/stringify.h tools/include/linux/types.h tools/include/linux/err.h tools/include/linux/bitmap.h -include/asm-generic/bitops/arch_hweight.h -include/asm-generic/bitops/const_hweight.h -include/asm-generic/bitops/fls64.h -include/asm-generic/bitops/__fls.h -include/asm-generic/bitops/fls.h include/linux/list.h include/linux/hash.h tools/arch/*/include/uapi/asm/perf_regs.h
tools/perf/Makefile.perf +15 -0
@@ -411,6 +411,21 @@ $(PERF_IN): prepare FORCE @(test -f ../../arch/arm64/include/uapi/asm/kvm.h && ( \ (diff -B ../arch/arm64/include/uapi/asm/kvm.h ../../arch/arm64/include/uapi/asm/kvm.h >/dev/null) \ || echo "Warning: tools/arch/arm64/include/uapi/asm/kvm.h differs from kernel" >&2 )) || true + @(test -f ../../include/asm-generic/bitops/arch_hweight.h && ( \ + (diff -B ../include/asm-generic/bitops/arch_hweight.h ../../include/asm-generic/bitops/arch_hweight.h >/dev/null) \ + || echo "Warning: tools/include/asm-generic/bitops/arch_hweight.h differs from kernel" >&2 )) || true + @(test -f ../../include/asm-generic/bitops/const_hweight.h && ( \ + (diff -B ../include/asm-generic/bitops/const_hweight.h ../../include/asm-generic/bitops/const_hweight.h >/dev/null) \ + || echo "Warning: tools/include/asm-generic/bitops/const_hweight.h differs from kernel" >&2 )) || true + @(test -f ../../include/asm-generic/bitops/__fls.h && ( \ + (diff -B ../include/asm-generic/bitops/__fls.h ../../include/asm-generic/bitops/__fls.h >/dev/null) \ + || echo "Warning: tools/include/asm-generic/bitops/__fls.h differs from kernel" >&2 )) || true + @(test -f ../../include/asm-generic/bitops/fls.h && ( \ + (diff -B ../include/asm-generic/bitops/fls.h ../../include/asm-generic/bitops/fls.h >/dev/null) \ + || echo "Warning: tools/include/asm-generic/bitops/fls.h differs from kernel" >&2 )) || true + @(test -f ../../include/asm-generic/bitops/fls64.h && ( \ + (diff -B ../include/asm-generic/bitops/fls64.h ../../include/asm-generic/bitops/fls64.h >/dev/null) \ + || echo "Warning: tools/include/asm-generic/bitops/fls64.h differs from kernel" >&2 )) || true $(Q)$(MAKE) $(build)=perf $(OUTPUT)perf: $(PERFLIBS) $(PERF_IN) $(LIBTRACEEVENT_DYNAMIC_LIST)