hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/arch/powerpc/perf/power7-pmu.c
....@@ -1,18 +1,16 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Performance counter support for POWER7 processors.
34 *
45 * Copyright 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.
106 */
117 #include <linux/kernel.h>
128 #include <linux/perf_event.h>
139 #include <linux/string.h>
1410 #include <asm/reg.h>
1511 #include <asm/cputable.h>
12
+
13
+#include "internal.h"
1614
1715 /*
1816 * Bits in event code for POWER7
....@@ -238,6 +236,7 @@
238236 case 6:
239237 if (psel == 0x64)
240238 return pmc >= 3;
239
+ break;
241240 case 8:
242241 return unit == 0xd;
243242 }
....@@ -245,7 +244,8 @@
245244 }
246245
247246 static int power7_compute_mmcr(u64 event[], int n_ev,
248
- unsigned int hwc[], unsigned long mmcr[], struct perf_event *pevents[])
247
+ unsigned int hwc[], struct mmcr_regs *mmcr,
248
+ struct perf_event *pevents[])
249249 {
250250 unsigned long mmcr1 = 0;
251251 unsigned long mmcra = MMCRA_SDAR_DCACHE_MISS | MMCRA_SDAR_ERAT_MISS;
....@@ -301,20 +301,20 @@
301301 }
302302
303303 /* Return MMCRx values */
304
- mmcr[0] = 0;
304
+ mmcr->mmcr0 = 0;
305305 if (pmc_inuse & 1)
306
- mmcr[0] = MMCR0_PMC1CE;
306
+ mmcr->mmcr0 = MMCR0_PMC1CE;
307307 if (pmc_inuse & 0x3e)
308
- mmcr[0] |= MMCR0_PMCjCE;
309
- mmcr[1] = mmcr1;
310
- mmcr[2] = mmcra;
308
+ mmcr->mmcr0 |= MMCR0_PMCjCE;
309
+ mmcr->mmcr1 = mmcr1;
310
+ mmcr->mmcra = mmcra;
311311 return 0;
312312 }
313313
314
-static void power7_disable_pmc(unsigned int pmc, unsigned long mmcr[])
314
+static void power7_disable_pmc(unsigned int pmc, struct mmcr_regs *mmcr)
315315 {
316316 if (pmc <= 3)
317
- mmcr[1] &= ~(0xffUL << MMCR1_PMCSEL_SH(pmc));
317
+ mmcr->mmcr1 &= ~(0xffUL << MMCR1_PMCSEL_SH(pmc));
318318 }
319319
320320 static int power7_generic_events[] = {
....@@ -335,7 +335,7 @@
335335 * 0 means not supported, -1 means nonsensical, other values
336336 * are event codes.
337337 */
338
-static int power7_cache_events[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = {
338
+static u64 power7_cache_events[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = {
339339 [C(L1D)] = { /* RESULT_ACCESS RESULT_MISS */
340340 [C(OP_READ)] = { 0xc880, 0x400f0 },
341341 [C(OP_WRITE)] = { 0, 0x300f0 },
....@@ -444,7 +444,7 @@
444444 .cache_events = &power7_cache_events,
445445 };
446446
447
-static int __init init_power7_pmu(void)
447
+int init_power7_pmu(void)
448448 {
449449 if (!cur_cpu_spec->oprofile_cpu_type ||
450450 strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power7"))
....@@ -455,5 +455,3 @@
455455
456456 return register_power_pmu(&power7_pmu);
457457 }
458
-
459
-early_initcall(init_power7_pmu);