1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright(C) 2015 Linaro Limited. All rights reserved.
4 * Author: Mathieu Poirier <mathieu.poirier@linaro.org>
7 #ifndef _CORESIGHT_ETM_PERF_H
8 #define _CORESIGHT_ETM_PERF_H
10 #include <linux/percpu-defs.h>
11 #include "coresight-priv.h"
13 struct coresight_device
;
16 * In both ETMv3 and v4 the maximum number of address comparator implentable
17 * is 8. The actual number is implementation specific and will be checked
18 * when filters are applied.
20 #define ETM_ADDR_CMP_MAX 8
23 * struct etm_filter - single instruction range or start/stop configuration.
24 * @start_addr: The address to start tracing on.
25 * @stop_addr: The address to stop tracing on.
26 * @type: Is this a range or start/stop filter.
29 unsigned long start_addr
;
30 unsigned long stop_addr
;
31 enum etm_addr_type type
;
35 * struct etm_filters - set of filters for a session
36 * @etm_filter: All the filters for this session.
37 * @nr_filters: Number of filters
38 * @ssstatus: Status of the start/stop logic.
41 struct etm_filter etm_filter
[ETM_ADDR_CMP_MAX
];
42 unsigned int nr_filters
;
47 * struct etm_event_data - Coresight specifics associated to an event
48 * @work: Handle to free allocated memory outside IRQ context.
49 * @mask: Hold the CPU(s) this event was set for.
50 * @snk_config: The sink configuration.
51 * @path: An array of path, each slot for one CPU.
53 struct etm_event_data
{
54 struct work_struct work
;
57 struct list_head
* __percpu
*path
;
60 #if IS_ENABLED(CONFIG_CORESIGHT)
61 int etm_perf_symlink(struct coresight_device
*csdev
, bool link
);
62 int etm_perf_add_symlink_sink(struct coresight_device
*csdev
);
63 void etm_perf_del_symlink_sink(struct coresight_device
*csdev
);
64 static inline void *etm_perf_sink_config(struct perf_output_handle
*handle
)
66 struct etm_event_data
*data
= perf_get_aux(handle
);
69 return data
->snk_config
;
73 static inline int etm_perf_symlink(struct coresight_device
*csdev
, bool link
)
75 int etm_perf_add_symlink_sink(struct coresight_device
*csdev
)
77 void etm_perf_del_symlink_sink(struct coresight_device
*csdev
) {}
78 static inline void *etm_perf_sink_config(struct perf_output_handle
*handle
)
83 #endif /* CONFIG_CORESIGHT */
85 int __init
etm_perf_init(void);
86 void __exit
etm_perf_exit(void);