pmc.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. #include <asm/ptrace.h>
  10. typedef void (*perf_irq_t)(struct pt_regs *);
  11. extern perf_irq_t perf_irq;
  12. int reserve_pmc_hardware(perf_irq_t new_perf_irq);
  13. void release_pmc_hardware(void);
  14. void ppc_enable_pmcs(void);
  15. #ifdef CONFIG_PPC_BOOK3S_64
  16. #include <asm/lppaca.h>
  17. #include <asm/firmware.h>
  18. static inline void ppc_set_pmu_inuse(int inuse)
  19. {
  20. #if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_KVM_BOOK3S_HV_POSSIBLE)
  21. if (firmware_has_feature(FW_FEATURE_LPAR)) {
  22. #ifdef CONFIG_PPC_PSERIES
  23. get_lppaca()->pmcregs_in_use = inuse;
  24. #endif
  25. }
  26. #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
  27. get_paca()->pmcregs_in_use = inuse;
  28. #endif
  29. #endif
  30. }
  31. #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
  32. static inline int ppc_get_pmu_inuse(void)
  33. {
  34. return get_paca()->pmcregs_in_use;
  35. }
  36. #endif
  37. extern void power4_enable_pmcs(void);
  38. #else /* CONFIG_PPC64 */
  39. static inline void ppc_set_pmu_inuse(int inuse) { }
  40. #endif
  41. #endif /* __KERNEL__ */
  42. #endif /* _POWERPC_PMC_H */