Commit | Line | Data |
---|---|---|
1a59d1b8 | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
1da177e4 LT |
2 | /* |
3 | * pmc.h | |
4 | * Copyright (C) 2004 David Gibson, IBM Corporation | |
1da177e4 | 5 | */ |
f7f6f4fe DG |
6 | #ifndef _POWERPC_PMC_H |
7 | #define _POWERPC_PMC_H | |
88ced031 | 8 | #ifdef __KERNEL__ |
1da177e4 LT |
9 | |
10 | #include <asm/ptrace.h> | |
11 | ||
12 | typedef void (*perf_irq_t)(struct pt_regs *); | |
a31751e0 | 13 | extern perf_irq_t perf_irq; |
1da177e4 LT |
14 | |
15 | int reserve_pmc_hardware(perf_irq_t new_perf_irq); | |
16 | void release_pmc_hardware(void); | |
a6dbf93a | 17 | void ppc_enable_pmcs(void); |
1da177e4 | 18 | |
ad08587e | 19 | #ifdef CONFIG_PPC_BOOK3S_64 |
a6dbf93a | 20 | #include <asm/lppaca.h> |
8e0b634b | 21 | #include <asm/firmware.h> |
a6dbf93a PM |
22 | |
23 | static inline void ppc_set_pmu_inuse(int inuse) | |
24 | { | |
8e0b634b NP |
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 | |
30 | } else { | |
31 | #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE | |
32 | get_paca()->pmcregs_in_use = inuse; | |
33 | #endif | |
34 | } | |
35 | #endif | |
a6dbf93a PM |
36 | } |
37 | ||
38 | extern void power4_enable_pmcs(void); | |
39 | ||
40 | #else /* CONFIG_PPC64 */ | |
41 | ||
42 | static inline void ppc_set_pmu_inuse(int inuse) { } | |
43 | ||
f7f6f4fe | 44 | #endif |
180a3362 | 45 | |
88ced031 | 46 | #endif /* __KERNEL__ */ |
f7f6f4fe | 47 | #endif /* _POWERPC_PMC_H */ |