]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
coresight: Introduce pause and resume APIs for source
authorLeo Yan <leo.yan@arm.com>
Tue, 1 Apr 2025 18:07:03 +0000 (19:07 +0100)
committerSuzuki K Poulose <suzuki.poulose@arm.com>
Wed, 14 May 2025 10:56:17 +0000 (11:56 +0100)
Introduce APIs for pausing and resuming trace source and export as GPL
symbols.

Signed-off-by: Leo Yan <leo.yan@arm.com>
Reviewed-by: Mike Leach <mike.leach@linaro.org>
Reviewed-by: James Clark <james.clark@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20250401180708.385396-3-leo.yan@arm.com
drivers/hwtracing/coresight/coresight-core.c
drivers/hwtracing/coresight/coresight-priv.h
include/linux/coresight.h

index 5632bcb8feb609ecd36f8eeed4e3712f7bd74ba0..fa758cc21827552a5c97b6bdd05d22dec4994b22 100644 (file)
@@ -392,6 +392,28 @@ void coresight_disable_source(struct coresight_device *csdev, void *data)
 }
 EXPORT_SYMBOL_GPL(coresight_disable_source);
 
+void coresight_pause_source(struct coresight_device *csdev)
+{
+       if (!coresight_is_percpu_source(csdev))
+               return;
+
+       if (source_ops(csdev)->pause_perf)
+               source_ops(csdev)->pause_perf(csdev);
+}
+EXPORT_SYMBOL_GPL(coresight_pause_source);
+
+int coresight_resume_source(struct coresight_device *csdev)
+{
+       if (!coresight_is_percpu_source(csdev))
+               return -EOPNOTSUPP;
+
+       if (!source_ops(csdev)->resume_perf)
+               return -EOPNOTSUPP;
+
+       return source_ops(csdev)->resume_perf(csdev);
+}
+EXPORT_SYMBOL_GPL(coresight_resume_source);
+
 /*
  * coresight_disable_path_from : Disable components in the given path beyond
  * @nd in the list. If @nd is NULL, all the components, except the SOURCE are
index ce91e0fbb4975eb3e2f590ebe6ab49e52a7c0088..33e22b1ba043264ad50acac69ece1ea6de25893b 100644 (file)
@@ -251,5 +251,7 @@ void coresight_add_helper(struct coresight_device *csdev,
 void coresight_set_percpu_sink(int cpu, struct coresight_device *csdev);
 struct coresight_device *coresight_get_percpu_sink(int cpu);
 void coresight_disable_source(struct coresight_device *csdev, void *data);
+void coresight_pause_source(struct coresight_device *csdev);
+int coresight_resume_source(struct coresight_device *csdev);
 
 #endif
index 8abdd8b5c791236dd5e5c96ed6053e71199c22da..4ac65c68bbf44b98db22c3dad2d83a224ce5278e 100644 (file)
@@ -398,6 +398,8 @@ struct coresight_ops_link {
  *             is associated to.
  * @enable:    enables tracing for a source.
  * @disable:   disables tracing for a source.
+ * @resume_perf: resumes tracing for a source in perf session.
+ * @pause_perf:        pauses tracing for a source in perf session.
  */
 struct coresight_ops_source {
        int (*cpu_id)(struct coresight_device *csdev);
@@ -405,6 +407,8 @@ struct coresight_ops_source {
                      enum cs_mode mode, struct coresight_path *path);
        void (*disable)(struct coresight_device *csdev,
                        struct perf_event *event);
+       int (*resume_perf)(struct coresight_device *csdev);
+       void (*pause_perf)(struct coresight_device *csdev);
 };
 
 /**