hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
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+ (POWER5 GS) and POWER5++ (POWER5 GS DD3)
....@@ -452,7 +450,8 @@
452450 }
453451
454452 static int power5p_compute_mmcr(u64 event[], int n_ev,
455
- unsigned int hwc[], unsigned long mmcr[], struct perf_event *pevents[])
453
+ unsigned int hwc[], struct mmcr_regs *mmcr,
454
+ struct perf_event *pevents[])
456455 {
457456 unsigned long mmcr1 = 0;
458457 unsigned long mmcra = 0;
....@@ -590,20 +589,20 @@
590589 }
591590
592591 /* Return MMCRx values */
593
- mmcr[0] = 0;
592
+ mmcr->mmcr0 = 0;
594593 if (pmc_inuse & 1)
595
- mmcr[0] = MMCR0_PMC1CE;
594
+ mmcr->mmcr0 = MMCR0_PMC1CE;
596595 if (pmc_inuse & 0x3e)
597
- mmcr[0] |= MMCR0_PMCjCE;
598
- mmcr[1] = mmcr1;
599
- mmcr[2] = mmcra;
596
+ mmcr->mmcr0 |= MMCR0_PMCjCE;
597
+ mmcr->mmcr1 = mmcr1;
598
+ mmcr->mmcra = mmcra;
600599 return 0;
601600 }
602601
603
-static void power5p_disable_pmc(unsigned int pmc, unsigned long mmcr[])
602
+static void power5p_disable_pmc(unsigned int pmc, struct mmcr_regs *mmcr)
604603 {
605604 if (pmc <= 3)
606
- mmcr[1] &= ~(0x7fUL << MMCR1_PMCSEL_SH(pmc));
605
+ mmcr->mmcr1 &= ~(0x7fUL << MMCR1_PMCSEL_SH(pmc));
607606 }
608607
609608 static int power5p_generic_events[] = {
....@@ -622,7 +621,7 @@
622621 * 0 means not supported, -1 means nonsensical, other values
623622 * are event codes.
624623 */
625
-static int power5p_cache_events[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = {
624
+static u64 power5p_cache_events[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = {
626625 [C(L1D)] = { /* RESULT_ACCESS RESULT_MISS */
627626 [C(OP_READ)] = { 0x1c10a8, 0x3c1088 },
628627 [C(OP_WRITE)] = { 0x2c10a8, 0xc10c3 },
....@@ -677,7 +676,7 @@
677676 .cache_events = &power5p_cache_events,
678677 };
679678
680
-static int __init init_power5p_pmu(void)
679
+int init_power5p_pmu(void)
681680 {
682681 if (!cur_cpu_spec->oprofile_cpu_type ||
683682 (strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power5+")
....@@ -686,5 +685,3 @@
686685
687686 return register_power_pmu(&power5p_pmu);
688687 }
689
-
690
-early_initcall(init_power5p_pmu);