pmc.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright 2014 Tilera Corporation. All Rights Reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation, version 2.
  7. *
  8. * This program is distributed in the hope that it will be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  11. * NON INFRINGEMENT. See the GNU General Public License for
  12. * more details.
  13. */
  14. #ifndef _ASM_TILE_PMC_H
  15. #define _ASM_TILE_PMC_H
  16. #include <linux/ptrace.h>
  17. #define TILE_BASE_COUNTERS 2
  18. /* Bitfields below are derived from SPR PERF_COUNT_CTL*/
  19. #ifndef __tilegx__
  20. /* PERF_COUNT_CTL on TILEPro */
  21. #define TILE_CTL_EXCL_USER (1 << 7) /* exclude user level */
  22. #define TILE_CTL_EXCL_KERNEL (1 << 8) /* exclude kernel level */
  23. #define TILE_CTL_EXCL_HV (1 << 9) /* exclude hypervisor level */
  24. #define TILE_SEL_MASK 0x7f /* 7 bits for event SEL,
  25. COUNT_0_SEL */
  26. #define TILE_PLM_MASK 0x780 /* 4 bits priv level msks,
  27. COUNT_0_MASK*/
  28. #define TILE_EVENT_MASK (TILE_SEL_MASK | TILE_PLM_MASK)
  29. #else /* __tilegx__*/
  30. /* PERF_COUNT_CTL on TILEGx*/
  31. #define TILE_CTL_EXCL_USER (1 << 10) /* exclude user level */
  32. #define TILE_CTL_EXCL_KERNEL (1 << 11) /* exclude kernel level */
  33. #define TILE_CTL_EXCL_HV (1 << 12) /* exclude hypervisor level */
  34. #define TILE_SEL_MASK 0x3f /* 6 bits for event SEL,
  35. COUNT_0_SEL*/
  36. #define TILE_BOX_MASK 0x1c0 /* 3 bits box msks,
  37. COUNT_0_BOX */
  38. #define TILE_PLM_MASK 0x3c00 /* 4 bits priv level msks,
  39. COUNT_0_MASK */
  40. #define TILE_EVENT_MASK (TILE_SEL_MASK | TILE_BOX_MASK | TILE_PLM_MASK)
  41. #endif /* __tilegx__*/
  42. /* Takes register and fault number. Returns error to disable the interrupt. */
  43. typedef int (*perf_irq_t)(struct pt_regs *, int);
  44. int userspace_perf_handler(struct pt_regs *regs, int fault);
  45. perf_irq_t reserve_pmc_hardware(perf_irq_t new_perf_irq);
  46. void release_pmc_hardware(void);
  47. unsigned long pmc_get_overflow(void);
  48. void pmc_ack_overflow(unsigned long status);
  49. void unmask_pmc_interrupts(void);
  50. void mask_pmc_interrupts(void);
  51. #endif /* _ASM_TILE_PMC_H */