diff options
Diffstat (limited to 'arch/powerpc/include/asm/perf_event_server.h')
| -rw-r--r-- | arch/powerpc/include/asm/perf_event_server.h | 26 | 
1 files changed, 26 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/perf_event_server.h b/arch/powerpc/include/asm/perf_event_server.h index 9710be3a2d1..136bba62efa 100644 --- a/arch/powerpc/include/asm/perf_event_server.h +++ b/arch/powerpc/include/asm/perf_event_server.h @@ -11,6 +11,7 @@  #include <linux/types.h>  #include <asm/hw_irq.h> +#include <linux/device.h>  #define MAX_HWEVENTS		8  #define MAX_EVENT_ALTERNATIVES	8 @@ -35,6 +36,7 @@ struct power_pmu {  	void		(*disable_pmc)(unsigned int pmc, unsigned long mmcr[]);  	int		(*limited_pmc_event)(u64 event_id);  	u32		flags; +	const struct attribute_group	**attr_groups;  	int		n_generic;  	int		*generic_events;  	int		(*cache_events)[PERF_COUNT_HW_CACHE_MAX] @@ -109,3 +111,27 @@ extern unsigned long perf_instruction_pointer(struct pt_regs *regs);   * If an event_id is not subject to the constraint expressed by a particular   * field, then it will have 0 in both the mask and value for that field.   */ + +extern ssize_t power_events_sysfs_show(struct device *dev, +				struct device_attribute *attr, char *page); + +/* + * EVENT_VAR() is same as PMU_EVENT_VAR with a suffix. + * + * Having a suffix allows us to have aliases in sysfs - eg: the generic + * event 'cpu-cycles' can have two entries in sysfs: 'cpu-cycles' and + * 'PM_CYC' where the latter is the name by which the event is known in + * POWER CPU specification. + */ +#define	EVENT_VAR(_id, _suffix)		event_attr_##_id##_suffix +#define	EVENT_PTR(_id, _suffix)		&EVENT_VAR(_id, _suffix).attr.attr + +#define	EVENT_ATTR(_name, _id, _suffix)					\ +	PMU_EVENT_ATTR(_name, EVENT_VAR(_id, _suffix), PME_PM_##_id,	\ +			power_events_sysfs_show) + +#define	GENERIC_EVENT_ATTR(_name, _id)	EVENT_ATTR(_name, _id, _g) +#define	GENERIC_EVENT_PTR(_id)		EVENT_PTR(_id, _g) + +#define	POWER_EVENT_ATTR(_name, _id)	EVENT_ATTR(PM_##_name, _id, _p) +#define	POWER_EVENT_PTR(_id)		EVENT_PTR(_id, _p)  |