aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/power7-pmu.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/kernel/power7-pmu.c')
-rw-r--r--arch/powerpc/kernel/power7-pmu.c46
1 files changed, 25 insertions, 21 deletions
diff --git a/arch/powerpc/kernel/power7-pmu.c b/arch/powerpc/kernel/power7-pmu.c
index b72e7a19d054..658d1ae436a0 100644
--- a/arch/powerpc/kernel/power7-pmu.c
+++ b/arch/powerpc/kernel/power7-pmu.c
@@ -71,10 +71,11 @@
71 * 0-9: Count of events needing PMC1..PMC5 71 * 0-9: Count of events needing PMC1..PMC5
72 */ 72 */
73 73
74static int power7_get_constraint(u64 event, u64 *maskp, u64 *valp) 74static int power7_get_constraint(u64 event, unsigned long *maskp,
75 unsigned long *valp)
75{ 76{
76 int pmc, sh; 77 int pmc, sh;
77 u64 mask = 0, value = 0; 78 unsigned long mask = 0, value = 0;
78 79
79 pmc = (event >> PM_PMC_SH) & PM_PMC_MSK; 80 pmc = (event >> PM_PMC_SH) & PM_PMC_MSK;
80 if (pmc) { 81 if (pmc) {
@@ -224,10 +225,10 @@ static int power7_marked_instr_event(u64 event)
224} 225}
225 226
226static int power7_compute_mmcr(u64 event[], int n_ev, 227static int power7_compute_mmcr(u64 event[], int n_ev,
227 unsigned int hwc[], u64 mmcr[]) 228 unsigned int hwc[], unsigned long mmcr[])
228{ 229{
229 u64 mmcr1 = 0; 230 unsigned long mmcr1 = 0;
230 u64 mmcra = 0; 231 unsigned long mmcra = 0;
231 unsigned int pmc, unit, combine, l2sel, psel; 232 unsigned int pmc, unit, combine, l2sel, psel;
232 unsigned int pmc_inuse = 0; 233 unsigned int pmc_inuse = 0;
233 int i; 234 int i;
@@ -265,11 +266,14 @@ static int power7_compute_mmcr(u64 event[], int n_ev,
265 --pmc; 266 --pmc;
266 } 267 }
267 if (pmc <= 3) { 268 if (pmc <= 3) {
268 mmcr1 |= (u64) unit << (MMCR1_TTM0SEL_SH - 4 * pmc); 269 mmcr1 |= (unsigned long) unit
269 mmcr1 |= (u64) combine << (MMCR1_PMC1_COMBINE_SH - pmc); 270 << (MMCR1_TTM0SEL_SH - 4 * pmc);
271 mmcr1 |= (unsigned long) combine
272 << (MMCR1_PMC1_COMBINE_SH - pmc);
270 mmcr1 |= psel << MMCR1_PMCSEL_SH(pmc); 273 mmcr1 |= psel << MMCR1_PMCSEL_SH(pmc);
271 if (unit == 6) /* L2 events */ 274 if (unit == 6) /* L2 events */
272 mmcr1 |= (u64) l2sel << MMCR1_L2SEL_SH; 275 mmcr1 |= (unsigned long) l2sel
276 << MMCR1_L2SEL_SH;
273 } 277 }
274 if (power7_marked_instr_event(event[i])) 278 if (power7_marked_instr_event(event[i]))
275 mmcra |= MMCRA_SAMPLE_ENABLE; 279 mmcra |= MMCRA_SAMPLE_ENABLE;
@@ -287,10 +291,10 @@ static int power7_compute_mmcr(u64 event[], int n_ev,
287 return 0; 291 return 0;
288} 292}
289 293
290static void power7_disable_pmc(unsigned int pmc, u64 mmcr[]) 294static void power7_disable_pmc(unsigned int pmc, unsigned long mmcr[])
291{ 295{
292 if (pmc <= 3) 296 if (pmc <= 3)
293 mmcr[1] &= ~(0xffULL << MMCR1_PMCSEL_SH(pmc)); 297 mmcr[1] &= ~(0xffUL << MMCR1_PMCSEL_SH(pmc));
294} 298}
295 299
296static int power7_generic_events[] = { 300static int power7_generic_events[] = {
@@ -343,15 +347,15 @@ static int power7_cache_events[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = {
343}; 347};
344 348
345struct power_pmu power7_pmu = { 349struct power_pmu power7_pmu = {
346 .n_counter = 6, 350 .n_counter = 6,
347 .max_alternatives = MAX_ALT + 1, 351 .max_alternatives = MAX_ALT + 1,
348 .add_fields = 0x1555ull, 352 .add_fields = 0x1555ul,
349 .test_adder = 0x3000ull, 353 .test_adder = 0x3000ul,
350 .compute_mmcr = power7_compute_mmcr, 354 .compute_mmcr = power7_compute_mmcr,
351 .get_constraint = power7_get_constraint, 355 .get_constraint = power7_get_constraint,
352 .get_alternatives = power7_get_alternatives, 356 .get_alternatives = power7_get_alternatives,
353 .disable_pmc = power7_disable_pmc, 357 .disable_pmc = power7_disable_pmc,
354 .n_generic = ARRAY_SIZE(power7_generic_events), 358 .n_generic = ARRAY_SIZE(power7_generic_events),
355 .generic_events = power7_generic_events, 359 .generic_events = power7_generic_events,
356 .cache_events = &power7_cache_events, 360 .cache_events = &power7_cache_events,
357}; 361};