hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/arch/powerpc/perf/power5-pmu.c
....@@ -1,18 +1,16 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Performance counter support for POWER5 (not POWER5++) 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 POWER5 (not POWER5++)
....@@ -383,7 +381,8 @@
383381 }
384382
385383 static int power5_compute_mmcr(u64 event[], int n_ev,
386
- unsigned int hwc[], unsigned long mmcr[], struct perf_event *pevents[])
384
+ unsigned int hwc[], struct mmcr_regs *mmcr,
385
+ struct perf_event *pevents[])
387386 {
388387 unsigned long mmcr1 = 0;
389388 unsigned long mmcra = MMCRA_SDAR_DCACHE_MISS | MMCRA_SDAR_ERAT_MISS;
....@@ -532,20 +531,20 @@
532531 }
533532
534533 /* Return MMCRx values */
535
- mmcr[0] = 0;
534
+ mmcr->mmcr0 = 0;
536535 if (pmc_inuse & 1)
537
- mmcr[0] = MMCR0_PMC1CE;
536
+ mmcr->mmcr0 = MMCR0_PMC1CE;
538537 if (pmc_inuse & 0x3e)
539
- mmcr[0] |= MMCR0_PMCjCE;
540
- mmcr[1] = mmcr1;
541
- mmcr[2] = mmcra;
538
+ mmcr->mmcr0 |= MMCR0_PMCjCE;
539
+ mmcr->mmcr1 = mmcr1;
540
+ mmcr->mmcra = mmcra;
542541 return 0;
543542 }
544543
545
-static void power5_disable_pmc(unsigned int pmc, unsigned long mmcr[])
544
+static void power5_disable_pmc(unsigned int pmc, struct mmcr_regs *mmcr)
546545 {
547546 if (pmc <= 3)
548
- mmcr[1] &= ~(0x7fUL << MMCR1_PMCSEL_SH(pmc));
547
+ mmcr->mmcr1 &= ~(0x7fUL << MMCR1_PMCSEL_SH(pmc));
549548 }
550549
551550 static int power5_generic_events[] = {
....@@ -564,7 +563,7 @@
564563 * 0 means not supported, -1 means nonsensical, other values
565564 * are event codes.
566565 */
567
-static int power5_cache_events[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = {
566
+static u64 power5_cache_events[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = {
568567 [C(L1D)] = { /* RESULT_ACCESS RESULT_MISS */
569568 [C(OP_READ)] = { 0x4c1090, 0x3c1088 },
570569 [C(OP_WRITE)] = { 0x3c1090, 0xc10c3 },
....@@ -618,7 +617,7 @@
618617 .flags = PPMU_HAS_SSLOT,
619618 };
620619
621
-static int __init init_power5_pmu(void)
620
+int init_power5_pmu(void)
622621 {
623622 if (!cur_cpu_spec->oprofile_cpu_type ||
624623 strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power5"))
....@@ -626,5 +625,3 @@
626625
627626 return register_power_pmu(&power5_pmu);
628627 }
629
-
630
-early_initcall(init_power5_pmu);