Skip to content

Commit 5fa96c8

Browse files
Leo-YanSuzuki K Poulose
authored andcommitted
coresight: Introduce pause and resume APIs for source
Introduce APIs for pausing and resuming trace source and export as GPL symbols. Signed-off-by: Leo Yan <[email protected]> Reviewed-by: Mike Leach <[email protected]> Reviewed-by: James Clark <[email protected]> Signed-off-by: Suzuki K Poulose <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 40f682a commit 5fa96c8

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

drivers/hwtracing/coresight/coresight-core.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,28 @@ void coresight_disable_source(struct coresight_device *csdev, void *data)
392392
}
393393
EXPORT_SYMBOL_GPL(coresight_disable_source);
394394

395+
void coresight_pause_source(struct coresight_device *csdev)
396+
{
397+
if (!coresight_is_percpu_source(csdev))
398+
return;
399+
400+
if (source_ops(csdev)->pause_perf)
401+
source_ops(csdev)->pause_perf(csdev);
402+
}
403+
EXPORT_SYMBOL_GPL(coresight_pause_source);
404+
405+
int coresight_resume_source(struct coresight_device *csdev)
406+
{
407+
if (!coresight_is_percpu_source(csdev))
408+
return -EOPNOTSUPP;
409+
410+
if (!source_ops(csdev)->resume_perf)
411+
return -EOPNOTSUPP;
412+
413+
return source_ops(csdev)->resume_perf(csdev);
414+
}
415+
EXPORT_SYMBOL_GPL(coresight_resume_source);
416+
395417
/*
396418
* coresight_disable_path_from : Disable components in the given path beyond
397419
* @nd in the list. If @nd is NULL, all the components, except the SOURCE are

drivers/hwtracing/coresight/coresight-priv.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,5 +251,7 @@ void coresight_add_helper(struct coresight_device *csdev,
251251
void coresight_set_percpu_sink(int cpu, struct coresight_device *csdev);
252252
struct coresight_device *coresight_get_percpu_sink(int cpu);
253253
void coresight_disable_source(struct coresight_device *csdev, void *data);
254+
void coresight_pause_source(struct coresight_device *csdev);
255+
int coresight_resume_source(struct coresight_device *csdev);
254256

255257
#endif

include/linux/coresight.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,13 +398,17 @@ struct coresight_ops_link {
398398
* is associated to.
399399
* @enable: enables tracing for a source.
400400
* @disable: disables tracing for a source.
401+
* @resume_perf: resumes tracing for a source in perf session.
402+
* @pause_perf: pauses tracing for a source in perf session.
401403
*/
402404
struct coresight_ops_source {
403405
int (*cpu_id)(struct coresight_device *csdev);
404406
int (*enable)(struct coresight_device *csdev, struct perf_event *event,
405407
enum cs_mode mode, struct coresight_path *path);
406408
void (*disable)(struct coresight_device *csdev,
407409
struct perf_event *event);
410+
int (*resume_perf)(struct coresight_device *csdev);
411+
void (*pause_perf)(struct coresight_device *csdev);
408412
};
409413

410414
/**

0 commit comments

Comments
 (0)