mirror of
https://github.com/torvalds/linux.git
synced 2026-06-02 11:33:28 +02:00
Currently, some architecture-specific perf-regs functions, such as arch__intr_reg_mask() and arch__user_reg_mask(), are defined with the __weak attribute. This approach ensures that only functions matching the architecture of the build/run host are compiled and executed, reducing build time and binary size. However, this __weak attribute restricts these functions to be called only on the same architecture, preventing cross-architecture functionality. For example, a perf.data file captured on x86 cannot be parsed on an ARM platform. To address this limitation, this patch removes the __weak attribute from these perf-regs functions. The architecture-specific code is moved from the arch/ directory to the util/perf-regs-arch/ directory. The appropriate architectural functions are then called based on the EM_HOST. No functional changes are intended. Suggested-by: Ian Rogers <irogers@google.com> Reviewed-by: Ian Rogers <irogers@google.com> Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Albert Ou <aou@eecs.berkeley.edu> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexandre Ghiti <alex@ghiti.fr> Cc: Guo Ren <guoren@kernel.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@linaro.org> Cc: John Garry <john.g.garry@oracle.com> Cc: Mike Leach <mike.leach@linaro.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Palmer Dabbelt <palmer@dabbelt.com> Cc: Paul Walmsley <pjw@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Falcon <thomas.falcon@intel.com> Cc: Will Deacon <will@kernel.org> Cc: Xudong Hao <xudong.hao@intel.com> Cc: Zide Chen <zide.chen@intel.com> [ Fixed up somme fuzz with s390 and riscv Build files wrt removing perf_regs.o ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
62 lines
1.0 KiB
C
62 lines
1.0 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
#include "../perf_regs.h"
|
|
#include "../../arch/arm/include/perf_regs.h"
|
|
|
|
uint64_t __perf_reg_mask_arm(bool intr __maybe_unused)
|
|
{
|
|
return PERF_REGS_MASK;
|
|
}
|
|
|
|
const char *__perf_reg_name_arm(int id)
|
|
{
|
|
switch (id) {
|
|
case PERF_REG_ARM_R0:
|
|
return "r0";
|
|
case PERF_REG_ARM_R1:
|
|
return "r1";
|
|
case PERF_REG_ARM_R2:
|
|
return "r2";
|
|
case PERF_REG_ARM_R3:
|
|
return "r3";
|
|
case PERF_REG_ARM_R4:
|
|
return "r4";
|
|
case PERF_REG_ARM_R5:
|
|
return "r5";
|
|
case PERF_REG_ARM_R6:
|
|
return "r6";
|
|
case PERF_REG_ARM_R7:
|
|
return "r7";
|
|
case PERF_REG_ARM_R8:
|
|
return "r8";
|
|
case PERF_REG_ARM_R9:
|
|
return "r9";
|
|
case PERF_REG_ARM_R10:
|
|
return "r10";
|
|
case PERF_REG_ARM_FP:
|
|
return "fp";
|
|
case PERF_REG_ARM_IP:
|
|
return "ip";
|
|
case PERF_REG_ARM_SP:
|
|
return "sp";
|
|
case PERF_REG_ARM_LR:
|
|
return "lr";
|
|
case PERF_REG_ARM_PC:
|
|
return "pc";
|
|
default:
|
|
return NULL;
|
|
}
|
|
|
|
return NULL;
|
|
}
|
|
|
|
uint64_t __perf_reg_ip_arm(void)
|
|
{
|
|
return PERF_REG_ARM_PC;
|
|
}
|
|
|
|
uint64_t __perf_reg_sp_arm(void)
|
|
{
|
|
return PERF_REG_ARM_SP;
|
|
}
|