Merge tag 'pm+acpi-4.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael...
[linux/fpc-iii.git] / arch / s390 / include / asm / perf_event.h
blobf897ec73dc8c9c02943a5c76254140bc951a6024
1 /*
2 * Performance event support - s390 specific definitions.
4 * Copyright IBM Corp. 2009, 2013
5 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
6 * Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
7 */
9 #ifndef _ASM_S390_PERF_EVENT_H
10 #define _ASM_S390_PERF_EVENT_H
12 #include <linux/perf_event.h>
13 #include <linux/device.h>
14 #include <asm/cpu_mf.h>
16 /* Per-CPU flags for PMU states */
17 #define PMU_F_RESERVED 0x1000
18 #define PMU_F_ENABLED 0x2000
19 #define PMU_F_IN_USE 0x4000
20 #define PMU_F_ERR_IBE 0x0100
21 #define PMU_F_ERR_LSDA 0x0200
22 #define PMU_F_ERR_MASK (PMU_F_ERR_IBE|PMU_F_ERR_LSDA)
24 /* Perf defintions for PMU event attributes in sysfs */
25 extern __init const struct attribute_group **cpumf_cf_event_group(void);
26 extern ssize_t cpumf_events_sysfs_show(struct device *dev,
27 struct device_attribute *attr,
28 char *page);
29 #define EVENT_VAR(_cat, _name) event_attr_##_cat##_##_name
30 #define EVENT_PTR(_cat, _name) (&EVENT_VAR(_cat, _name).attr.attr)
32 #define CPUMF_EVENT_ATTR(cat, name, id) \
33 PMU_EVENT_ATTR(name, EVENT_VAR(cat, name), id, cpumf_events_sysfs_show)
34 #define CPUMF_EVENT_PTR(cat, name) EVENT_PTR(cat, name)
37 /* Perf callbacks */
38 struct pt_regs;
39 extern unsigned long perf_instruction_pointer(struct pt_regs *regs);
40 extern unsigned long perf_misc_flags(struct pt_regs *regs);
41 #define perf_misc_flags(regs) perf_misc_flags(regs)
43 /* Perf pt_regs extension for sample-data-entry indicators */
44 struct perf_sf_sde_regs {
45 unsigned char in_guest:1; /* guest sample */
46 unsigned long reserved:63; /* reserved */
49 /* Perf PMU definitions for the counter facility */
50 #define PERF_CPUM_CF_MAX_CTR 256
52 /* Perf PMU definitions for the sampling facility */
53 #define PERF_CPUM_SF_MAX_CTR 2
54 #define PERF_EVENT_CPUM_SF 0xB0000UL /* Event: Basic-sampling */
55 #define PERF_EVENT_CPUM_SF_DIAG 0xBD000UL /* Event: Combined-sampling */
56 #define PERF_CPUM_SF_BASIC_MODE 0x0001 /* Basic-sampling flag */
57 #define PERF_CPUM_SF_DIAG_MODE 0x0002 /* Diagnostic-sampling flag */
58 #define PERF_CPUM_SF_MODE_MASK (PERF_CPUM_SF_BASIC_MODE| \
59 PERF_CPUM_SF_DIAG_MODE)
60 #define PERF_CPUM_SF_FULL_BLOCKS 0x0004 /* Process full SDBs only */
62 #define REG_NONE 0
63 #define REG_OVERFLOW 1
64 #define OVERFLOW_REG(hwc) ((hwc)->extra_reg.config)
65 #define SFB_ALLOC_REG(hwc) ((hwc)->extra_reg.alloc)
66 #define RAWSAMPLE_REG(hwc) ((hwc)->config)
67 #define TEAR_REG(hwc) ((hwc)->last_tag)
68 #define SAMPL_RATE(hwc) ((hwc)->event_base)
69 #define SAMPL_FLAGS(hwc) ((hwc)->config_base)
70 #define SAMPL_DIAG_MODE(hwc) (SAMPL_FLAGS(hwc) & PERF_CPUM_SF_DIAG_MODE)
71 #define SDB_FULL_BLOCKS(hwc) (SAMPL_FLAGS(hwc) & PERF_CPUM_SF_FULL_BLOCKS)
73 /* Structure for sampling data entries to be passed as perf raw sample data
74 * to user space. Note that raw sample data must be aligned and, thus, might
75 * be padded with zeros.
77 struct sf_raw_sample {
78 #define SF_RAW_SAMPLE_BASIC PERF_CPUM_SF_BASIC_MODE
79 #define SF_RAW_SAMPLE_DIAG PERF_CPUM_SF_DIAG_MODE
80 u64 format;
81 u32 size; /* Size of sf_raw_sample */
82 u16 bsdes; /* Basic-sampling data entry size */
83 u16 dsdes; /* Diagnostic-sampling data entry size */
84 struct hws_basic_entry basic; /* Basic-sampling data entry */
85 struct hws_diag_entry diag; /* Diagnostic-sampling data entry */
86 u8 padding[]; /* Padding to next multiple of 8 */
87 } __packed;
89 /* Perf hardware reserve and release functions */
90 #ifdef CONFIG_PERF_EVENTS
91 int perf_reserve_sampling(void);
92 void perf_release_sampling(void);
93 #else /* CONFIG_PERF_EVENTS */
94 static inline int perf_reserve_sampling(void)
96 return 0;
98 static inline void perf_release_sampling(void) {}
99 #endif /* CONFIG_PERF_EVENTS */
101 #endif /* _ASM_S390_PERF_EVENT_H */