umber-kernel/tools/include/linux
Leo Yan dfcbe01951 tools: Fix bitfield dependency failure
[ Upstream commit a537c0da168a08b0b6a7f7bd9e75f4cc8d45ff57 ]

A perf build failure was reported by Thomas Voegtle on stable kernel
v6.6.120:

    CC      tests/sample-parsing.o
    CC      util/intel-pt-decoder/intel-pt-pkt-decoder.o
    CC      util/perf-regs-arch/perf_regs_csky.o
    CC      util/arm-spe-decoder/arm-spe-pkt-decoder.o
    CC      util/perf-regs-arch/perf_regs_loongarch.o
  In file included from util/arm-spe-decoder/arm-spe-pkt-decoder.h:10,
                   from util/arm-spe-decoder/arm-spe-pkt-decoder.c:14:
  /local/git/linux-stable-rc/tools/include/linux/bitfield.h: In function ‘le16_encode_bits’:
  /local/git/linux-stable-rc/tools/include/linux/bitfield.h:166:31: error: implicit declaration of
  function ‘cpu_to_le16’; did you mean ‘htole16’? [-Werror=implicit-function-declaration]
    ____MAKE_OP(le##size,u##size,cpu_to_le##size,le##size##_to_cpu) \
                                 ^~~~~~~~~
  /local/git/linux-stable-rc/tools/include/linux/bitfield.h:149:9: note: in definition of macro
  ‘____MAKE_OP’
    return to((v & field_mask(field)) * field_multiplier(field)); \
           ^~
  /local/git/linux-stable-rc/tools/include/linux/bitfield.h:170:1: note: in expansion of macro
  ‘__MAKE_OP’
   __MAKE_OP(16)

Fix this by including linux/kernel.h, which provides the required
definitions.

The issue was not found on the mainline due to the relevant C files have
included kernel.h.  It'd be good to merge this change on mainline
as well for robustness.

Closes: https://lore.kernel.org/stable/3a44500b-d7c8-179f-61f6-e51cb50d3512@lio96.de/
Fixes: 64d86c03e1 ("perf arm-spe: Extend branch operations")
Reported-by: Hamza Mahfooz <hamzamahfooz@linux.microsoft.com>
Reported-by: Thomas Voegtle <tv@lio96.de>
Signed-off-by: Leo Yan <leo.yan@arm.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Ian Rogers <irogers@google.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Leo Yan <leo.yan@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
To: Sasha Levin <sashal@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2026-03-04 07:21:19 -05:00
..
sched
unaligned
align.h
args.h tools/testing: add linux/args.h header and fix radix, VMA tests 2025-08-19 16:35:54 -07:00
arm-smccc.h
atomic.h tools/include: implement a couple of atomic_t ops 2025-09-13 16:55:24 -07:00
bitfield.h tools: Fix bitfield dependency failure 2026-03-04 07:21:19 -05:00
bitmap.h tools bitmap: Add missing asm-generic/bitsperlong.h include 2025-10-02 15:09:32 -03:00
bitops.h
bits.h tools headers: Sync linux/bits.h with the kernel source 2025-08-18 12:38:42 -07:00
btf_ids.h
bug.h
build_bug.h tools headers: Syncronize linux/build_bug.h with the kernel sources 2025-06-16 14:05:11 -03:00
cache.h
cfi_types.h tools headers: kcfi: rename missed CONFIG_CFI_CLANG 2025-10-07 08:21:33 -07:00
compiler-gcc.h
compiler.h tools headers: Add stub definition for __iomem 2025-08-27 12:14:06 -06:00
compiler_types.h
const.h
container_of.h
coresight-pmu.h
ctype.h
debugfs.h
delay.h
err.h
export.h
filter.h
find.h
ftrace.h
gfp.h
gfp_types.h tools include: Replace tools linux/gfp_types.h with kernel version 2025-10-02 15:11:03 -03:00
hash.h
hashtable.h
init.h
interrupt.h
interval_tree_generic.h
io.h tools headers: Import asm-generic MMIO helpers 2025-08-27 12:14:06 -06:00
jhash.h
kallsyms.h kallsyms: fix build without execinfo 2025-07-09 21:07:51 -07:00
kasan-tags.h
kconfig.h
kern_levels.h
kernel.h
linkage.h
list.h
list_sort.h
log2.h
math.h
math64.h
mm.h
module.h
moduleparam.h
mutex.h
nmi.h
numa.h
objtool_types.h objtool: Validate kCFI calls 2025-08-18 14:23:09 +02:00
overflow.h
panic.h
pci_ids.h tools headers: Add symlink to linux/pci_ids.h 2025-08-27 12:14:07 -06:00
pfn.h
poison.h
prandom.h
rbtree.h
rbtree_augmented.h
rcu.h
refcount.h
ring_buffer.h
rwsem.h
seq_file.h
sizes.h
slab.h tools/testing: Add support for prefilled slab sheafs 2025-09-29 09:25:00 +02:00
spinlock.h
static_call_types.h
string.h
stringify.h
time64.h
types.h
unaligned.h
zalloc.h