blob: 7667bde37dcb50ecb0f8705294cb3a07137fddad [file] [log] [blame]
Ingo Molnarcdd6c482009-09-21 12:02:48 +02001/*
2 * Performance event support - s390 specific definitions.
3 *
Hendrik Bruecknerc7168322013-12-11 12:44:40 +01004 * Copyright IBM Corp. 2009, 2013
Hendrik Brueckner212188a2012-03-23 11:13:06 +01005 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
6 * Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Ingo Molnarcdd6c482009-09-21 12:02:48 +02007 */
8
Hendrik Bruecknerc7168322013-12-11 12:44:40 +01009#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 Brueckner212188a2012-03-23 11:13:06 +010016#include <asm/cpu_mf.h>
Ingo Molnarcdd6c482009-09-21 12:02:48 +020017
Hendrik Brueckner212188a2012-03-23 11:13:06 +010018/* Per-CPU flags for PMU states */
19#define PMU_F_RESERVED 0x1000
20#define PMU_F_ENABLED 0x2000
Hendrik Brueckner8c069ff2013-12-12 16:32:47 +010021#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 Graalfsb764bb12013-06-12 13:54:56 +020025
Hendrik Bruecknerc7168322013-12-11 12:44:40 +010026/* Perf defintions for PMU event attributes in sysfs */
27extern __init const struct attribute_group **cpumf_cf_event_group(void);
28extern 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 Graalfsb764bb12013-06-12 13:54:56 +020038
39/* Perf callbacks */
40struct pt_regs;
41extern unsigned long perf_instruction_pointer(struct pt_regs *regs);
42extern unsigned long perf_misc_flags(struct pt_regs *regs);
43#define perf_misc_flags(regs) perf_misc_flags(regs)
44
Hendrik Brueckner443e8022013-12-12 17:54:57 +010045/* Perf pt_regs extension for sample-data-entry indicators */
46struct perf_sf_sde_regs {
47 unsigned char in_guest:1; /* guest sample */
48 unsigned long reserved:63; /* reserved */
49};
50
Hendrik Brueckner8c069ff2013-12-12 16:32:47 +010051/* 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 Brueckner69f239e2013-12-12 17:03:48 +010058#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 Brueckner8c069ff2013-12-12 16:32:47 +010062#define TEAR_REG(hwc) ((hwc)->last_tag)
63#define SAMPL_RATE(hwc) ((hwc)->event_base)
64
Hendrik Bruecknere28bb792013-12-12 16:52:48 +010065/* Perf hardware reserve and release functions */
66int perf_reserve_sampling(void);
67void perf_release_sampling(void);
68
Heinz Graalfsb764bb12013-06-12 13:54:56 +020069#endif /* CONFIG_64BIT */
Hendrik Bruecknerc7168322013-12-11 12:44:40 +010070#endif /* _ASM_S390_PERF_EVENT_H */