From 1efb79086e3298b07f8734aae7614aa25ef82040 Mon Sep 17 00:00:00 2001 From: Mathieu Poirier Date: Tue, 31 May 2016 16:32:55 -0600 Subject: perf/core: adding PMU driver specific configuration It is entirely possible that some PMUs need specific configuration that is currently not found in the perf options before a session can be setup. It is the case for the CoreSight PMU where a sink needs to be provided. That sink doesn't fall in any of the current perf options. As such this patch adds the capability to receive driver specific configuration using the existing ioctl() mechanism. Once the configuration has been pushed down the kernel PMU callbacks are used to deal with the information sent from user space. Signed-off-by: Mathieu Poirier --- include/linux/perf_event.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include/linux') diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index f9828a48f16a..6e02e62fa1d9 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -391,6 +391,14 @@ struct pmu { * Filter events for PMU-specific reasons. */ int (*filter_match) (struct perf_event *event); /* optional */ + + /* + * Initial, PMU driver specific configuration. + */ + int (*get_drv_configs) (struct perf_event *event, + void __user *arg); /* optional */ + void (*free_drv_configs) (struct perf_event *event); + /* optional */ }; /** @@ -558,6 +566,7 @@ struct perf_event { struct irq_work pending; atomic_t event_limit; + struct list_head drv_configs; void (*destroy)(struct perf_event *); struct rcu_head rcu_head; -- cgit v1.2.3 From e5fd3d6e84b268edb1a3f66e4d974611e3908c00 Mon Sep 17 00:00:00 2001 From: Mathieu Poirier Date: Thu, 28 Apr 2016 16:26:25 -0600 Subject: perf: passing struct perf_event to function setup_aux() Some information, like driver specific configuration, is found in the perf event structure. As such pass a 'struct perf_event' to function setup_aux() rather than just the CPU number so that individual drivers can make the right configuration when setting up a session. Signed-off-by: Mathieu Poirier --- include/linux/perf_event.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/linux') diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 6e02e62fa1d9..ece8b9629a47 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -378,7 +378,7 @@ struct pmu { /* * Set up pmu-private data structures for an AUX area */ - void *(*setup_aux) (int cpu, void **pages, + void *(*setup_aux) (struct perf_event *event, void **pages, int nr_pages, bool overwrite); /* optional */ -- cgit v1.2.3