Ingo Molnar | cdd6c48 | 2009-09-21 12:02:48 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Performance event support - s390 specific definitions. |
| 3 | * |
Hendrik Brueckner | c716832 | 2013-12-11 12:44:40 +0100 | [diff] [blame] | 4 | * Copyright IBM Corp. 2009, 2013 |
Hendrik Brueckner | 212188a | 2012-03-23 11:13:06 +0100 | [diff] [blame] | 5 | * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com> |
| 6 | * Hendrik Brueckner <brueckner@linux.vnet.ibm.com> |
Ingo Molnar | cdd6c48 | 2009-09-21 12:02:48 +0200 | [diff] [blame] | 7 | */ |
| 8 | |
Hendrik Brueckner | c716832 | 2013-12-11 12:44:40 +0100 | [diff] [blame] | 9 | #ifndef _ASM_S390_PERF_EVENT_H |
| 10 | #define _ASM_S390_PERF_EVENT_H |
| 11 | |
| 12 | #ifdef CONFIG_64BIT |
| 13 | |
| 14 | #include <linux/perf_event.h> |
| 15 | #include <linux/device.h> |
Hendrik Brueckner | 212188a | 2012-03-23 11:13:06 +0100 | [diff] [blame] | 16 | #include <asm/cpu_mf.h> |
Ingo Molnar | cdd6c48 | 2009-09-21 12:02:48 +0200 | [diff] [blame] | 17 | |
Hendrik Brueckner | 212188a | 2012-03-23 11:13:06 +0100 | [diff] [blame] | 18 | /* Per-CPU flags for PMU states */ |
| 19 | #define PMU_F_RESERVED 0x1000 |
| 20 | #define PMU_F_ENABLED 0x2000 |
Hendrik Brueckner | 8c069ff | 2013-12-12 16:32:47 +0100 | [diff] [blame] | 21 | #define PMU_F_IN_USE 0x4000 |
| 22 | #define PMU_F_ERR_IBE 0x0100 |
| 23 | #define PMU_F_ERR_LSDA 0x0200 |
| 24 | #define PMU_F_ERR_MASK (PMU_F_ERR_IBE|PMU_F_ERR_LSDA) |
Heinz Graalfs | b764bb1 | 2013-06-12 13:54:56 +0200 | [diff] [blame] | 25 | |
Hendrik Brueckner | c716832 | 2013-12-11 12:44:40 +0100 | [diff] [blame] | 26 | /* Perf defintions for PMU event attributes in sysfs */ |
| 27 | extern __init const struct attribute_group **cpumf_cf_event_group(void); |
| 28 | extern ssize_t cpumf_events_sysfs_show(struct device *dev, |
| 29 | struct device_attribute *attr, |
| 30 | char *page); |
| 31 | #define EVENT_VAR(_cat, _name) event_attr_##_cat##_##_name |
| 32 | #define EVENT_PTR(_cat, _name) (&EVENT_VAR(_cat, _name).attr.attr) |
| 33 | |
| 34 | #define CPUMF_EVENT_ATTR(cat, name, id) \ |
| 35 | PMU_EVENT_ATTR(name, EVENT_VAR(cat, name), id, cpumf_events_sysfs_show) |
| 36 | #define CPUMF_EVENT_PTR(cat, name) EVENT_PTR(cat, name) |
| 37 | |
Heinz Graalfs | b764bb1 | 2013-06-12 13:54:56 +0200 | [diff] [blame] | 38 | |
| 39 | /* Perf callbacks */ |
| 40 | struct pt_regs; |
| 41 | extern unsigned long perf_instruction_pointer(struct pt_regs *regs); |
| 42 | extern unsigned long perf_misc_flags(struct pt_regs *regs); |
| 43 | #define perf_misc_flags(regs) perf_misc_flags(regs) |
| 44 | |
Hendrik Brueckner | 443e802 | 2013-12-12 17:54:57 +0100 | [diff] [blame^] | 45 | /* Perf pt_regs extension for sample-data-entry indicators */ |
| 46 | struct perf_sf_sde_regs { |
| 47 | unsigned char in_guest:1; /* guest sample */ |
| 48 | unsigned long reserved:63; /* reserved */ |
| 49 | }; |
| 50 | |
Hendrik Brueckner | 8c069ff | 2013-12-12 16:32:47 +0100 | [diff] [blame] | 51 | /* Perf PMU definitions for the counter facility */ |
| 52 | #define PERF_CPUM_CF_MAX_CTR 256 |
| 53 | |
| 54 | /* Perf PMU definitions for the sampling facility */ |
| 55 | #define PERF_CPUM_SF_MAX_CTR 1 |
| 56 | #define PERF_EVENT_CPUM_SF 0xB0000UL /* Raw event ID */ |
| 57 | |
Hendrik Brueckner | 69f239e | 2013-12-12 17:03:48 +0100 | [diff] [blame] | 58 | #define REG_NONE 0 |
| 59 | #define REG_OVERFLOW 1 |
| 60 | #define OVERFLOW_REG(hwc) ((hwc)->extra_reg.config) |
| 61 | #define SFB_ALLOC_REG(hwc) ((hwc)->extra_reg.alloc) |
Hendrik Brueckner | 8c069ff | 2013-12-12 16:32:47 +0100 | [diff] [blame] | 62 | #define TEAR_REG(hwc) ((hwc)->last_tag) |
| 63 | #define SAMPL_RATE(hwc) ((hwc)->event_base) |
| 64 | |
Hendrik Brueckner | e28bb79 | 2013-12-12 16:52:48 +0100 | [diff] [blame] | 65 | /* Perf hardware reserve and release functions */ |
| 66 | int perf_reserve_sampling(void); |
| 67 | void perf_release_sampling(void); |
| 68 | |
Heinz Graalfs | b764bb1 | 2013-06-12 13:54:56 +0200 | [diff] [blame] | 69 | #endif /* CONFIG_64BIT */ |
Hendrik Brueckner | c716832 | 2013-12-11 12:44:40 +0100 | [diff] [blame] | 70 | #endif /* _ASM_S390_PERF_EVENT_H */ |