hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/arch/powerpc/perf/power6-pmu.c
....@@ -1,18 +1,16 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Performance counter support for POWER6 processors.
34 *
45 * 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.
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 POWER6
....@@ -175,7 +173,7 @@
175173 * Assign PMC numbers and compute MMCR1 value for a set of events
176174 */
177175 static int p6_compute_mmcr(u64 event[], int n_ev,
178
- unsigned int hwc[], unsigned long mmcr[], struct perf_event *pevents[])
176
+ unsigned int hwc[], struct mmcr_regs *mmcr, struct perf_event *pevents[])
179177 {
180178 unsigned long mmcr1 = 0;
181179 unsigned long mmcra = MMCRA_SDAR_DCACHE_MISS | MMCRA_SDAR_ERAT_MISS;
....@@ -247,13 +245,13 @@
247245 if (pmc < 4)
248246 mmcr1 |= (unsigned long)psel << MMCR1_PMCSEL_SH(pmc);
249247 }
250
- mmcr[0] = 0;
248
+ mmcr->mmcr0 = 0;
251249 if (pmc_inuse & 1)
252
- mmcr[0] = MMCR0_PMC1CE;
250
+ mmcr->mmcr0 = MMCR0_PMC1CE;
253251 if (pmc_inuse & 0xe)
254
- mmcr[0] |= MMCR0_PMCjCE;
255
- mmcr[1] = mmcr1;
256
- mmcr[2] = mmcra;
252
+ mmcr->mmcr0 |= MMCR0_PMCjCE;
253
+ mmcr->mmcr1 = mmcr1;
254
+ mmcr->mmcra = mmcra;
257255 return 0;
258256 }
259257
....@@ -461,11 +459,11 @@
461459 return nalt;
462460 }
463461
464
-static void p6_disable_pmc(unsigned int pmc, unsigned long mmcr[])
462
+static void p6_disable_pmc(unsigned int pmc, struct mmcr_regs *mmcr)
465463 {
466464 /* Set PMCxSEL to 0 to disable PMCx */
467465 if (pmc <= 3)
468
- mmcr[1] &= ~(0xffUL << MMCR1_PMCSEL_SH(pmc));
466
+ mmcr->mmcr1 &= ~(0xffUL << MMCR1_PMCSEL_SH(pmc));
469467 }
470468
471469 static int power6_generic_events[] = {
....@@ -485,7 +483,7 @@
485483 * are event codes.
486484 * The "DTLB" and "ITLB" events relate to the DERAT and IERAT.
487485 */
488
-static int power6_cache_events[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = {
486
+static u64 power6_cache_events[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = {
489487 [C(L1D)] = { /* RESULT_ACCESS RESULT_MISS */
490488 [C(OP_READ)] = { 0x280030, 0x80080 },
491489 [C(OP_WRITE)] = { 0x180032, 0x80088 },
....@@ -540,7 +538,7 @@
540538 .cache_events = &power6_cache_events,
541539 };
542540
543
-static int __init init_power6_pmu(void)
541
+int init_power6_pmu(void)
544542 {
545543 if (!cur_cpu_spec->oprofile_cpu_type ||
546544 strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power6"))
....@@ -548,5 +546,3 @@
548546
549547 return register_power_pmu(&power6_pmu);
550548 }
551
-
552
-early_initcall(init_power6_pmu);