Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf parse-regs: Move out arch specific header from util/perf_regs.h

util/perf_regs.h includes another perf_regs.h:

#include <perf_regs.h>

Here it includes architecture specific header, for example, if we build
arm64 target, the header tools/perf/arch/arm64/include/perf_regs.h is
included.

We use this implicit way to include architecture specific header, which
is not directive; furthermore, util/perf_regs.c is coupled with the
architecture specific definitions.

This patch moves out arch specific header from util/perf_regs.h for
generalizing the 'util' folder, as a result, the source files in 'arch'
folder explicitly include architecture's perf_regs.h.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
Acked-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Eric Lin <eric.lin@sifive.com>
Cc: Fangrui Song <maskray@google.com>
Cc: Guo Ren <guoren@kernel.org>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Ivan Babrou <ivan@cloudflare.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Ming Wang <wangming01@loongson.cn>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sandipan Das <sandipan.das@amd.com>
Cc: Will Deacon <will@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-csky@vger.kernel.org
Cc: linux-riscv@lists.infradead.org
Link: https://lore.kernel.org/r/20230606014559.21783-7-leo.yan@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Leo Yan and committed by
Arnaldo Carvalho de Melo
ff382c1c 856caabf

+18 -2
+1
tools/perf/arch/arm/util/perf_regs.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 + #include "perf_regs.h" 2 3 #include "../../../util/perf_regs.h" 3 4 4 5 const struct sample_reg sample_reg_masks[] = {
+1
tools/perf/arch/arm/util/unwind-libdw.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 #include <elfutils/libdwfl.h> 3 + #include "perf_regs.h" 3 4 #include "../../../util/unwind-libdw.h" 4 5 #include "../../../util/perf_regs.h" 5 6 #include "../../../util/sample.h"
+1
tools/perf/arch/arm64/util/machine.c
··· 6 6 #include "debug.h" 7 7 #include "symbol.h" 8 8 #include "callchain.h" 9 + #include "perf_regs.h" 9 10 #include "record.h" 10 11 #include "util/perf_regs.h" 11 12
+1
tools/perf/arch/arm64/util/perf_regs.c
··· 6 6 #include <linux/kernel.h> 7 7 #include <linux/zalloc.h> 8 8 9 + #include "perf_regs.h" 9 10 #include "../../../perf-sys.h" 10 11 #include "../../../util/debug.h" 11 12 #include "../../../util/event.h"
+1
tools/perf/arch/arm64/util/unwind-libdw.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 #include <elfutils/libdwfl.h> 3 + #include "perf_regs.h" 3 4 #include "../../../util/unwind-libdw.h" 4 5 #include "../../../util/perf_regs.h" 5 6 #include "../../../util/sample.h"
+1
tools/perf/arch/csky/util/perf_regs.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 + #include "perf_regs.h" 2 3 #include "../../util/perf_regs.h" 3 4 4 5 const struct sample_reg sample_reg_masks[] = {
+1
tools/perf/arch/csky/util/unwind-libdw.c
··· 2 2 // Copyright (C) 2019 Hangzhou C-SKY Microsystems co.,ltd. 3 3 4 4 #include <elfutils/libdwfl.h> 5 + #include "perf_regs.h" 5 6 #include "../../util/unwind-libdw.h" 6 7 #include "../../util/perf_regs.h" 7 8 #include "../../util/event.h"
+1
tools/perf/arch/loongarch/util/perf_regs.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 + #include "perf_regs.h" 2 3 #include "../../../util/perf_regs.h" 3 4 4 5 const struct sample_reg sample_reg_masks[] = {
+1
tools/perf/arch/loongarch/util/unwind-libdw.c
··· 2 2 /* Copyright (C) 2020-2023 Loongson Technology Corporation Limited */ 3 3 4 4 #include <elfutils/libdwfl.h> 5 + #include "perf_regs.h" 5 6 #include "../../util/unwind-libdw.h" 6 7 #include "../../util/perf_regs.h" 7 8 #include "../../util/sample.h"
+1
tools/perf/arch/mips/util/perf_regs.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 + #include "perf_regs.h" 2 3 #include "../../util/perf_regs.h" 3 4 4 5 const struct sample_reg sample_reg_masks[] = {
+1
tools/perf/arch/powerpc/util/perf_regs.c
··· 4 4 #include <regex.h> 5 5 #include <linux/zalloc.h> 6 6 7 + #include "perf_regs.h" 7 8 #include "../../../util/perf_regs.h" 8 9 #include "../../../util/debug.h" 9 10 #include "../../../util/event.h"
+1
tools/perf/arch/powerpc/util/unwind-libdw.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 #include <elfutils/libdwfl.h> 3 3 #include <linux/kernel.h> 4 + #include "perf_regs.h" 4 5 #include "../../../util/unwind-libdw.h" 5 6 #include "../../../util/perf_regs.h" 6 7 #include "../../../util/sample.h"
+1
tools/perf/arch/riscv/util/perf_regs.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 + #include "perf_regs.h" 2 3 #include "../../util/perf_regs.h" 3 4 4 5 const struct sample_reg sample_reg_masks[] = {
+1
tools/perf/arch/riscv/util/unwind-libdw.c
··· 2 2 /* Copyright (C) 2019 Hangzhou C-SKY Microsystems co.,ltd. */ 3 3 4 4 #include <elfutils/libdwfl.h> 5 + #include "perf_regs.h" 5 6 #include "../../util/unwind-libdw.h" 6 7 #include "../../util/perf_regs.h" 7 8 #include "../../util/sample.h"
+1
tools/perf/arch/s390/util/perf_regs.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 + #include "perf_regs.h" 2 3 #include "../../util/perf_regs.h" 3 4 4 5 const struct sample_reg sample_reg_masks[] = {
+1
tools/perf/arch/s390/util/unwind-libdw.c
··· 5 5 #include "../../util/event.h" 6 6 #include "../../util/sample.h" 7 7 #include "dwarf-regs-table.h" 8 + #include "perf_regs.h" 8 9 9 10 10 11 bool libdw__arch_set_initial_registers(Dwfl_Thread *thread, void *arg)
+1
tools/perf/arch/x86/util/perf_regs.c
··· 5 5 #include <linux/kernel.h> 6 6 #include <linux/zalloc.h> 7 7 8 + #include "perf_regs.h" 8 9 #include "../../../perf-sys.h" 9 10 #include "../../../util/perf_regs.h" 10 11 #include "../../../util/debug.h"
+1
tools/perf/arch/x86/util/unwind-libdw.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 #include <elfutils/libdwfl.h> 3 + #include "perf_regs.h" 3 4 #include "../../../util/unwind-libdw.h" 4 5 #include "../../../util/perf_regs.h" 5 6 #include "util/sample.h"
-2
tools/perf/util/perf_regs.h
··· 30 30 #ifdef HAVE_PERF_REGS_SUPPORT 31 31 extern const struct sample_reg sample_reg_masks[]; 32 32 33 - #include <perf_regs.h> 34 - 35 33 const char *perf_reg_name(int id, const char *arch); 36 34 int perf_reg_value(u64 *valp, struct regs_dump *regs, int id); 37 35 uint64_t perf_arch_reg_ip(const char *arch);