1
2
3
4
5
6 #ifndef _ASM_IA64_PERFMON_H
7 #define _ASM_IA64_PERFMON_H
8
9 #include <uapi/asm/perfmon.h>
10
11
12 extern long perfmonctl(int fd, int cmd, void *arg, int narg);
13
14 typedef struct {
15 void (*handler)(int irq, void *arg, struct pt_regs *regs);
16 } pfm_intr_handler_desc_t;
17
18 extern void pfm_save_regs (struct task_struct *);
19 extern void pfm_load_regs (struct task_struct *);
20
21 extern void pfm_exit_thread(struct task_struct *);
22 extern int pfm_use_debug_registers(struct task_struct *);
23 extern int pfm_release_debug_registers(struct task_struct *);
24 extern void pfm_syst_wide_update_task(struct task_struct *, unsigned long info, int is_ctxswin);
25 extern void pfm_inherit(struct task_struct *task, struct pt_regs *regs);
26 extern void pfm_init_percpu(void);
27 extern void pfm_handle_work(void);
28 extern int pfm_install_alt_pmu_interrupt(pfm_intr_handler_desc_t *h);
29 extern int pfm_remove_alt_pmu_interrupt(pfm_intr_handler_desc_t *h);
30
31
32
33
34
35
36 #define PFM_PMD_SHORT_RESET 0
37 #define PFM_PMD_LONG_RESET 1
38
39 typedef union {
40 unsigned int val;
41 struct {
42 unsigned int notify_user:1;
43 unsigned int reset_ovfl_pmds:1;
44 unsigned int block_task:1;
45 unsigned int mask_monitoring:1;
46 unsigned int reserved:28;
47 } bits;
48 } pfm_ovfl_ctrl_t;
49
50 typedef struct {
51 unsigned char ovfl_pmd;
52 unsigned char ovfl_notify;
53 unsigned short active_set;
54 pfm_ovfl_ctrl_t ovfl_ctrl;
55
56 unsigned long pmd_last_reset;
57 unsigned long smpl_pmds[4];
58 unsigned long smpl_pmds_values[PMU_MAX_PMDS];
59 unsigned long pmd_value;
60 unsigned long pmd_eventid;
61 } pfm_ovfl_arg_t;
62
63
64 typedef struct {
65 char *fmt_name;
66 pfm_uuid_t fmt_uuid;
67 size_t fmt_arg_size;
68 unsigned long fmt_flags;
69
70 int (*fmt_validate)(struct task_struct *task, unsigned int flags, int cpu, void *arg);
71 int (*fmt_getsize)(struct task_struct *task, unsigned int flags, int cpu, void *arg, unsigned long *size);
72 int (*fmt_init)(struct task_struct *task, void *buf, unsigned int flags, int cpu, void *arg);
73 int (*fmt_handler)(struct task_struct *task, void *buf, pfm_ovfl_arg_t *arg, struct pt_regs *regs, unsigned long stamp);
74 int (*fmt_restart)(struct task_struct *task, pfm_ovfl_ctrl_t *ctrl, void *buf, struct pt_regs *regs);
75 int (*fmt_restart_active)(struct task_struct *task, pfm_ovfl_ctrl_t *ctrl, void *buf, struct pt_regs *regs);
76 int (*fmt_exit)(struct task_struct *task, void *buf, struct pt_regs *regs);
77
78 struct list_head fmt_list;
79 } pfm_buffer_fmt_t;
80
81 extern int pfm_register_buffer_fmt(pfm_buffer_fmt_t *fmt);
82 extern int pfm_unregister_buffer_fmt(pfm_uuid_t uuid);
83
84
85
86
87 extern int pfm_mod_read_pmds(struct task_struct *, void *req, unsigned int nreq, struct pt_regs *regs);
88 extern int pfm_mod_write_pmcs(struct task_struct *, void *req, unsigned int nreq, struct pt_regs *regs);
89 extern int pfm_mod_write_ibrs(struct task_struct *task, void *req, unsigned int nreq, struct pt_regs *regs);
90 extern int pfm_mod_write_dbrs(struct task_struct *task, void *req, unsigned int nreq, struct pt_regs *regs);
91
92
93
94
95 #define PFM_CPUINFO_SYST_WIDE 0x1
96 #define PFM_CPUINFO_DCR_PP 0x2
97 #define PFM_CPUINFO_EXCL_IDLE 0x4
98
99
100
101
102 typedef struct {
103 int debug;
104 int debug_ovfl;
105 int fastctxsw;
106 int expert_mode;
107 } pfm_sysctl_t;
108 extern pfm_sysctl_t pfm_sysctl;
109
110
111 #endif