David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 2 | /* |
| 3 | * pmc.h |
| 4 | * Copyright (C) 2004 David Gibson, IBM Corporation |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 5 | */ |
| 6 | #ifndef _POWERPC_PMC_H |
| 7 | #define _POWERPC_PMC_H |
| 8 | #ifdef __KERNEL__ |
| 9 | |
| 10 | #include <asm/ptrace.h> |
| 11 | |
| 12 | typedef void (*perf_irq_t)(struct pt_regs *); |
| 13 | extern perf_irq_t perf_irq; |
| 14 | |
| 15 | int reserve_pmc_hardware(perf_irq_t new_perf_irq); |
| 16 | void release_pmc_hardware(void); |
| 17 | void ppc_enable_pmcs(void); |
| 18 | |
| 19 | #ifdef CONFIG_PPC_BOOK3S_64 |
| 20 | #include <asm/lppaca.h> |
| 21 | #include <asm/firmware.h> |
| 22 | |
| 23 | static inline void ppc_set_pmu_inuse(int inuse) |
| 24 | { |
| 25 | #if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_KVM_BOOK3S_HV_POSSIBLE) |
| 26 | if (firmware_has_feature(FW_FEATURE_LPAR)) { |
| 27 | #ifdef CONFIG_PPC_PSERIES |
| 28 | get_lppaca()->pmcregs_in_use = inuse; |
| 29 | #endif |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 30 | } |
David Brazdil | 0f672f6 | 2019-12-10 10:32:29 +0000 | [diff] [blame^] | 31 | #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE |
| 32 | get_paca()->pmcregs_in_use = inuse; |
| 33 | #endif |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 34 | #endif |
| 35 | } |
| 36 | |
| 37 | extern void power4_enable_pmcs(void); |
| 38 | |
| 39 | #else /* CONFIG_PPC64 */ |
| 40 | |
| 41 | static inline void ppc_set_pmu_inuse(int inuse) { } |
| 42 | |
| 43 | #endif |
| 44 | |
| 45 | #endif /* __KERNEL__ */ |
| 46 | #endif /* _POWERPC_PMC_H */ |