aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorMichael Ellerman <michael@ellerman.id.au>2013-05-15 16:19:31 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-05-31 18:29:29 -0400
commit58a032c3b106adcd2b83b7e631de3b79f238cdd2 (patch)
tree66316cc67cf604c1321ec084782b787a70a81629 /arch/powerpc
parentcbda6aa10bd2d97e38f4d26a03a0b2183ad580ba (diff)
powerpc/perf: Add missing SIER support
Commit 8f61aa3 "Add support for SIER" missed updates to siar_valid() and perf_get_data_addr(). In both cases we need to check the SIER instead of mmcra. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/perf/core-book3s.c37
1 files changed, 25 insertions, 12 deletions
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index b2f873bc891b..845c867444e6 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -136,22 +136,30 @@ static inline unsigned long perf_ip_adjust(struct pt_regs *regs)
136 * If we're not doing instruction sampling, give them the SDAR 136 * If we're not doing instruction sampling, give them the SDAR
137 * (sampled data address). If we are doing instruction sampling, then 137 * (sampled data address). If we are doing instruction sampling, then
138 * only give them the SDAR if it corresponds to the instruction 138 * only give them the SDAR if it corresponds to the instruction
139 * pointed to by SIAR; this is indicated by the [POWER6_]MMCRA_SDSYNC or 139 * pointed to by SIAR; this is indicated by the [POWER6_]MMCRA_SDSYNC, the
140 * the [POWER7P_]MMCRA_SDAR_VALID bit in MMCRA. 140 * [POWER7P_]MMCRA_SDAR_VALID bit in MMCRA, or the SDAR_VALID bit in SIER.
141 */ 141 */
142static inline void perf_get_data_addr(struct pt_regs *regs, u64 *addrp) 142static inline void perf_get_data_addr(struct pt_regs *regs, u64 *addrp)
143{ 143{
144 unsigned long mmcra = regs->dsisr; 144 unsigned long mmcra = regs->dsisr;
145 unsigned long sdsync; 145 bool sdar_valid;
146 146
147 if (ppmu->flags & PPMU_SIAR_VALID) 147 if (ppmu->flags & PPMU_HAS_SIER)
148 sdsync = POWER7P_MMCRA_SDAR_VALID; 148 sdar_valid = regs->dar & SIER_SDAR_VALID;
149 else if (ppmu->flags & PPMU_ALT_SIPR) 149 else {
150 sdsync = POWER6_MMCRA_SDSYNC; 150 unsigned long sdsync;
151 else 151
152 sdsync = MMCRA_SDSYNC; 152 if (ppmu->flags & PPMU_SIAR_VALID)
153 sdsync = POWER7P_MMCRA_SDAR_VALID;
154 else if (ppmu->flags & PPMU_ALT_SIPR)
155 sdsync = POWER6_MMCRA_SDSYNC;
156 else
157 sdsync = MMCRA_SDSYNC;
153 158
154 if (!(mmcra & MMCRA_SAMPLE_ENABLE) || (mmcra & sdsync)) 159 sdar_valid = mmcra & sdsync;
160 }
161
162 if (!(mmcra & MMCRA_SAMPLE_ENABLE) || sdar_valid)
155 *addrp = mfspr(SPRN_SDAR); 163 *addrp = mfspr(SPRN_SDAR);
156} 164}
157 165
@@ -290,8 +298,13 @@ static inline int siar_valid(struct pt_regs *regs)
290 unsigned long mmcra = regs->dsisr; 298 unsigned long mmcra = regs->dsisr;
291 int marked = mmcra & MMCRA_SAMPLE_ENABLE; 299 int marked = mmcra & MMCRA_SAMPLE_ENABLE;
292 300
293 if ((ppmu->flags & PPMU_SIAR_VALID) && marked) 301 if (marked) {
294 return mmcra & POWER7P_MMCRA_SIAR_VALID; 302 if (ppmu->flags & PPMU_HAS_SIER)
303 return regs->dar & SIER_SIAR_VALID;
304
305 if (ppmu->flags & PPMU_SIAR_VALID)
306 return mmcra & POWER7P_MMCRA_SIAR_VALID;
307 }
295 308
296 return 1; 309 return 1;
297} 310}