Skip to content

Commit a0114b4

Browse files
mikel-armbbgregkh
authored andcommitted
coresight: etm-perf: Update to activate selected configuration
Add calls to activate the selected configuration as perf starts and stops the tracing session. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Suzuki K Poulose <[email protected]> Signed-off-by: Mike Leach <[email protected]> Signed-off-by: Mathieu Poirier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent f8cce2f commit a0114b4

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

drivers/hwtracing/coresight/coresight-etm-perf.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,10 @@ static void free_event_data(struct work_struct *work)
215215
/* Free the sink buffers, if there are any */
216216
free_sink_buffer(event_data);
217217

218+
/* clear any configuration we were using */
219+
if (event_data->cfg_hash)
220+
cscfg_deactivate_config(event_data->cfg_hash);
221+
218222
for_each_cpu(cpu, mask) {
219223
struct list_head **ppath;
220224

@@ -292,7 +296,7 @@ static bool sinks_compatible(struct coresight_device *a,
292296
static void *etm_setup_aux(struct perf_event *event, void **pages,
293297
int nr_pages, bool overwrite)
294298
{
295-
u32 id;
299+
u32 id, cfg_hash;
296300
int cpu = event->cpu;
297301
cpumask_t *mask;
298302
struct coresight_device *sink = NULL;
@@ -310,6 +314,14 @@ static void *etm_setup_aux(struct perf_event *event, void **pages,
310314
sink = user_sink = coresight_get_sink_by_id(id);
311315
}
312316

317+
/* check if user wants a coresight configuration selected */
318+
cfg_hash = (u32)((event->attr.config2 & GENMASK_ULL(63, 32)) >> 32);
319+
if (cfg_hash) {
320+
if (cscfg_activate_config(cfg_hash))
321+
goto err;
322+
event_data->cfg_hash = cfg_hash;
323+
}
324+
313325
mask = &event_data->mask;
314326

315327
/*

drivers/hwtracing/coresight/coresight-etm-perf.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,14 @@ struct etm_filters {
4949
* @work: Handle to free allocated memory outside IRQ context.
5050
* @mask: Hold the CPU(s) this event was set for.
5151
* @snk_config: The sink configuration.
52+
* @cfg_hash: The hash id of any coresight config selected.
5253
* @path: An array of path, each slot for one CPU.
5354
*/
5455
struct etm_event_data {
5556
struct work_struct work;
5657
cpumask_t mask;
5758
void *snk_config;
59+
u32 cfg_hash;
5860
struct list_head * __percpu *path;
5961
};
6062

0 commit comments

Comments
 (0)