0001
0002
0003
0004
0005
0006 #ifndef _POWERPC_PMC_H
0007 #define _POWERPC_PMC_H
0008 #ifdef __KERNEL__
0009
0010 #include <asm/ptrace.h>
0011
0012 typedef void (*perf_irq_t)(struct pt_regs *);
0013 extern perf_irq_t perf_irq;
0014
0015 int reserve_pmc_hardware(perf_irq_t new_perf_irq);
0016 void release_pmc_hardware(void);
0017 void ppc_enable_pmcs(void);
0018
0019 #ifdef CONFIG_PPC_BOOK3S_64
0020 #include <asm/lppaca.h>
0021 #include <asm/firmware.h>
0022
0023 static inline void ppc_set_pmu_inuse(int inuse)
0024 {
0025 #if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_KVM_BOOK3S_HV_POSSIBLE)
0026 if (firmware_has_feature(FW_FEATURE_LPAR)) {
0027 #ifdef CONFIG_PPC_PSERIES
0028 get_lppaca()->pmcregs_in_use = inuse;
0029 #endif
0030 }
0031 #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
0032 get_paca()->pmcregs_in_use = inuse;
0033 #endif
0034 #endif
0035 }
0036
0037 #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
0038 static inline int ppc_get_pmu_inuse(void)
0039 {
0040 return get_paca()->pmcregs_in_use;
0041 }
0042 #endif
0043
0044 extern void power4_enable_pmcs(void);
0045
0046 #else
0047
0048 static inline void ppc_set_pmu_inuse(int inuse) { }
0049
0050 #endif
0051
0052 #endif
0053 #endif