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