Merge branch 'uaccess-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[linux-2.6-block.git] / arch / ia64 / include / asm / perfmon.h
CommitLineData
1da177e4
LT
1/*
2 * Copyright (C) 2001-2003 Hewlett-Packard Co
3 * Stephane Eranian <eranian@hpl.hp.com>
4 */
1da177e4
LT
5#ifndef _ASM_IA64_PERFMON_H
6#define _ASM_IA64_PERFMON_H
7
43e40f25 8#include <uapi/asm/perfmon.h>
1da177e4
LT
9
10
1da177e4
LT
11extern long perfmonctl(int fd, int cmd, void *arg, int narg);
12
a1ecf7f6
TL
13typedef struct {
14 void (*handler)(int irq, void *arg, struct pt_regs *regs);
15} pfm_intr_handler_desc_t;
16
1da177e4
LT
17extern void pfm_save_regs (struct task_struct *);
18extern void pfm_load_regs (struct task_struct *);
19
20extern void pfm_exit_thread(struct task_struct *);
21extern int pfm_use_debug_registers(struct task_struct *);
22extern int pfm_release_debug_registers(struct task_struct *);
23extern void pfm_syst_wide_update_task(struct task_struct *, unsigned long info, int is_ctxswin);
24extern void pfm_inherit(struct task_struct *task, struct pt_regs *regs);
25extern void pfm_init_percpu(void);
26extern void pfm_handle_work(void);
a1ecf7f6
TL
27extern int pfm_install_alt_pmu_interrupt(pfm_intr_handler_desc_t *h);
28extern int pfm_remove_alt_pmu_interrupt(pfm_intr_handler_desc_t *h);
29
30
1da177e4
LT
31
32/*
33 * Reset PMD register flags
34 */
35#define PFM_PMD_SHORT_RESET 0
36#define PFM_PMD_LONG_RESET 1
37
38typedef union {
39 unsigned int val;
40 struct {
41 unsigned int notify_user:1; /* notify user program of overflow */
42 unsigned int reset_ovfl_pmds:1; /* reset overflowed PMDs */
43 unsigned int block_task:1; /* block monitored task on kernel exit */
44 unsigned int mask_monitoring:1; /* mask monitors via PMCx.plm */
45 unsigned int reserved:28; /* for future use */
46 } bits;
47} pfm_ovfl_ctrl_t;
48
49typedef struct {
50 unsigned char ovfl_pmd; /* index of overflowed PMD */
51 unsigned char ovfl_notify; /* =1 if monitor requested overflow notification */
52 unsigned short active_set; /* event set active at the time of the overflow */
53 pfm_ovfl_ctrl_t ovfl_ctrl; /* return: perfmon controls to set by handler */
54
55 unsigned long pmd_last_reset; /* last reset value of of the PMD */
56 unsigned long smpl_pmds[4]; /* bitmask of other PMD of interest on overflow */
57 unsigned long smpl_pmds_values[PMU_MAX_PMDS]; /* values for the other PMDs of interest */
58 unsigned long pmd_value; /* current 64-bit value of the PMD */
59 unsigned long pmd_eventid; /* eventid associated with PMD */
60} pfm_ovfl_arg_t;
61
62
63typedef struct {
64 char *fmt_name;
65 pfm_uuid_t fmt_uuid;
66 size_t fmt_arg_size;
67 unsigned long fmt_flags;
68
69 int (*fmt_validate)(struct task_struct *task, unsigned int flags, int cpu, void *arg);
70 int (*fmt_getsize)(struct task_struct *task, unsigned int flags, int cpu, void *arg, unsigned long *size);
71 int (*fmt_init)(struct task_struct *task, void *buf, unsigned int flags, int cpu, void *arg);
72 int (*fmt_handler)(struct task_struct *task, void *buf, pfm_ovfl_arg_t *arg, struct pt_regs *regs, unsigned long stamp);
73 int (*fmt_restart)(struct task_struct *task, pfm_ovfl_ctrl_t *ctrl, void *buf, struct pt_regs *regs);
74 int (*fmt_restart_active)(struct task_struct *task, pfm_ovfl_ctrl_t *ctrl, void *buf, struct pt_regs *regs);
75 int (*fmt_exit)(struct task_struct *task, void *buf, struct pt_regs *regs);
76
77 struct list_head fmt_list;
78} pfm_buffer_fmt_t;
79
80extern int pfm_register_buffer_fmt(pfm_buffer_fmt_t *fmt);
81extern int pfm_unregister_buffer_fmt(pfm_uuid_t uuid);
82
83/*
84 * perfmon interface exported to modules
85 */
86extern int pfm_mod_read_pmds(struct task_struct *, void *req, unsigned int nreq, struct pt_regs *regs);
87extern int pfm_mod_write_pmcs(struct task_struct *, void *req, unsigned int nreq, struct pt_regs *regs);
88extern int pfm_mod_write_ibrs(struct task_struct *task, void *req, unsigned int nreq, struct pt_regs *regs);
89extern int pfm_mod_write_dbrs(struct task_struct *task, void *req, unsigned int nreq, struct pt_regs *regs);
90
91/*
92 * describe the content of the local_cpu_date->pfm_syst_info field
93 */
94#define PFM_CPUINFO_SYST_WIDE 0x1 /* if set a system wide session exists */
95#define PFM_CPUINFO_DCR_PP 0x2 /* if set the system wide session has started */
96#define PFM_CPUINFO_EXCL_IDLE 0x4 /* the system wide session excludes the idle task */
97
4944930a
SE
98/*
99 * sysctl control structure. visible to sampling formats
100 */
101typedef struct {
102 int debug; /* turn on/off debugging via syslog */
103 int debug_ovfl; /* turn on/off debug printk in overflow handler */
104 int fastctxsw; /* turn on/off fast (unsecure) ctxsw */
105 int expert_mode; /* turn on/off value checking */
106} pfm_sysctl_t;
107extern pfm_sysctl_t pfm_sysctl;
108
109
1da177e4 110#endif /* _ASM_IA64_PERFMON_H */