.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Performance counter support for MPC7450-family processors. |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright 2008-2009 Paul Mackerras, IBM Corporation. |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or |
---|
7 | | - * modify it under the terms of the GNU General Public License |
---|
8 | | - * as published by the Free Software Foundation; either version |
---|
9 | | - * 2 of the License, or (at your option) any later version. |
---|
10 | 6 | */ |
---|
11 | 7 | #include <linux/string.h> |
---|
12 | 8 | #include <linux/perf_event.h> |
---|
.. | .. |
---|
261 | 257 | * Compute MMCR0/1/2 values for a set of events. |
---|
262 | 258 | */ |
---|
263 | 259 | static int mpc7450_compute_mmcr(u64 event[], int n_ev, unsigned int hwc[], |
---|
264 | | - unsigned long mmcr[], |
---|
| 260 | + struct mmcr_regs *mmcr, |
---|
265 | 261 | struct perf_event *pevents[]) |
---|
266 | 262 | { |
---|
267 | 263 | u8 event_index[N_CLASSES][N_COUNTER]; |
---|
.. | .. |
---|
325 | 321 | mmcr0 |= MMCR0_PMCnCE; |
---|
326 | 322 | |
---|
327 | 323 | /* Return MMCRx values */ |
---|
328 | | - mmcr[0] = mmcr0; |
---|
329 | | - mmcr[1] = mmcr1; |
---|
330 | | - mmcr[2] = mmcr2; |
---|
| 324 | + mmcr->mmcr0 = mmcr0; |
---|
| 325 | + mmcr->mmcr1 = mmcr1; |
---|
| 326 | + mmcr->mmcr2 = mmcr2; |
---|
| 327 | + /* |
---|
| 328 | + * 32-bit doesn't have an MMCRA and uses SPRN_MMCR2 to define |
---|
| 329 | + * SPRN_MMCRA. So assign mmcra of cpu_hw_events with `mmcr2` |
---|
| 330 | + * value to ensure that any write to this SPRN_MMCRA will |
---|
| 331 | + * use mmcr2 value. |
---|
| 332 | + */ |
---|
| 333 | + mmcr->mmcra = mmcr2; |
---|
331 | 334 | return 0; |
---|
332 | 335 | } |
---|
333 | 336 | |
---|
.. | .. |
---|
335 | 338 | * Disable counting by a PMC. |
---|
336 | 339 | * Note that the pmc argument is 0-based here, not 1-based. |
---|
337 | 340 | */ |
---|
338 | | -static void mpc7450_disable_pmc(unsigned int pmc, unsigned long mmcr[]) |
---|
| 341 | +static void mpc7450_disable_pmc(unsigned int pmc, struct mmcr_regs *mmcr) |
---|
339 | 342 | { |
---|
340 | 343 | if (pmc <= 1) |
---|
341 | | - mmcr[0] &= ~(pmcsel_mask[pmc] << pmcsel_shift[pmc]); |
---|
| 344 | + mmcr->mmcr0 &= ~(pmcsel_mask[pmc] << pmcsel_shift[pmc]); |
---|
342 | 345 | else |
---|
343 | | - mmcr[1] &= ~(pmcsel_mask[pmc] << pmcsel_shift[pmc]); |
---|
| 346 | + mmcr->mmcr1 &= ~(pmcsel_mask[pmc] << pmcsel_shift[pmc]); |
---|
344 | 347 | } |
---|
345 | 348 | |
---|
346 | 349 | static int mpc7450_generic_events[] = { |
---|
.. | .. |
---|
358 | 361 | * 0 means not supported, -1 means nonsensical, other values |
---|
359 | 362 | * are event codes. |
---|
360 | 363 | */ |
---|
361 | | -static int mpc7450_cache_events[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = { |
---|
| 364 | +static u64 mpc7450_cache_events[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = { |
---|
362 | 365 | [C(L1D)] = { /* RESULT_ACCESS RESULT_MISS */ |
---|
363 | 366 | [C(OP_READ)] = { 0, 0x225 }, |
---|
364 | 367 | [C(OP_WRITE)] = { 0, 0x227 }, |
---|