]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
perf parse-regs: Always build perf register functions
authorLeo Yan <leo.yan@linux.dev>
Wed, 14 Feb 2024 11:39:45 +0000 (19:39 +0800)
committerNamhyung Kim <namhyung@kernel.org>
Thu, 15 Feb 2024 21:48:20 +0000 (13:48 -0800)
Currently, the macro HAVE_PERF_REGS_SUPPORT is used as a switch to turn
on or turn off the code of perf registers. If any architecture cannot
support perf register, it disables the perf register parsing, for both
the native parsing and cross parsing for other architectures.

To support both the native parsing and cross parsing, the tool should
always build the perf regs functions. Thus, this patch removes
HAVE_PERF_REGS_SUPPORT from the perf regs files.

Signed-off-by: Leo Yan <leo.yan@linux.dev>
Reviewed-by: Ian Rogers <irogers@google.com>
Cc: James Clark <james.clark@arm.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: Guo Ren <guoren@kernel.org>
Cc: Will Deacon <will@kernel.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Ming Wang <wangming01@loongson.cn>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: linux-csky@vger.kernel.org
Cc: linux-riscv@lists.infradead.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20240214113947.240957-3-leo.yan@linux.dev
tools/perf/util/perf-regs-arch/perf_regs_aarch64.c
tools/perf/util/perf-regs-arch/perf_regs_arm.c
tools/perf/util/perf-regs-arch/perf_regs_csky.c
tools/perf/util/perf-regs-arch/perf_regs_loongarch.c
tools/perf/util/perf-regs-arch/perf_regs_mips.c
tools/perf/util/perf-regs-arch/perf_regs_powerpc.c
tools/perf/util/perf-regs-arch/perf_regs_riscv.c
tools/perf/util/perf-regs-arch/perf_regs_s390.c
tools/perf/util/perf-regs-arch/perf_regs_x86.c
tools/perf/util/perf_regs.c
tools/perf/util/perf_regs.h

index 696566c54768775f8dafd75ab1692b1ad0242ca7..9dcda80d310f014b4809d3c358c333789b8ca34e 100644 (file)
@@ -1,7 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 
-#ifdef HAVE_PERF_REGS_SUPPORT
-
 #include "../perf_regs.h"
 #include "../../../arch/arm64/include/uapi/asm/perf_regs.h"
 
@@ -92,5 +90,3 @@ uint64_t __perf_reg_sp_arm64(void)
 {
        return PERF_REG_ARM64_SP;
 }
-
-#endif
index 700fd07cd2aa32097960e369053938a70f11367f..e29d130a587aa700806c5afae523c3aba5f80190 100644 (file)
@@ -1,7 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 
-#ifdef HAVE_PERF_REGS_SUPPORT
-
 #include "../perf_regs.h"
 #include "../../../arch/arm/include/uapi/asm/perf_regs.h"
 
@@ -56,5 +54,3 @@ uint64_t __perf_reg_sp_arm(void)
 {
        return PERF_REG_ARM_SP;
 }
-
-#endif
index a2841094e096e75af4c42e22d81bdc2b08ccb0a7..75b461ef2eba83163cf55bbd3552531699b61294 100644 (file)
@@ -1,7 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 
-#ifdef HAVE_PERF_REGS_SUPPORT
-
 #include "../perf_regs.h"
 #include "../../arch/csky/include/uapi/asm/perf_regs.h"
 
@@ -96,5 +94,3 @@ uint64_t __perf_reg_sp_csky(void)
 {
        return PERF_REG_CSKY_SP;
 }
-
-#endif
index a9ba0f934123db0ebc7fdec70735984afbf6a537..043f97f4e3ac4a74ca3940a849a327308375ee37 100644 (file)
@@ -1,7 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 
-#ifdef HAVE_PERF_REGS_SUPPORT
-
 #include "../perf_regs.h"
 #include "../../../arch/loongarch/include/uapi/asm/perf_regs.h"
 
@@ -87,5 +85,3 @@ uint64_t __perf_reg_sp_loongarch(void)
 {
        return PERF_REG_LOONGARCH_R3;
 }
-
-#endif
index 5a45830cfbf58bf0dccd24a1b3650f4713905a6d..793178fc3c787f83bd3434857350e14846487da2 100644 (file)
@@ -1,7 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 
-#ifdef HAVE_PERF_REGS_SUPPORT
-
 #include "../perf_regs.h"
 #include "../../../arch/mips/include/uapi/asm/perf_regs.h"
 
@@ -83,5 +81,3 @@ uint64_t __perf_reg_sp_mips(void)
 {
        return PERF_REG_MIPS_R29;
 }
-
-#endif
index 1f0d682db74a76396ab0469ed8014b891aafbecb..08636bb09a3a67e46882f26c3d14a3d12b542ec1 100644 (file)
@@ -1,7 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 
-#ifdef HAVE_PERF_REGS_SUPPORT
-
 #include "../perf_regs.h"
 #include "../../../arch/powerpc/include/uapi/asm/perf_regs.h"
 
@@ -141,5 +139,3 @@ uint64_t __perf_reg_sp_powerpc(void)
 {
        return PERF_REG_POWERPC_R1;
 }
-
-#endif
index e432630be4c56e625ca2e26db5b01b52d7ec742f..337b687c655d04061758308988dd6450a78b9fe0 100644 (file)
@@ -1,7 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 
-#ifdef HAVE_PERF_REGS_SUPPORT
-
 #include "../perf_regs.h"
 #include "../../../arch/riscv/include/uapi/asm/perf_regs.h"
 
@@ -88,5 +86,3 @@ uint64_t __perf_reg_sp_riscv(void)
 {
        return PERF_REG_RISCV_SP;
 }
-
-#endif
index 1c7a46db778c88fd6f753257d8298fe6609658f4..d69bba88108000c28dbe97022fdc4b81784bf24b 100644 (file)
@@ -1,7 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 
-#ifdef HAVE_PERF_REGS_SUPPORT
-
 #include "../perf_regs.h"
 #include "../../../arch/s390/include/uapi/asm/perf_regs.h"
 
@@ -92,5 +90,3 @@ uint64_t __perf_reg_sp_s390(void)
 {
        return PERF_REG_S390_R15;
 }
-
-#endif
index 873c620f063426c5bb2a877533ba9bd24f14f9af..708954a9d35d7bfcf842dbd169e05a075e279ebd 100644 (file)
@@ -1,7 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 
-#ifdef HAVE_PERF_REGS_SUPPORT
-
 #include "../perf_regs.h"
 #include "../../../arch/x86/include/uapi/asm/perf_regs.h"
 
@@ -94,5 +92,3 @@ uint64_t __perf_reg_sp_x86(void)
 {
        return PERF_REG_X86_SP;
 }
-
-#endif
index e2275856b5704e46e57327dcd6d161c9a8d6c373..64724eb58dd5a5d2f03825b73a8d640f8f158b5d 100644 (file)
@@ -21,8 +21,6 @@ uint64_t __weak arch__user_reg_mask(void)
        return 0;
 }
 
-#ifdef HAVE_PERF_REGS_SUPPORT
-
 const char *perf_reg_name(int id, const char *arch)
 {
        const char *reg_name = NULL;
@@ -125,5 +123,3 @@ uint64_t perf_arch_reg_sp(const char *arch)
        pr_err("Fail to find SP register for arch %s, returns 0\n", arch);
        return 0;
 }
-
-#endif
index ecd2a5362042ae63059c29ce248c5a52eb120c40..7fd0c7b4cec16c9c1f7b3b47c151269851dbe5ac 100644 (file)
@@ -27,7 +27,6 @@ int arch_sdt_arg_parse_op(char *old_op, char **new_op);
 uint64_t arch__intr_reg_mask(void);
 uint64_t arch__user_reg_mask(void);
 
-#ifdef HAVE_PERF_REGS_SUPPORT
 extern const struct sample_reg sample_reg_masks[];
 
 const char *perf_reg_name(int id, const char *arch);
@@ -67,34 +66,4 @@ static inline uint64_t DWARF_MINIMAL_REGS(const char *arch)
        return (1ULL << perf_arch_reg_ip(arch)) | (1ULL << perf_arch_reg_sp(arch));
 }
 
-#else
-
-static inline uint64_t DWARF_MINIMAL_REGS(const char *arch __maybe_unused)
-{
-       return 0;
-}
-
-static inline const char *perf_reg_name(int id __maybe_unused, const char *arch __maybe_unused)
-{
-       return "unknown";
-}
-
-static inline int perf_reg_value(u64 *valp __maybe_unused,
-                                struct regs_dump *regs __maybe_unused,
-                                int id __maybe_unused)
-{
-       return 0;
-}
-
-static inline uint64_t perf_arch_reg_ip(const char *arch __maybe_unused)
-{
-       return 0;
-}
-
-static inline uint64_t perf_arch_reg_sp(const char *arch __maybe_unused)
-{
-       return 0;
-}
-
-#endif /* HAVE_PERF_REGS_SUPPORT */
 #endif /* __PERF_REGS_H */