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

Configure Feed

Select the types of activity you want to include in your feed.

perf dwarf-regs: Add MIPS perf to DWARF register number mapping functions

Despite an unused function declaration, there was no unwind-libdw for
MIPS but there is a perf_regs.h and a libdw implementation.

Fill in the pieces so hopefully MIPS unwinding with libdw works.

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Aditya Bodkhe <aditya.b1@linux.ibm.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Athira Rajeev <atrajeev@linux.ibm.com>
Cc: Chun-Tse Shao <ctshao@google.com>
Cc: Dmitriy Vyukov <dvyukov@google.com>
Cc: Dr. David Alan Gilbert <linux@treblig.org>
Cc: Guo Ren <guoren@kernel.org>
Cc: Haibo Xu <haibo1.xu@intel.com>
Cc: Howard Chu <howardchu95@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Krzysztof Łopatowski <krzysztof.m.lopatowski@gmail.com>
Cc: Leo Yan <leo.yan@linux.dev>
Cc: Mark Wielaard <mark@klomp.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: Sergei Trofimovich <slyich@gmail.com>
Cc: Shimin Guo <shimin.guo@skydio.com>
Cc: Stephen Brennan <stephen.s.brennan@oracle.com>
Cc: Thomas Falcon <thomas.falcon@intel.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Ian Rogers and committed by
Arnaldo Carvalho de Melo
406b51a9 1e452dd8

+21 -2
+1
tools/perf/util/dwarf-regs-arch/Build
··· 2 2 perf-util-$(CONFIG_LIBDW) += dwarf-regs-arm.o 3 3 perf-util-$(CONFIG_LIBDW) += dwarf-regs-csky.o 4 4 perf-util-$(CONFIG_LIBDW) += dwarf-regs-loongarch.o 5 + perf-util-$(CONFIG_LIBDW) += dwarf-regs-mips.o 5 6 perf-util-$(CONFIG_LIBDW) += dwarf-regs-powerpc.o 6 7 perf-util-$(CONFIG_LIBDW) += dwarf-regs-riscv.o 7 8 perf-util-$(CONFIG_LIBDW) += dwarf-regs-s390.o
+14
tools/perf/util/dwarf-regs-arch/dwarf-regs-mips.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + #include <errno.h> 3 + #include <dwarf-regs.h> 4 + #include "../../../arch/mips/include/uapi/asm/perf_regs.h" 5 + 6 + int __get_dwarf_regnum_for_perf_regnum_mips(int perf_regnum) 7 + { 8 + if (perf_regnum == PERF_REG_MIPS_PC) 9 + return 37; 10 + if (perf_regnum < 0 || perf_regnum >= PERF_REG_MIPS_MAX) 11 + return -ENOENT; 12 + 13 + return perf_regnum; 14 + }
+5
tools/perf/util/dwarf-regs.c
··· 179 179 return 103; 180 180 case EM_LOONGARCH: 181 181 return 74; 182 + case EM_MIPS: 183 + return 71; 182 184 default: 183 185 return 0; 184 186 } ··· 219 217 break; 220 218 case EM_LOONGARCH: 221 219 reg = __get_dwarf_regnum_for_perf_regnum_loongarch(perf_regnum); 220 + break; 221 + case EM_MIPS: 222 + reg = __get_dwarf_regnum_for_perf_regnum_mips(perf_regnum); 222 223 break; 223 224 default: 224 225 pr_err("ELF MACHINE %x is not supported.\n", machine);
+1
tools/perf/util/include/dwarf-regs.h
··· 113 113 int __get_dwarf_regnum_for_perf_regnum_powerpc(int perf_regnum); 114 114 int __get_dwarf_regnum_for_perf_regnum_riscv(int perf_regnum); 115 115 int __get_dwarf_regnum_for_perf_regnum_s390(int perf_regnum); 116 + int __get_dwarf_regnum_for_perf_regnum_mips(int perf_regnum); 116 117 117 118 /* 118 119 * get_dwarf_regnum - Returns DWARF regnum from register name
-2
tools/perf/util/unwind-libdw.h
··· 9 9 struct perf_sample; 10 10 struct thread; 11 11 12 - bool libdw_set_initial_registers_mips(Dwfl_Thread *thread, void *arg); 13 - 14 12 struct unwind_info { 15 13 Dwfl *dwfl; 16 14 struct perf_sample *sample;