hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/arch/powerpc/perf/core-fsl-emb.c
....@@ -1,13 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Performance event support - Freescale Embedded Performance Monitor
34 *
45 * Copyright 2008-2009 Paul Mackerras, IBM Corporation.
56 * Copyright 2010 Freescale Semiconductor, Inc.
6
- *
7
- * This program is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU General Public License
9
- * as published by the Free Software Foundation; either version
10
- * 2 of the License, or (at your option) any later version.
117 */
128 #include <linux/kernel.h>
139 #include <linux/sched.h>
....@@ -34,19 +30,6 @@
3430 static atomic_t num_events;
3531 /* Used to avoid races in calling reserve/release_pmc_hardware */
3632 static DEFINE_MUTEX(pmc_reserve_mutex);
37
-
38
-/*
39
- * If interrupts were soft-disabled when a PMU interrupt occurs, treat
40
- * it as an NMI.
41
- */
42
-static inline int perf_intr_is_nmi(struct pt_regs *regs)
43
-{
44
-#ifdef __powerpc64__
45
- return (regs->softe & IRQS_DISABLED);
46
-#else
47
- return 0;
48
-#endif
49
-}
5033
5134 static void perf_event_interrupt(struct pt_regs *regs);
5235
....@@ -662,14 +645,6 @@
662645 struct cpu_hw_events *cpuhw = this_cpu_ptr(&cpu_hw_events);
663646 struct perf_event *event;
664647 unsigned long val;
665
- int found = 0;
666
- int nmi;
667
-
668
- nmi = perf_intr_is_nmi(regs);
669
- if (nmi)
670
- nmi_enter();
671
- else
672
- irq_enter();
673648
674649 for (i = 0; i < ppmu->n_counter; ++i) {
675650 event = cpuhw->event[i];
....@@ -678,7 +653,6 @@
678653 if ((int)val < 0) {
679654 if (event) {
680655 /* event has overflowed */
681
- found = 1;
682656 record_and_restart(event, val, regs);
683657 } else {
684658 /*
....@@ -694,18 +668,15 @@
694668 mtmsr(mfmsr() | MSR_PMM);
695669 mtpmr(PMRN_PMGC0, PMGC0_PMIE | PMGC0_FCECE);
696670 isync();
697
-
698
- if (nmi)
699
- nmi_exit();
700
- else
701
- irq_exit();
702671 }
703672
704
-void hw_perf_event_setup(int cpu)
673
+static int fsl_emb_pmu_prepare_cpu(unsigned int cpu)
705674 {
706675 struct cpu_hw_events *cpuhw = &per_cpu(cpu_hw_events, cpu);
707676
708677 memset(cpuhw, 0, sizeof(*cpuhw));
678
+
679
+ return 0;
709680 }
710681
711682 int register_fsl_emb_pmu(struct fsl_emb_pmu *pmu)
....@@ -718,6 +689,8 @@
718689 pmu->name);
719690
720691 perf_pmu_register(&fsl_emb_pmu, "cpu", PERF_TYPE_RAW);
692
+ cpuhp_setup_state(CPUHP_PERF_POWER, "perf/powerpc:prepare",
693
+ fsl_emb_pmu_prepare_cpu, NULL);
721694
722695 return 0;
723696 }