pmc.h (1116B)
1/* SPDX-License-Identifier: GPL-2.0-or-later */ 2/* 3 * pmc.h 4 * Copyright (C) 2004 David Gibson, IBM Corporation 5 */ 6#ifndef _POWERPC_PMC_H 7#define _POWERPC_PMC_H 8#ifdef __KERNEL__ 9 10#include <asm/ptrace.h> 11 12typedef void (*perf_irq_t)(struct pt_regs *); 13extern perf_irq_t perf_irq; 14 15int reserve_pmc_hardware(perf_irq_t new_perf_irq); 16void release_pmc_hardware(void); 17void ppc_enable_pmcs(void); 18 19#ifdef CONFIG_PPC_BOOK3S_64 20#include <asm/lppaca.h> 21#include <asm/firmware.h> 22 23static 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 30 } 31#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE 32 get_paca()->pmcregs_in_use = inuse; 33#endif 34#endif 35} 36 37#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE 38static inline int ppc_get_pmu_inuse(void) 39{ 40 return get_paca()->pmcregs_in_use; 41} 42#endif 43 44extern void power4_enable_pmcs(void); 45 46#else /* CONFIG_PPC64 */ 47 48static inline void ppc_set_pmu_inuse(int inuse) { } 49 50#endif 51 52#endif /* __KERNEL__ */ 53#endif /* _POWERPC_PMC_H */