| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Performance event support - Freescale Embedded Performance Monitor |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright 2008-2009 Paul Mackerras, IBM Corporation. |
|---|
| 5 | 6 | * 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. |
|---|
| 11 | 7 | */ |
|---|
| 12 | 8 | #include <linux/kernel.h> |
|---|
| 13 | 9 | #include <linux/sched.h> |
|---|
| .. | .. |
|---|
| 34 | 30 | static atomic_t num_events; |
|---|
| 35 | 31 | /* Used to avoid races in calling reserve/release_pmc_hardware */ |
|---|
| 36 | 32 | 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 | | -} |
|---|
| 50 | 33 | |
|---|
| 51 | 34 | static void perf_event_interrupt(struct pt_regs *regs); |
|---|
| 52 | 35 | |
|---|
| .. | .. |
|---|
| 663 | 646 | struct perf_event *event; |
|---|
| 664 | 647 | unsigned long val; |
|---|
| 665 | 648 | 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(); |
|---|
| 673 | 649 | |
|---|
| 674 | 650 | for (i = 0; i < ppmu->n_counter; ++i) { |
|---|
| 675 | 651 | event = cpuhw->event[i]; |
|---|
| .. | .. |
|---|
| 694 | 670 | mtmsr(mfmsr() | MSR_PMM); |
|---|
| 695 | 671 | mtpmr(PMRN_PMGC0, PMGC0_PMIE | PMGC0_FCECE); |
|---|
| 696 | 672 | isync(); |
|---|
| 697 | | - |
|---|
| 698 | | - if (nmi) |
|---|
| 699 | | - nmi_exit(); |
|---|
| 700 | | - else |
|---|
| 701 | | - irq_exit(); |
|---|
| 702 | 673 | } |
|---|
| 703 | 674 | |
|---|
| 704 | 675 | void hw_perf_event_setup(int cpu) |
|---|