diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2013-04-25 15:28:24 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2013-04-26 02:11:08 -0400 |
commit | 5682c460264149b258b82105f0eefcb9878aa1e7 (patch) | |
tree | 8dd7bbb02ff639f6efe9c60245b4ce40a709cec6 /arch/powerpc | |
parent | 7a7868326d77416018e8f3b4c4697a3c57444549 (diff) |
powerpc/perf: Convert mmcra_sipr/sihv() to regs_sipr/sihv()
On power8 the SIPR and SIHV are not in MMCRA, so convert the routines
to take regs and change the names accordingly.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Acked-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/perf/core-book3s.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c index eb644806f00e..2417fe2a5736 100644 --- a/arch/powerpc/perf/core-book3s.c +++ b/arch/powerpc/perf/core-book3s.c | |||
@@ -131,24 +131,24 @@ static inline void perf_get_data_addr(struct pt_regs *regs, u64 *addrp) | |||
131 | *addrp = mfspr(SPRN_SDAR); | 131 | *addrp = mfspr(SPRN_SDAR); |
132 | } | 132 | } |
133 | 133 | ||
134 | static bool mmcra_sihv(unsigned long mmcra) | 134 | static bool regs_sihv(struct pt_regs *regs) |
135 | { | 135 | { |
136 | unsigned long sihv = MMCRA_SIHV; | 136 | unsigned long sihv = MMCRA_SIHV; |
137 | 137 | ||
138 | if (ppmu->flags & PPMU_ALT_SIPR) | 138 | if (ppmu->flags & PPMU_ALT_SIPR) |
139 | sihv = POWER6_MMCRA_SIHV; | 139 | sihv = POWER6_MMCRA_SIHV; |
140 | 140 | ||
141 | return !!(mmcra & sihv); | 141 | return !!(regs->dsisr & sihv); |
142 | } | 142 | } |
143 | 143 | ||
144 | static bool mmcra_sipr(unsigned long mmcra) | 144 | static bool regs_sipr(struct pt_regs *regs) |
145 | { | 145 | { |
146 | unsigned long sipr = MMCRA_SIPR; | 146 | unsigned long sipr = MMCRA_SIPR; |
147 | 147 | ||
148 | if (ppmu->flags & PPMU_ALT_SIPR) | 148 | if (ppmu->flags & PPMU_ALT_SIPR) |
149 | sipr = POWER6_MMCRA_SIPR; | 149 | sipr = POWER6_MMCRA_SIPR; |
150 | 150 | ||
151 | return !!(mmcra & sipr); | 151 | return !!(regs->dsisr & sipr); |
152 | } | 152 | } |
153 | 153 | ||
154 | static inline u32 perf_flags_from_msr(struct pt_regs *regs) | 154 | static inline u32 perf_flags_from_msr(struct pt_regs *regs) |
@@ -162,7 +162,6 @@ static inline u32 perf_flags_from_msr(struct pt_regs *regs) | |||
162 | 162 | ||
163 | static inline u32 perf_get_misc_flags(struct pt_regs *regs) | 163 | static inline u32 perf_get_misc_flags(struct pt_regs *regs) |
164 | { | 164 | { |
165 | unsigned long mmcra = regs->dsisr; | ||
166 | unsigned long use_siar = regs->result; | 165 | unsigned long use_siar = regs->result; |
167 | 166 | ||
168 | if (!use_siar) | 167 | if (!use_siar) |
@@ -182,10 +181,12 @@ static inline u32 perf_get_misc_flags(struct pt_regs *regs) | |||
182 | } | 181 | } |
183 | 182 | ||
184 | /* PR has priority over HV, so order below is important */ | 183 | /* PR has priority over HV, so order below is important */ |
185 | if (mmcra_sipr(mmcra)) | 184 | if (regs_sipr(regs)) |
186 | return PERF_RECORD_MISC_USER; | 185 | return PERF_RECORD_MISC_USER; |
187 | if (mmcra_sihv(mmcra) && (freeze_events_kernel != MMCR0_FCHV)) | 186 | |
187 | if (regs_sihv(regs) && (freeze_events_kernel != MMCR0_FCHV)) | ||
188 | return PERF_RECORD_MISC_HYPERVISOR; | 188 | return PERF_RECORD_MISC_HYPERVISOR; |
189 | |||
189 | return PERF_RECORD_MISC_KERNEL; | 190 | return PERF_RECORD_MISC_KERNEL; |
190 | } | 191 | } |
191 | 192 | ||
@@ -201,6 +202,8 @@ static inline void perf_read_regs(struct pt_regs *regs) | |||
201 | int marked = mmcra & MMCRA_SAMPLE_ENABLE; | 202 | int marked = mmcra & MMCRA_SAMPLE_ENABLE; |
202 | int use_siar; | 203 | int use_siar; |
203 | 204 | ||
205 | regs->dsisr = mmcra; | ||
206 | |||
204 | /* | 207 | /* |
205 | * If this isn't a PMU exception (eg a software event) the SIAR is | 208 | * If this isn't a PMU exception (eg a software event) the SIAR is |
206 | * not valid. Use pt_regs. | 209 | * not valid. Use pt_regs. |
@@ -224,12 +227,11 @@ static inline void perf_read_regs(struct pt_regs *regs) | |||
224 | use_siar = 1; | 227 | use_siar = 1; |
225 | else if ((ppmu->flags & PPMU_NO_CONT_SAMPLING)) | 228 | else if ((ppmu->flags & PPMU_NO_CONT_SAMPLING)) |
226 | use_siar = 0; | 229 | use_siar = 0; |
227 | else if (!(ppmu->flags & PPMU_NO_SIPR) && mmcra_sipr(mmcra)) | 230 | else if (!(ppmu->flags & PPMU_NO_SIPR) && regs_sipr(regs)) |
228 | use_siar = 0; | 231 | use_siar = 0; |
229 | else | 232 | else |
230 | use_siar = 1; | 233 | use_siar = 1; |
231 | 234 | ||
232 | regs->dsisr = mmcra; | ||
233 | regs->result = use_siar; | 235 | regs->result = use_siar; |
234 | } | 236 | } |
235 | 237 | ||