perf_event.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * Performance event support - s390 specific definitions.
  3. *
  4. * Copyright IBM Corp. 2009, 2013
  5. * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
  6. * Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
  7. */
  8. #ifndef _ASM_S390_PERF_EVENT_H
  9. #define _ASM_S390_PERF_EVENT_H
  10. #include <linux/perf_event.h>
  11. #include <linux/device.h>
  12. #include <asm/cpu_mf.h>
  13. /* Per-CPU flags for PMU states */
  14. #define PMU_F_RESERVED 0x1000
  15. #define PMU_F_ENABLED 0x2000
  16. #define PMU_F_IN_USE 0x4000
  17. #define PMU_F_ERR_IBE 0x0100
  18. #define PMU_F_ERR_LSDA 0x0200
  19. #define PMU_F_ERR_MASK (PMU_F_ERR_IBE|PMU_F_ERR_LSDA)
  20. /* Perf definitions for PMU event attributes in sysfs */
  21. extern __init const struct attribute_group **cpumf_cf_event_group(void);
  22. extern ssize_t cpumf_events_sysfs_show(struct device *dev,
  23. struct device_attribute *attr,
  24. char *page);
  25. #define EVENT_VAR(_cat, _name) event_attr_##_cat##_##_name
  26. #define EVENT_PTR(_cat, _name) (&EVENT_VAR(_cat, _name).attr.attr)
  27. #define CPUMF_EVENT_ATTR(cat, name, id) \
  28. PMU_EVENT_ATTR(name, EVENT_VAR(cat, name), id, cpumf_events_sysfs_show)
  29. #define CPUMF_EVENT_PTR(cat, name) EVENT_PTR(cat, name)
  30. /* Perf callbacks */
  31. struct pt_regs;
  32. extern unsigned long perf_instruction_pointer(struct pt_regs *regs);
  33. extern unsigned long perf_misc_flags(struct pt_regs *regs);
  34. #define perf_misc_flags(regs) perf_misc_flags(regs)
  35. /* Perf pt_regs extension for sample-data-entry indicators */
  36. struct perf_sf_sde_regs {
  37. unsigned char in_guest:1; /* guest sample */
  38. unsigned long reserved:63; /* reserved */
  39. };
  40. /* Perf PMU definitions for the counter facility */
  41. #define PERF_CPUM_CF_MAX_CTR 256
  42. /* Perf PMU definitions for the sampling facility */
  43. #define PERF_CPUM_SF_MAX_CTR 2
  44. #define PERF_EVENT_CPUM_SF 0xB0000UL /* Event: Basic-sampling */
  45. #define PERF_EVENT_CPUM_SF_DIAG 0xBD000UL /* Event: Combined-sampling */
  46. #define PERF_CPUM_SF_BASIC_MODE 0x0001 /* Basic-sampling flag */
  47. #define PERF_CPUM_SF_DIAG_MODE 0x0002 /* Diagnostic-sampling flag */
  48. #define PERF_CPUM_SF_MODE_MASK (PERF_CPUM_SF_BASIC_MODE| \
  49. PERF_CPUM_SF_DIAG_MODE)
  50. #define PERF_CPUM_SF_FULL_BLOCKS 0x0004 /* Process full SDBs only */
  51. #define REG_NONE 0
  52. #define REG_OVERFLOW 1
  53. #define OVERFLOW_REG(hwc) ((hwc)->extra_reg.config)
  54. #define SFB_ALLOC_REG(hwc) ((hwc)->extra_reg.alloc)
  55. #define RAWSAMPLE_REG(hwc) ((hwc)->config)
  56. #define TEAR_REG(hwc) ((hwc)->last_tag)
  57. #define SAMPL_RATE(hwc) ((hwc)->event_base)
  58. #define SAMPL_FLAGS(hwc) ((hwc)->config_base)
  59. #define SAMPL_DIAG_MODE(hwc) (SAMPL_FLAGS(hwc) & PERF_CPUM_SF_DIAG_MODE)
  60. #define SDB_FULL_BLOCKS(hwc) (SAMPL_FLAGS(hwc) & PERF_CPUM_SF_FULL_BLOCKS)
  61. /* Structure for sampling data entries to be passed as perf raw sample data
  62. * to user space. Note that raw sample data must be aligned and, thus, might
  63. * be padded with zeros.
  64. */
  65. struct sf_raw_sample {
  66. #define SF_RAW_SAMPLE_BASIC PERF_CPUM_SF_BASIC_MODE
  67. #define SF_RAW_SAMPLE_DIAG PERF_CPUM_SF_DIAG_MODE
  68. u64 format;
  69. u32 size; /* Size of sf_raw_sample */
  70. u16 bsdes; /* Basic-sampling data entry size */
  71. u16 dsdes; /* Diagnostic-sampling data entry size */
  72. struct hws_basic_entry basic; /* Basic-sampling data entry */
  73. struct hws_diag_entry diag; /* Diagnostic-sampling data entry */
  74. u8 padding[]; /* Padding to next multiple of 8 */
  75. } __packed;
  76. #endif /* _ASM_S390_PERF_EVENT_H */