diff options
14 files changed, 845 insertions, 0 deletions
diff --git a/conf/bblayers.conf.rpi.sample b/conf/bblayers.conf.rpi.sample index d6bda2e..adc0e68 100644 --- a/conf/bblayers.conf.rpi.sample +++ b/conf/bblayers.conf.rpi.sample | |||
@@ -34,6 +34,7 @@ BBLAYERS ?= " \ | |||
34 | ${BSPDIR}/sources/meta-raspberrypi \ | 34 | ${BSPDIR}/sources/meta-raspberrypi \ |
35 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ | 35 | ${BSPDIR}/sources/meta-openembedded/meta-oe \ |
36 | ${BSPDIR}/sources/meta-b2qt \ | 36 | ${BSPDIR}/sources/meta-b2qt \ |
37 | ${BSPDIR}/sources/meta-b2qt/meta-raspberrypi-extras \ | ||
37 | " | 38 | " |
38 | BBLAYERS_NON_REMOVABLE ?= " \ | 39 | BBLAYERS_NON_REMOVABLE ?= " \ |
39 | ${BSPDIR}/sources/poky/meta \ | 40 | ${BSPDIR}/sources/poky/meta \ |
diff --git a/meta-beagleboard-extras/recipes/linux/linux-mainline/ARM-perf-add-support-for-perf-registers-API.diff b/meta-beagleboard-extras/recipes/linux/linux-mainline/ARM-perf-add-support-for-perf-registers-API.diff new file mode 100644 index 0000000..13b251a --- /dev/null +++ b/meta-beagleboard-extras/recipes/linux/linux-mainline/ARM-perf-add-support-for-perf-registers-API.diff | |||
@@ -0,0 +1,128 @@ | |||
1 | From 8221f36672b7a1336c2bf245c394f0b5453784a1 Mon Sep 17 00:00:00 2001 | ||
2 | From: Will Deacon <will.deacon@arm.com> | ||
3 | Date: Thu, 26 Sep 2013 12:36:35 +0100 | ||
4 | Subject: [PATCH] ARM: perf: add support for perf registers API | ||
5 | |||
6 | This patch implements the functions required for the perf registers API, | ||
7 | allowing the perf tool to interface kernel register dumps with libunwind | ||
8 | in order to provide userspace backtracing. | ||
9 | |||
10 | B2Qt: Backported for 3.8 kernel | ||
11 | |||
12 | Cc: Jean Pihet <jean.pihet@linaro.org> | ||
13 | Signed-off-by: Will Deacon <will.deacon@arm.com> | ||
14 | --- | ||
15 | arch/arm/Kconfig | 2 ++ | ||
16 | arch/arm/include/uapi/asm/Kbuild | 1 + | ||
17 | arch/arm/include/uapi/asm/perf_regs.h | 23 +++++++++++++++++++++++ | ||
18 | arch/arm/kernel/Makefile | 1 + | ||
19 | arch/arm/kernel/perf_regs.c | 30 ++++++++++++++++++++++++++++++ | ||
20 | 5 files changed, 57 insertions(+) | ||
21 | create mode 100644 arch/arm/include/uapi/asm/perf_regs.h | ||
22 | create mode 100644 arch/arm/kernel/perf_regs.c | ||
23 | |||
24 | diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig | ||
25 | index 67874b8..6f630be 100644 | ||
26 | --- a/arch/arm/Kconfig | ||
27 | +++ b/arch/arm/Kconfig | ||
28 | @@ -46,6 +46,8 @@ config ARM | ||
29 | select HAVE_MEMBLOCK | ||
30 | select HAVE_OPROFILE if (HAVE_PERF_EVENTS) | ||
31 | select HAVE_PERF_EVENTS | ||
32 | + select HAVE_PERF_REGS | ||
33 | + select HAVE_PERF_USER_STACK_DUMP | ||
34 | select HAVE_REGS_AND_STACK_ACCESS_API | ||
35 | select HAVE_SYSCALL_TRACEPOINTS | ||
36 | select HAVE_UID16 | ||
37 | diff --git a/arch/arm/include/uapi/asm/Kbuild b/arch/arm/include/uapi/asm/Kbuild | ||
38 | index 47bcb2d..570b82f 100644 | ||
39 | --- a/arch/arm/include/uapi/asm/Kbuild | ||
40 | +++ b/arch/arm/include/uapi/asm/Kbuild | ||
41 | @@ -8,6 +8,7 @@ header-y += hwcap.h | ||
42 | header-y += ioctls.h | ||
43 | header-y += kvm_para.h | ||
44 | header-y += mman.h | ||
45 | +header-y += perf_regs.h | ||
46 | header-y += posix_types.h | ||
47 | header-y += ptrace.h | ||
48 | header-y += setup.h | ||
49 | diff --git a/arch/arm/include/uapi/asm/perf_regs.h b/arch/arm/include/uapi/asm/perf_regs.h | ||
50 | new file mode 100644 | ||
51 | index 0000000..ce59448 | ||
52 | --- /dev/null | ||
53 | +++ b/arch/arm/include/uapi/asm/perf_regs.h | ||
54 | @@ -0,0 +1,23 @@ | ||
55 | +#ifndef _ASM_ARM_PERF_REGS_H | ||
56 | +#define _ASM_ARM_PERF_REGS_H | ||
57 | + | ||
58 | +enum perf_event_arm_regs { | ||
59 | + PERF_REG_ARM_R0, | ||
60 | + PERF_REG_ARM_R1, | ||
61 | + PERF_REG_ARM_R2, | ||
62 | + PERF_REG_ARM_R3, | ||
63 | + PERF_REG_ARM_R4, | ||
64 | + PERF_REG_ARM_R5, | ||
65 | + PERF_REG_ARM_R6, | ||
66 | + PERF_REG_ARM_R7, | ||
67 | + PERF_REG_ARM_R8, | ||
68 | + PERF_REG_ARM_R9, | ||
69 | + PERF_REG_ARM_R10, | ||
70 | + PERF_REG_ARM_FP, | ||
71 | + PERF_REG_ARM_IP, | ||
72 | + PERF_REG_ARM_SP, | ||
73 | + PERF_REG_ARM_LR, | ||
74 | + PERF_REG_ARM_PC, | ||
75 | + PERF_REG_ARM_MAX, | ||
76 | +}; | ||
77 | +#endif /* _ASM_ARM_PERF_REGS_H */ | ||
78 | diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile | ||
79 | index 5bbec7b..c6ab18f 100644 | ||
80 | --- a/arch/arm/kernel/Makefile | ||
81 | +++ b/arch/arm/kernel/Makefile | ||
82 | @@ -69,6 +69,7 @@ obj-$(CONFIG_CPU_XSC3) += xscale-cp0.o | ||
83 | obj-$(CONFIG_CPU_MOHAWK) += xscale-cp0.o | ||
84 | obj-$(CONFIG_CPU_PJ4) += pj4-cp0.o | ||
85 | obj-$(CONFIG_IWMMXT) += iwmmxt.o | ||
86 | +obj-$(CONFIG_PERF_EVENTS) += perf_regs.o | ||
87 | obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o perf_event_cpu.o | ||
88 | AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt | ||
89 | obj-$(CONFIG_ARM_CPU_TOPOLOGY) += topology.o | ||
90 | diff --git a/arch/arm/kernel/perf_regs.c b/arch/arm/kernel/perf_regs.c | ||
91 | new file mode 100644 | ||
92 | index 0000000..6e4379c | ||
93 | --- /dev/null | ||
94 | +++ b/arch/arm/kernel/perf_regs.c | ||
95 | @@ -0,0 +1,30 @@ | ||
96 | + | ||
97 | +#include <linux/errno.h> | ||
98 | +#include <linux/kernel.h> | ||
99 | +#include <linux/perf_event.h> | ||
100 | +#include <linux/bug.h> | ||
101 | +#include <asm/perf_regs.h> | ||
102 | +#include <asm/ptrace.h> | ||
103 | + | ||
104 | +u64 perf_reg_value(struct pt_regs *regs, int idx) | ||
105 | +{ | ||
106 | + if (WARN_ON_ONCE((u32)idx >= PERF_REG_ARM_MAX)) | ||
107 | + return 0; | ||
108 | + | ||
109 | + return regs->uregs[idx]; | ||
110 | +} | ||
111 | + | ||
112 | +#define REG_RESERVED (~((1ULL << PERF_REG_ARM_MAX) - 1)) | ||
113 | + | ||
114 | +int perf_reg_validate(u64 mask) | ||
115 | +{ | ||
116 | + if (!mask || mask & REG_RESERVED) | ||
117 | + return -EINVAL; | ||
118 | + | ||
119 | + return 0; | ||
120 | +} | ||
121 | + | ||
122 | +u64 perf_reg_abi(struct task_struct *task) | ||
123 | +{ | ||
124 | + return PERF_SAMPLE_REGS_ABI_32; | ||
125 | +} | ||
126 | -- | ||
127 | 1.9.1 | ||
128 | |||
diff --git a/meta-beagleboard-extras/recipes/linux/linux-mainline/ARM-perf-wire-up-perf_regs-and-unwind-support-for-AR.patch b/meta-beagleboard-extras/recipes/linux/linux-mainline/ARM-perf-wire-up-perf_regs-and-unwind-support-for-AR.patch new file mode 100644 index 0000000..e3e8d21 --- /dev/null +++ b/meta-beagleboard-extras/recipes/linux/linux-mainline/ARM-perf-wire-up-perf_regs-and-unwind-support-for-AR.patch | |||
@@ -0,0 +1,163 @@ | |||
1 | From 26f603c457e0af9f5f6a0ddda66e69978c7f43b4 Mon Sep 17 00:00:00 2001 | ||
2 | From: Will Deacon <will.deacon@arm.com> | ||
3 | Date: Thu, 26 Sep 2013 12:36:36 +0100 | ||
4 | Subject: [PATCH] ARM: perf: wire up perf_regs and unwind support for ARM | ||
5 | |||
6 | This patch hooks in the perf_regs and libunwind code for ARM. | ||
7 | |||
8 | B2Qt: Backported for 3.8 kernel | ||
9 | |||
10 | Cc: Jean Pihet <jean.pihet@linaro.org> | ||
11 | Signed-off-by: Will Deacon <will.deacon@arm.com> | ||
12 | --- | ||
13 | tools/perf/Makefile | 4 +++ | ||
14 | tools/perf/arch/arm/Makefile | 3 ++ | ||
15 | tools/perf/arch/arm/include/perf_regs.h | 54 +++++++++++++++++++++++++++++++++ | ||
16 | tools/perf/arch/arm/util/unwind.c | 48 +++++++++++++++++++++++++++++ | ||
17 | 4 files changed, 109 insertions(+) | ||
18 | create mode 100644 tools/perf/arch/arm/include/perf_regs.h | ||
19 | create mode 100644 tools/perf/arch/arm/util/unwind.c | ||
20 | |||
21 | diff --git a/tools/perf/Makefile b/tools/perf/Makefile | ||
22 | index fb1b1c4..316c575 100644 | ||
23 | --- a/tools/perf/Makefile | ||
24 | +++ b/tools/perf/Makefile | ||
25 | @@ -84,6 +84,10 @@ ifeq ($(ARCH),x86_64) | ||
26 | NO_PERF_REGS := 0 | ||
27 | LIBUNWIND_LIBS = -lunwind -lunwind-x86_64 | ||
28 | endif | ||
29 | +ifeq ($(ARCH),arm) | ||
30 | + NO_PERF_REGS := 0 | ||
31 | + LIBUNWIND_LIBS = -lunwind -lunwind-arm | ||
32 | +endif | ||
33 | |||
34 | # Treat warnings as errors unless directed not to | ||
35 | ifneq ($(WERROR),0) | ||
36 | diff --git a/tools/perf/arch/arm/Makefile b/tools/perf/arch/arm/Makefile | ||
37 | index 15130b5..fe9b61e 100644 | ||
38 | --- a/tools/perf/arch/arm/Makefile | ||
39 | +++ b/tools/perf/arch/arm/Makefile | ||
40 | @@ -2,3 +2,6 @@ ifndef NO_DWARF | ||
41 | PERF_HAVE_DWARF_REGS := 1 | ||
42 | LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o | ||
43 | endif | ||
44 | +ifndef NO_LIBUNWIND | ||
45 | +LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind.o | ||
46 | +endif | ||
47 | diff --git a/tools/perf/arch/arm/include/perf_regs.h b/tools/perf/arch/arm/include/perf_regs.h | ||
48 | new file mode 100644 | ||
49 | index 0000000..2a1cfde | ||
50 | --- /dev/null | ||
51 | +++ b/tools/perf/arch/arm/include/perf_regs.h | ||
52 | @@ -0,0 +1,54 @@ | ||
53 | +#ifndef ARCH_PERF_REGS_H | ||
54 | +#define ARCH_PERF_REGS_H | ||
55 | + | ||
56 | +#include <stdlib.h> | ||
57 | +#include "../../util/types.h" | ||
58 | +#include <asm/perf_regs.h> | ||
59 | + | ||
60 | +#define PERF_REGS_MASK ((1ULL << PERF_REG_ARM_MAX) - 1) | ||
61 | +#define PERF_REG_IP PERF_REG_ARM_PC | ||
62 | +#define PERF_REG_SP PERF_REG_ARM_SP | ||
63 | + | ||
64 | +static inline const char *perf_reg_name(int id) | ||
65 | +{ | ||
66 | + switch (id) { | ||
67 | + case PERF_REG_ARM_R0: | ||
68 | + return "r0"; | ||
69 | + case PERF_REG_ARM_R1: | ||
70 | + return "r1"; | ||
71 | + case PERF_REG_ARM_R2: | ||
72 | + return "r2"; | ||
73 | + case PERF_REG_ARM_R3: | ||
74 | + return "r3"; | ||
75 | + case PERF_REG_ARM_R4: | ||
76 | + return "r4"; | ||
77 | + case PERF_REG_ARM_R5: | ||
78 | + return "r5"; | ||
79 | + case PERF_REG_ARM_R6: | ||
80 | + return "r6"; | ||
81 | + case PERF_REG_ARM_R7: | ||
82 | + return "r7"; | ||
83 | + case PERF_REG_ARM_R8: | ||
84 | + return "r8"; | ||
85 | + case PERF_REG_ARM_R9: | ||
86 | + return "r9"; | ||
87 | + case PERF_REG_ARM_R10: | ||
88 | + return "r10"; | ||
89 | + case PERF_REG_ARM_FP: | ||
90 | + return "fp"; | ||
91 | + case PERF_REG_ARM_IP: | ||
92 | + return "ip"; | ||
93 | + case PERF_REG_ARM_SP: | ||
94 | + return "sp"; | ||
95 | + case PERF_REG_ARM_LR: | ||
96 | + return "lr"; | ||
97 | + case PERF_REG_ARM_PC: | ||
98 | + return "pc"; | ||
99 | + default: | ||
100 | + return NULL; | ||
101 | + } | ||
102 | + | ||
103 | + return NULL; | ||
104 | +} | ||
105 | + | ||
106 | +#endif /* ARCH_PERF_REGS_H */ | ||
107 | diff --git a/tools/perf/arch/arm/util/unwind.c b/tools/perf/arch/arm/util/unwind.c | ||
108 | new file mode 100644 | ||
109 | index 0000000..da3dc95 | ||
110 | --- /dev/null | ||
111 | +++ b/tools/perf/arch/arm/util/unwind.c | ||
112 | @@ -0,0 +1,48 @@ | ||
113 | + | ||
114 | +#include <errno.h> | ||
115 | +#include <libunwind.h> | ||
116 | +#include "perf_regs.h" | ||
117 | +#include "../../util/unwind.h" | ||
118 | + | ||
119 | +int unwind__arch_reg_id(int regnum) | ||
120 | +{ | ||
121 | + switch (regnum) { | ||
122 | + case UNW_ARM_R0: | ||
123 | + return PERF_REG_ARM_R0; | ||
124 | + case UNW_ARM_R1: | ||
125 | + return PERF_REG_ARM_R1; | ||
126 | + case UNW_ARM_R2: | ||
127 | + return PERF_REG_ARM_R2; | ||
128 | + case UNW_ARM_R3: | ||
129 | + return PERF_REG_ARM_R3; | ||
130 | + case UNW_ARM_R4: | ||
131 | + return PERF_REG_ARM_R4; | ||
132 | + case UNW_ARM_R5: | ||
133 | + return PERF_REG_ARM_R5; | ||
134 | + case UNW_ARM_R6: | ||
135 | + return PERF_REG_ARM_R6; | ||
136 | + case UNW_ARM_R7: | ||
137 | + return PERF_REG_ARM_R7; | ||
138 | + case UNW_ARM_R8: | ||
139 | + return PERF_REG_ARM_R8; | ||
140 | + case UNW_ARM_R9: | ||
141 | + return PERF_REG_ARM_R9; | ||
142 | + case UNW_ARM_R10: | ||
143 | + return PERF_REG_ARM_R10; | ||
144 | + case UNW_ARM_R11: | ||
145 | + return PERF_REG_ARM_FP; | ||
146 | + case UNW_ARM_R12: | ||
147 | + return PERF_REG_ARM_IP; | ||
148 | + case UNW_ARM_R13: | ||
149 | + return PERF_REG_ARM_SP; | ||
150 | + case UNW_ARM_R14: | ||
151 | + return PERF_REG_ARM_LR; | ||
152 | + case UNW_ARM_R15: | ||
153 | + return PERF_REG_ARM_PC; | ||
154 | + default: | ||
155 | + pr_err("unwind: invalid reg id %d\n", regnum); | ||
156 | + return -EINVAL; | ||
157 | + } | ||
158 | + | ||
159 | + return -EINVAL; | ||
160 | +} | ||
161 | -- | ||
162 | 1.9.1 | ||
163 | |||
diff --git a/meta-beagleboard-extras/recipes/linux/linux-mainline_3.8.bbappend b/meta-beagleboard-extras/recipes/linux/linux-mainline_3.8.bbappend index f91ea8e..54ef15f 100644 --- a/meta-beagleboard-extras/recipes/linux/linux-mainline_3.8.bbappend +++ b/meta-beagleboard-extras/recipes/linux/linux-mainline_3.8.bbappend | |||
@@ -1,8 +1,11 @@ | |||
1 | |||
1 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" | 2 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" |
2 | SRC_URI += "\ | 3 | SRC_URI += "\ |
3 | file://0001-AM335x-Adding-SGX-DT-node.patch \ | 4 | file://0001-AM335x-Adding-SGX-DT-node.patch \ |
4 | file://0002-AM33XX-Invoke-hwmod-deassert-for-SGX-graphics-device.patch \ | 5 | file://0002-AM33XX-Invoke-hwmod-deassert-for-SGX-graphics-device.patch \ |
5 | file://0003-video-da8xx-fb-Add-API-to-register-wait-for-vsync-ca.patch \ | 6 | file://0003-video-da8xx-fb-Add-API-to-register-wait-for-vsync-ca.patch \ |
7 | file://ARM-perf-add-support-for-perf-registers-API.diff \ | ||
8 | file://ARM-perf-wire-up-perf_regs-and-unwind-support-for-AR.patch \ | ||
6 | " | 9 | " |
7 | 10 | ||
8 | INSANE_SKIP_${PN} = "installed-vs-shipped" | 11 | INSANE_SKIP_${PN} = "installed-vs-shipped" |
diff --git a/meta-fsl-extras/recipes/linux/linux-boundary_3.10.17.bbappend b/meta-fsl-extras/recipes/linux/linux-boundary_3.10.17.bbappend index 415388f..d267b09 100644 --- a/meta-fsl-extras/recipes/linux/linux-boundary_3.10.17.bbappend +++ b/meta-fsl-extras/recipes/linux/linux-boundary_3.10.17.bbappend | |||
@@ -20,6 +20,12 @@ | |||
20 | ## | 20 | ## |
21 | ############################################################################# | 21 | ############################################################################# |
22 | 22 | ||
23 | FILESEXTRAPATHS_prepend := "${THISDIR}/../../../recipes/linux/linux:" | ||
24 | SRC_URI += "\ | ||
25 | file://ARM-perf-add-support-for-perf-registers-API.diff \ | ||
26 | file://ARM-perf-wire-up-perf_regs-and-unwind-support-for-AR.patch \ | ||
27 | " | ||
28 | |||
23 | # kernel image files are not needed in the image | 29 | # kernel image files are not needed in the image |
24 | RDEPENDS_kernel-base = "" | 30 | RDEPENDS_kernel-base = "" |
25 | 31 | ||
diff --git a/meta-fsl-extras/recipes/linux/linux-imx_3.%.bbappend b/meta-fsl-extras/recipes/linux/linux-imx_3.10.%.bbappend index d01efb2..d6c4db4 100644 --- a/meta-fsl-extras/recipes/linux/linux-imx_3.%.bbappend +++ b/meta-fsl-extras/recipes/linux/linux-imx_3.10.%.bbappend | |||
@@ -20,6 +20,12 @@ | |||
20 | ## | 20 | ## |
21 | ############################################################################# | 21 | ############################################################################# |
22 | 22 | ||
23 | FILESEXTRAPATHS_prepend := "${THISDIR}/../../../recipes/linux/linux:" | ||
24 | SRC_URI += "\ | ||
25 | file://ARM-perf-add-support-for-perf-registers-API.diff \ | ||
26 | file://ARM-perf-wire-up-perf_regs-and-unwind-support-for-AR.patch \ | ||
27 | " | ||
28 | |||
23 | # kernel image files are not needed in the image | 29 | # kernel image files are not needed in the image |
24 | RDEPENDS_kernel-base = "" | 30 | RDEPENDS_kernel-base = "" |
25 | 31 | ||
diff --git a/meta-raspberrypi-extras/conf/layer.conf b/meta-raspberrypi-extras/conf/layer.conf new file mode 100644 index 0000000..0ac91aa --- /dev/null +++ b/meta-raspberrypi-extras/conf/layer.conf | |||
@@ -0,0 +1,33 @@ | |||
1 | ############################################################################# | ||
2 | ## | ||
3 | ## Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). | ||
4 | ## | ||
5 | ## This file is part of the Qt Enterprise Embedded Scripts of the Qt | ||
6 | ## framework. | ||
7 | ## | ||
8 | ## $QT_BEGIN_LICENSE$ | ||
9 | ## Commercial License Usage Only | ||
10 | ## Licensees holding valid commercial Qt license agreements with Digia | ||
11 | ## with an appropriate addendum covering the Qt Enterprise Embedded Scripts, | ||
12 | ## may use this file in accordance with the terms contained in said license | ||
13 | ## agreement. | ||
14 | ## | ||
15 | ## For further information use the contact form at | ||
16 | ## http://www.qt.io/contact-us. | ||
17 | ## | ||
18 | ## | ||
19 | ## $QT_END_LICENSE$ | ||
20 | ## | ||
21 | ############################################################################# | ||
22 | |||
23 | # We have a conf and classes directory, append to BBPATH | ||
24 | BBPATH .= ":${LAYERDIR}" | ||
25 | |||
26 | # We have a recipes directory, add to BBFILES | ||
27 | BBFILES += "${LAYERDIR}/recipes*/*/*.bb \ | ||
28 | ${LAYERDIR}/recipes*/*/*.bbappend \ | ||
29 | " | ||
30 | |||
31 | BBFILE_COLLECTIONS += "b2qt_rpi" | ||
32 | BBFILE_PATTERN_b2qt_rpi := "^${LAYERDIR}/" | ||
33 | BBFILE_PRIORITY_b2qt_rpi = "20" | ||
diff --git a/meta-raspberrypi-extras/recipes/linux/linux-raspberrypi/ARM-perf-wire-up-perf_regs-and-unwind-support-for-AR.patch b/meta-raspberrypi-extras/recipes/linux/linux-raspberrypi/ARM-perf-wire-up-perf_regs-and-unwind-support-for-AR.patch new file mode 100644 index 0000000..4f2a45a --- /dev/null +++ b/meta-raspberrypi-extras/recipes/linux/linux-raspberrypi/ARM-perf-wire-up-perf_regs-and-unwind-support-for-AR.patch | |||
@@ -0,0 +1,171 @@ | |||
1 | From 7495f3742dda97612a77d92fa62f85cb7591ab14 Mon Sep 17 00:00:00 2001 | ||
2 | From: Will Deacon <will.deacon@arm.com> | ||
3 | Date: Thu, 26 Sep 2013 12:36:36 +0100 | ||
4 | Subject: [PATCH] ARM: perf: wire up perf_regs and unwind support for ARM | ||
5 | |||
6 | This patch hooks in the perf_regs and libunwind code for ARM. | ||
7 | |||
8 | Cc: Jean Pihet <jean.pihet@linaro.org> | ||
9 | Signed-off-by: Will Deacon <will.deacon@arm.com> | ||
10 | --- | ||
11 | tools/perf/arch/arm/Makefile | 3 ++ | ||
12 | tools/perf/arch/arm/include/perf_regs.h | 54 +++++++++++++++++++++++++++++++++ | ||
13 | tools/perf/arch/arm/util/unwind.c | 48 +++++++++++++++++++++++++++++ | ||
14 | tools/perf/config/Makefile | 7 +++-- | ||
15 | 4 files changed, 110 insertions(+), 2 deletions(-) | ||
16 | create mode 100644 tools/perf/arch/arm/include/perf_regs.h | ||
17 | create mode 100644 tools/perf/arch/arm/util/unwind.c | ||
18 | |||
19 | diff --git a/tools/perf/arch/arm/Makefile b/tools/perf/arch/arm/Makefile | ||
20 | index 15130b5..fe9b61e 100644 | ||
21 | --- a/tools/perf/arch/arm/Makefile | ||
22 | +++ b/tools/perf/arch/arm/Makefile | ||
23 | @@ -2,3 +2,6 @@ ifndef NO_DWARF | ||
24 | PERF_HAVE_DWARF_REGS := 1 | ||
25 | LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o | ||
26 | endif | ||
27 | +ifndef NO_LIBUNWIND | ||
28 | +LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind.o | ||
29 | +endif | ||
30 | diff --git a/tools/perf/arch/arm/include/perf_regs.h b/tools/perf/arch/arm/include/perf_regs.h | ||
31 | new file mode 100644 | ||
32 | index 0000000..2a1cfde | ||
33 | --- /dev/null | ||
34 | +++ b/tools/perf/arch/arm/include/perf_regs.h | ||
35 | @@ -0,0 +1,54 @@ | ||
36 | +#ifndef ARCH_PERF_REGS_H | ||
37 | +#define ARCH_PERF_REGS_H | ||
38 | + | ||
39 | +#include <stdlib.h> | ||
40 | +#include "../../util/types.h" | ||
41 | +#include <asm/perf_regs.h> | ||
42 | + | ||
43 | +#define PERF_REGS_MASK ((1ULL << PERF_REG_ARM_MAX) - 1) | ||
44 | +#define PERF_REG_IP PERF_REG_ARM_PC | ||
45 | +#define PERF_REG_SP PERF_REG_ARM_SP | ||
46 | + | ||
47 | +static inline const char *perf_reg_name(int id) | ||
48 | +{ | ||
49 | + switch (id) { | ||
50 | + case PERF_REG_ARM_R0: | ||
51 | + return "r0"; | ||
52 | + case PERF_REG_ARM_R1: | ||
53 | + return "r1"; | ||
54 | + case PERF_REG_ARM_R2: | ||
55 | + return "r2"; | ||
56 | + case PERF_REG_ARM_R3: | ||
57 | + return "r3"; | ||
58 | + case PERF_REG_ARM_R4: | ||
59 | + return "r4"; | ||
60 | + case PERF_REG_ARM_R5: | ||
61 | + return "r5"; | ||
62 | + case PERF_REG_ARM_R6: | ||
63 | + return "r6"; | ||
64 | + case PERF_REG_ARM_R7: | ||
65 | + return "r7"; | ||
66 | + case PERF_REG_ARM_R8: | ||
67 | + return "r8"; | ||
68 | + case PERF_REG_ARM_R9: | ||
69 | + return "r9"; | ||
70 | + case PERF_REG_ARM_R10: | ||
71 | + return "r10"; | ||
72 | + case PERF_REG_ARM_FP: | ||
73 | + return "fp"; | ||
74 | + case PERF_REG_ARM_IP: | ||
75 | + return "ip"; | ||
76 | + case PERF_REG_ARM_SP: | ||
77 | + return "sp"; | ||
78 | + case PERF_REG_ARM_LR: | ||
79 | + return "lr"; | ||
80 | + case PERF_REG_ARM_PC: | ||
81 | + return "pc"; | ||
82 | + default: | ||
83 | + return NULL; | ||
84 | + } | ||
85 | + | ||
86 | + return NULL; | ||
87 | +} | ||
88 | + | ||
89 | +#endif /* ARCH_PERF_REGS_H */ | ||
90 | diff --git a/tools/perf/arch/arm/util/unwind.c b/tools/perf/arch/arm/util/unwind.c | ||
91 | new file mode 100644 | ||
92 | index 0000000..da3dc95 | ||
93 | --- /dev/null | ||
94 | +++ b/tools/perf/arch/arm/util/unwind.c | ||
95 | @@ -0,0 +1,48 @@ | ||
96 | + | ||
97 | +#include <errno.h> | ||
98 | +#include <libunwind.h> | ||
99 | +#include "perf_regs.h" | ||
100 | +#include "../../util/unwind.h" | ||
101 | + | ||
102 | +int unwind__arch_reg_id(int regnum) | ||
103 | +{ | ||
104 | + switch (regnum) { | ||
105 | + case UNW_ARM_R0: | ||
106 | + return PERF_REG_ARM_R0; | ||
107 | + case UNW_ARM_R1: | ||
108 | + return PERF_REG_ARM_R1; | ||
109 | + case UNW_ARM_R2: | ||
110 | + return PERF_REG_ARM_R2; | ||
111 | + case UNW_ARM_R3: | ||
112 | + return PERF_REG_ARM_R3; | ||
113 | + case UNW_ARM_R4: | ||
114 | + return PERF_REG_ARM_R4; | ||
115 | + case UNW_ARM_R5: | ||
116 | + return PERF_REG_ARM_R5; | ||
117 | + case UNW_ARM_R6: | ||
118 | + return PERF_REG_ARM_R6; | ||
119 | + case UNW_ARM_R7: | ||
120 | + return PERF_REG_ARM_R7; | ||
121 | + case UNW_ARM_R8: | ||
122 | + return PERF_REG_ARM_R8; | ||
123 | + case UNW_ARM_R9: | ||
124 | + return PERF_REG_ARM_R9; | ||
125 | + case UNW_ARM_R10: | ||
126 | + return PERF_REG_ARM_R10; | ||
127 | + case UNW_ARM_R11: | ||
128 | + return PERF_REG_ARM_FP; | ||
129 | + case UNW_ARM_R12: | ||
130 | + return PERF_REG_ARM_IP; | ||
131 | + case UNW_ARM_R13: | ||
132 | + return PERF_REG_ARM_SP; | ||
133 | + case UNW_ARM_R14: | ||
134 | + return PERF_REG_ARM_LR; | ||
135 | + case UNW_ARM_R15: | ||
136 | + return PERF_REG_ARM_PC; | ||
137 | + default: | ||
138 | + pr_err("unwind: invalid reg id %d\n", regnum); | ||
139 | + return -EINVAL; | ||
140 | + } | ||
141 | + | ||
142 | + return -EINVAL; | ||
143 | +} | ||
144 | diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile | ||
145 | index 5f6f9b3..4796ce5 100644 | ||
146 | --- a/tools/perf/config/Makefile | ||
147 | +++ b/tools/perf/config/Makefile | ||
148 | @@ -29,6 +29,10 @@ ifeq ($(ARCH),x86_64) | ||
149 | NO_PERF_REGS := 0 | ||
150 | LIBUNWIND_LIBS = -lunwind -lunwind-x86_64 | ||
151 | endif | ||
152 | +ifeq ($(ARCH),arm) | ||
153 | + NO_PERF_REGS := 0 | ||
154 | + LIBUNWIND_LIBS = -lunwind -lunwind-arm | ||
155 | +endif | ||
156 | |||
157 | ifeq ($(NO_PERF_REGS),0) | ||
158 | CFLAGS += -DHAVE_PERF_REGS | ||
159 | @@ -208,8 +212,7 @@ ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y) | ||
160 | endif # try-cc | ||
161 | endif # NO_LIBELF | ||
162 | |||
163 | -# There's only x86 (both 32 and 64) support for CFI unwind so far | ||
164 | -ifneq ($(ARCH),x86) | ||
165 | +ifeq ($(LIBUNWIND_LIBS),) | ||
166 | NO_LIBUNWIND := 1 | ||
167 | endif | ||
168 | |||
169 | -- | ||
170 | 1.9.1 | ||
171 | |||
diff --git a/meta-raspberrypi-extras/recipes/linux/linux-raspberrypi_3.12.26.bbappend b/meta-raspberrypi-extras/recipes/linux/linux-raspberrypi_3.12.26.bbappend new file mode 100644 index 0000000..94b2ab1 --- /dev/null +++ b/meta-raspberrypi-extras/recipes/linux/linux-raspberrypi_3.12.26.bbappend | |||
@@ -0,0 +1,27 @@ | |||
1 | ############################################################################# | ||
2 | ## | ||
3 | ## Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). | ||
4 | ## | ||
5 | ## This file is part of the Qt Enterprise Embedded Scripts of the Qt | ||
6 | ## framework. | ||
7 | ## | ||
8 | ## $QT_BEGIN_LICENSE$ | ||
9 | ## Commercial License Usage Only | ||
10 | ## Licensees holding valid commercial Qt license agreements with Digia | ||
11 | ## with an appropriate addendum covering the Qt Enterprise Embedded Scripts, | ||
12 | ## may use this file in accordance with the terms contained in said license | ||
13 | ## agreement. | ||
14 | ## | ||
15 | ## For further information use the contact form at | ||
16 | ## http://www.qt.io/contact-us. | ||
17 | ## | ||
18 | ## | ||
19 | ## $QT_END_LICENSE$ | ||
20 | ## | ||
21 | ############################################################################# | ||
22 | |||
23 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:${THISDIR}/../../../recipes/linux/linux:" | ||
24 | SRC_URI += "\ | ||
25 | file://ARM-perf-add-support-for-perf-registers-API.diff \ | ||
26 | file://ARM-perf-wire-up-perf_regs-and-unwind-support-for-AR.patch \ | ||
27 | " | ||
diff --git a/meta-toradex-extras/recipes/linux/linux-toradex-fsl_git.bbappend b/meta-toradex-extras/recipes/linux/linux-toradex-fsl_git.bbappend index f054071..68cdfc2 100644 --- a/meta-toradex-extras/recipes/linux/linux-toradex-fsl_git.bbappend +++ b/meta-toradex-extras/recipes/linux/linux-toradex-fsl_git.bbappend | |||
@@ -20,6 +20,12 @@ | |||
20 | ## | 20 | ## |
21 | ############################################################################# | 21 | ############################################################################# |
22 | 22 | ||
23 | FILESEXTRAPATHS_prepend := "${THISDIR}/../../../recipes/linux/linux:" | ||
24 | SRC_URI += "\ | ||
25 | file://ARM-perf-add-support-for-perf-registers-API.diff \ | ||
26 | file://ARM-perf-wire-up-perf_regs-and-unwind-support-for-AR.patch \ | ||
27 | " | ||
28 | |||
23 | # kernel image files are not needed in the image | 29 | # kernel image files are not needed in the image |
24 | RDEPENDS_kernel-base = "" | 30 | RDEPENDS_kernel-base = "" |
25 | 31 | ||
diff --git a/recipes/linux/linux/ARM-perf-add-support-for-perf-registers-API.diff b/recipes/linux/linux/ARM-perf-add-support-for-perf-registers-API.diff new file mode 100644 index 0000000..e6f44fd --- /dev/null +++ b/recipes/linux/linux/ARM-perf-add-support-for-perf-registers-API.diff | |||
@@ -0,0 +1,126 @@ | |||
1 | From 49863894db3ed7bd41541b1c17733273966cea71 Mon Sep 17 00:00:00 2001 | ||
2 | From: Will Deacon <will.deacon@arm.com> | ||
3 | Date: Thu, 26 Sep 2013 12:36:35 +0100 | ||
4 | Subject: [PATCH] ARM: perf: add support for perf registers API | ||
5 | |||
6 | This patch implements the functions required for the perf registers API, | ||
7 | allowing the perf tool to interface kernel register dumps with libunwind | ||
8 | in order to provide userspace backtracing. | ||
9 | |||
10 | Cc: Jean Pihet <jean.pihet@linaro.org> | ||
11 | Signed-off-by: Will Deacon <will.deacon@arm.com> | ||
12 | --- | ||
13 | arch/arm/Kconfig | 2 ++ | ||
14 | arch/arm/include/uapi/asm/Kbuild | 1 + | ||
15 | arch/arm/include/uapi/asm/perf_regs.h | 23 +++++++++++++++++++++++ | ||
16 | arch/arm/kernel/Makefile | 1 + | ||
17 | arch/arm/kernel/perf_regs.c | 30 ++++++++++++++++++++++++++++++ | ||
18 | 5 files changed, 57 insertions(+) | ||
19 | create mode 100644 arch/arm/include/uapi/asm/perf_regs.h | ||
20 | create mode 100644 arch/arm/kernel/perf_regs.c | ||
21 | |||
22 | diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig | ||
23 | index 1ad6fb6..899d0c6 100644 | ||
24 | --- a/arch/arm/Kconfig | ||
25 | +++ b/arch/arm/Kconfig | ||
26 | @@ -51,6 +51,8 @@ config ARM | ||
27 | select HAVE_MOD_ARCH_SPECIFIC if ARM_UNWIND | ||
28 | select HAVE_OPROFILE if (HAVE_PERF_EVENTS) | ||
29 | select HAVE_PERF_EVENTS | ||
30 | + select HAVE_PERF_REGS | ||
31 | + select HAVE_PERF_USER_STACK_DUMP | ||
32 | select HAVE_REGS_AND_STACK_ACCESS_API | ||
33 | select HAVE_SYSCALL_TRACEPOINTS | ||
34 | select HAVE_UID16 | ||
35 | diff --git a/arch/arm/include/uapi/asm/Kbuild b/arch/arm/include/uapi/asm/Kbuild | ||
36 | index 18d76fd..70a1c9d 100644 | ||
37 | --- a/arch/arm/include/uapi/asm/Kbuild | ||
38 | +++ b/arch/arm/include/uapi/asm/Kbuild | ||
39 | @@ -7,6 +7,7 @@ header-y += hwcap.h | ||
40 | header-y += ioctls.h | ||
41 | header-y += kvm_para.h | ||
42 | header-y += mman.h | ||
43 | +header-y += perf_regs.h | ||
44 | header-y += posix_types.h | ||
45 | header-y += ptrace.h | ||
46 | header-y += setup.h | ||
47 | diff --git a/arch/arm/include/uapi/asm/perf_regs.h b/arch/arm/include/uapi/asm/perf_regs.h | ||
48 | new file mode 100644 | ||
49 | index 0000000..ce59448 | ||
50 | --- /dev/null | ||
51 | +++ b/arch/arm/include/uapi/asm/perf_regs.h | ||
52 | @@ -0,0 +1,23 @@ | ||
53 | +#ifndef _ASM_ARM_PERF_REGS_H | ||
54 | +#define _ASM_ARM_PERF_REGS_H | ||
55 | + | ||
56 | +enum perf_event_arm_regs { | ||
57 | + PERF_REG_ARM_R0, | ||
58 | + PERF_REG_ARM_R1, | ||
59 | + PERF_REG_ARM_R2, | ||
60 | + PERF_REG_ARM_R3, | ||
61 | + PERF_REG_ARM_R4, | ||
62 | + PERF_REG_ARM_R5, | ||
63 | + PERF_REG_ARM_R6, | ||
64 | + PERF_REG_ARM_R7, | ||
65 | + PERF_REG_ARM_R8, | ||
66 | + PERF_REG_ARM_R9, | ||
67 | + PERF_REG_ARM_R10, | ||
68 | + PERF_REG_ARM_FP, | ||
69 | + PERF_REG_ARM_IP, | ||
70 | + PERF_REG_ARM_SP, | ||
71 | + PERF_REG_ARM_LR, | ||
72 | + PERF_REG_ARM_PC, | ||
73 | + PERF_REG_ARM_MAX, | ||
74 | +}; | ||
75 | +#endif /* _ASM_ARM_PERF_REGS_H */ | ||
76 | diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile | ||
77 | index 5140df5f..9b818ca 100644 | ||
78 | --- a/arch/arm/kernel/Makefile | ||
79 | +++ b/arch/arm/kernel/Makefile | ||
80 | @@ -78,6 +78,7 @@ obj-$(CONFIG_CPU_XSC3) += xscale-cp0.o | ||
81 | obj-$(CONFIG_CPU_MOHAWK) += xscale-cp0.o | ||
82 | obj-$(CONFIG_CPU_PJ4) += pj4-cp0.o | ||
83 | obj-$(CONFIG_IWMMXT) += iwmmxt.o | ||
84 | +obj-$(CONFIG_PERF_EVENTS) += perf_regs.o | ||
85 | obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o perf_event_cpu.o | ||
86 | AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt | ||
87 | obj-$(CONFIG_ARM_CPU_TOPOLOGY) += topology.o | ||
88 | diff --git a/arch/arm/kernel/perf_regs.c b/arch/arm/kernel/perf_regs.c | ||
89 | new file mode 100644 | ||
90 | index 0000000..6e4379c | ||
91 | --- /dev/null | ||
92 | +++ b/arch/arm/kernel/perf_regs.c | ||
93 | @@ -0,0 +1,30 @@ | ||
94 | + | ||
95 | +#include <linux/errno.h> | ||
96 | +#include <linux/kernel.h> | ||
97 | +#include <linux/perf_event.h> | ||
98 | +#include <linux/bug.h> | ||
99 | +#include <asm/perf_regs.h> | ||
100 | +#include <asm/ptrace.h> | ||
101 | + | ||
102 | +u64 perf_reg_value(struct pt_regs *regs, int idx) | ||
103 | +{ | ||
104 | + if (WARN_ON_ONCE((u32)idx >= PERF_REG_ARM_MAX)) | ||
105 | + return 0; | ||
106 | + | ||
107 | + return regs->uregs[idx]; | ||
108 | +} | ||
109 | + | ||
110 | +#define REG_RESERVED (~((1ULL << PERF_REG_ARM_MAX) - 1)) | ||
111 | + | ||
112 | +int perf_reg_validate(u64 mask) | ||
113 | +{ | ||
114 | + if (!mask || mask & REG_RESERVED) | ||
115 | + return -EINVAL; | ||
116 | + | ||
117 | + return 0; | ||
118 | +} | ||
119 | + | ||
120 | +u64 perf_reg_abi(struct task_struct *task) | ||
121 | +{ | ||
122 | + return PERF_SAMPLE_REGS_ABI_32; | ||
123 | +} | ||
124 | -- | ||
125 | 1.9.1 | ||
126 | |||
diff --git a/recipes/linux/linux/ARM-perf-wire-up-perf_regs-and-unwind-support-for-AR.patch b/recipes/linux/linux/ARM-perf-wire-up-perf_regs-and-unwind-support-for-AR.patch new file mode 100644 index 0000000..1e497c6 --- /dev/null +++ b/recipes/linux/linux/ARM-perf-wire-up-perf_regs-and-unwind-support-for-AR.patch | |||
@@ -0,0 +1,172 @@ | |||
1 | From 8abd7519c1fd2b6ae35eddbb41f93f44d3886000 Mon Sep 17 00:00:00 2001 | ||
2 | From: Will Deacon <will.deacon@arm.com> | ||
3 | Date: Thu, 26 Sep 2013 12:36:36 +0100 | ||
4 | Subject: [PATCH] ARM: perf: wire up perf_regs and unwind support for ARM | ||
5 | |||
6 | This patch hooks in the perf_regs and libunwind code for ARM. | ||
7 | |||
8 | B2Qt: Backported for 3.10 kernel | ||
9 | |||
10 | Cc: Jean Pihet <jean.pihet@linaro.org> | ||
11 | Signed-off-by: Will Deacon <will.deacon@arm.com> | ||
12 | --- | ||
13 | tools/perf/Makefile | 6 +++- | ||
14 | tools/perf/arch/arm/Makefile | 3 ++ | ||
15 | tools/perf/arch/arm/include/perf_regs.h | 54 +++++++++++++++++++++++++++++++++ | ||
16 | tools/perf/arch/arm/util/unwind.c | 48 +++++++++++++++++++++++++++++ | ||
17 | 4 files changed, 110 insertions(+), 1 deletion(-) | ||
18 | create mode 100644 tools/perf/arch/arm/include/perf_regs.h | ||
19 | create mode 100644 tools/perf/arch/arm/util/unwind.c | ||
20 | |||
21 | diff --git a/tools/perf/Makefile b/tools/perf/Makefile | ||
22 | index b0f164b..f8fdad5 100644 | ||
23 | --- a/tools/perf/Makefile | ||
24 | +++ b/tools/perf/Makefile | ||
25 | @@ -87,6 +87,10 @@ ifeq ($(ARCH),x86_64) | ||
26 | NO_PERF_REGS := 0 | ||
27 | LIBUNWIND_LIBS = -lunwind -lunwind-x86_64 | ||
28 | endif | ||
29 | +ifeq ($(ARCH),arm) | ||
30 | + NO_PERF_REGS := 0 | ||
31 | + LIBUNWIND_LIBS = -lunwind -lunwind-arm | ||
32 | +endif | ||
33 | |||
34 | # Treat warnings as errors unless directed not to | ||
35 | ifneq ($(WERROR),0) | ||
36 | @@ -607,7 +611,7 @@ endif # SOURCE_LIBELF | ||
37 | endif # NO_LIBELF | ||
38 | |||
39 | # There's only x86 (both 32 and 64) support for CFI unwind so far | ||
40 | -ifneq ($(ARCH),x86) | ||
41 | +ifeq ($(LIBUNWIND_LIBS),) | ||
42 | NO_LIBUNWIND := 1 | ||
43 | endif | ||
44 | |||
45 | diff --git a/tools/perf/arch/arm/Makefile b/tools/perf/arch/arm/Makefile | ||
46 | index 15130b5..fe9b61e 100644 | ||
47 | --- a/tools/perf/arch/arm/Makefile | ||
48 | +++ b/tools/perf/arch/arm/Makefile | ||
49 | @@ -2,3 +2,6 @@ ifndef NO_DWARF | ||
50 | PERF_HAVE_DWARF_REGS := 1 | ||
51 | LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o | ||
52 | endif | ||
53 | +ifndef NO_LIBUNWIND | ||
54 | +LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind.o | ||
55 | +endif | ||
56 | diff --git a/tools/perf/arch/arm/include/perf_regs.h b/tools/perf/arch/arm/include/perf_regs.h | ||
57 | new file mode 100644 | ||
58 | index 0000000..2a1cfde | ||
59 | --- /dev/null | ||
60 | +++ b/tools/perf/arch/arm/include/perf_regs.h | ||
61 | @@ -0,0 +1,54 @@ | ||
62 | +#ifndef ARCH_PERF_REGS_H | ||
63 | +#define ARCH_PERF_REGS_H | ||
64 | + | ||
65 | +#include <stdlib.h> | ||
66 | +#include "../../util/types.h" | ||
67 | +#include <asm/perf_regs.h> | ||
68 | + | ||
69 | +#define PERF_REGS_MASK ((1ULL << PERF_REG_ARM_MAX) - 1) | ||
70 | +#define PERF_REG_IP PERF_REG_ARM_PC | ||
71 | +#define PERF_REG_SP PERF_REG_ARM_SP | ||
72 | + | ||
73 | +static inline const char *perf_reg_name(int id) | ||
74 | +{ | ||
75 | + switch (id) { | ||
76 | + case PERF_REG_ARM_R0: | ||
77 | + return "r0"; | ||
78 | + case PERF_REG_ARM_R1: | ||
79 | + return "r1"; | ||
80 | + case PERF_REG_ARM_R2: | ||
81 | + return "r2"; | ||
82 | + case PERF_REG_ARM_R3: | ||
83 | + return "r3"; | ||
84 | + case PERF_REG_ARM_R4: | ||
85 | + return "r4"; | ||
86 | + case PERF_REG_ARM_R5: | ||
87 | + return "r5"; | ||
88 | + case PERF_REG_ARM_R6: | ||
89 | + return "r6"; | ||
90 | + case PERF_REG_ARM_R7: | ||
91 | + return "r7"; | ||
92 | + case PERF_REG_ARM_R8: | ||
93 | + return "r8"; | ||
94 | + case PERF_REG_ARM_R9: | ||
95 | + return "r9"; | ||
96 | + case PERF_REG_ARM_R10: | ||
97 | + return "r10"; | ||
98 | + case PERF_REG_ARM_FP: | ||
99 | + return "fp"; | ||
100 | + case PERF_REG_ARM_IP: | ||
101 | + return "ip"; | ||
102 | + case PERF_REG_ARM_SP: | ||
103 | + return "sp"; | ||
104 | + case PERF_REG_ARM_LR: | ||
105 | + return "lr"; | ||
106 | + case PERF_REG_ARM_PC: | ||
107 | + return "pc"; | ||
108 | + default: | ||
109 | + return NULL; | ||
110 | + } | ||
111 | + | ||
112 | + return NULL; | ||
113 | +} | ||
114 | + | ||
115 | +#endif /* ARCH_PERF_REGS_H */ | ||
116 | diff --git a/tools/perf/arch/arm/util/unwind.c b/tools/perf/arch/arm/util/unwind.c | ||
117 | new file mode 100644 | ||
118 | index 0000000..da3dc95 | ||
119 | --- /dev/null | ||
120 | +++ b/tools/perf/arch/arm/util/unwind.c | ||
121 | @@ -0,0 +1,48 @@ | ||
122 | + | ||
123 | +#include <errno.h> | ||
124 | +#include <libunwind.h> | ||
125 | +#include "perf_regs.h" | ||
126 | +#include "../../util/unwind.h" | ||
127 | + | ||
128 | +int unwind__arch_reg_id(int regnum) | ||
129 | +{ | ||
130 | + switch (regnum) { | ||
131 | + case UNW_ARM_R0: | ||
132 | + return PERF_REG_ARM_R0; | ||
133 | + case UNW_ARM_R1: | ||
134 | + return PERF_REG_ARM_R1; | ||
135 | + case UNW_ARM_R2: | ||
136 | + return PERF_REG_ARM_R2; | ||
137 | + case UNW_ARM_R3: | ||
138 | + return PERF_REG_ARM_R3; | ||
139 | + case UNW_ARM_R4: | ||
140 | + return PERF_REG_ARM_R4; | ||
141 | + case UNW_ARM_R5: | ||
142 | + return PERF_REG_ARM_R5; | ||
143 | + case UNW_ARM_R6: | ||
144 | + return PERF_REG_ARM_R6; | ||
145 | + case UNW_ARM_R7: | ||
146 | + return PERF_REG_ARM_R7; | ||
147 | + case UNW_ARM_R8: | ||
148 | + return PERF_REG_ARM_R8; | ||
149 | + case UNW_ARM_R9: | ||
150 | + return PERF_REG_ARM_R9; | ||
151 | + case UNW_ARM_R10: | ||
152 | + return PERF_REG_ARM_R10; | ||
153 | + case UNW_ARM_R11: | ||
154 | + return PERF_REG_ARM_FP; | ||
155 | + case UNW_ARM_R12: | ||
156 | + return PERF_REG_ARM_IP; | ||
157 | + case UNW_ARM_R13: | ||
158 | + return PERF_REG_ARM_SP; | ||
159 | + case UNW_ARM_R14: | ||
160 | + return PERF_REG_ARM_LR; | ||
161 | + case UNW_ARM_R15: | ||
162 | + return PERF_REG_ARM_PC; | ||
163 | + default: | ||
164 | + pr_err("unwind: invalid reg id %d\n", regnum); | ||
165 | + return -EINVAL; | ||
166 | + } | ||
167 | + | ||
168 | + return -EINVAL; | ||
169 | +} | ||
170 | -- | ||
171 | 1.9.1 | ||
172 | |||
diff --git a/recipes/packagegroup/packagegroup-b2qt-embedded-tools.bb b/recipes/packagegroup/packagegroup-b2qt-embedded-tools.bb index bce34ab..abd2d66 100644 --- a/recipes/packagegroup/packagegroup-b2qt-embedded-tools.bb +++ b/recipes/packagegroup/packagegroup-b2qt-embedded-tools.bb | |||
@@ -31,4 +31,5 @@ RDEPENDS_${PN} = "\ | |||
31 | binutils \ | 31 | binutils \ |
32 | binutils-symlinks \ | 32 | binutils-symlinks \ |
33 | i2c-tools \ | 33 | i2c-tools \ |
34 | perf \ | ||
34 | " | 35 | " |
diff --git a/recipes/perf/perf.bbappend b/recipes/perf/perf.bbappend new file mode 100644 index 0000000..1eec18d --- /dev/null +++ b/recipes/perf/perf.bbappend | |||
@@ -0,0 +1,2 @@ | |||
1 | PERF_FEATURES_ENABLE = "perf-libunwind" | ||
2 | EXTRA_OEMAKE_remove = "NO_DWARF=1" | ||