]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
coresight: change the sink_ops to accept coresight_path
authorJie Gan <jie.gan@oss.qualcomm.com>
Thu, 25 Sep 2025 10:42:33 +0000 (18:42 +0800)
committerSuzuki K Poulose <suzuki.poulose@arm.com>
Mon, 10 Nov 2025 10:07:42 +0000 (10:07 +0000)
Update the sink_enable functions to accept coresight_path instead of
a generic void *data, as coresight_path encapsulates all the necessary
data required by devices along the path.

Tested-by: Carl Worth <carl@os.amperecomputing.com>
Reviewed-by: Carl Worth <carl@os.amperecomputing.com>
Reviewed-by: Leo Yan <leo.yan@arm.com>
Signed-off-by: Jie Gan <jie.gan@oss.qualcomm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20250925-fix_helper_data-v2-3-edd8a07c1646@oss.qualcomm.com
12 files changed:
drivers/hwtracing/coresight/coresight-core.c
drivers/hwtracing/coresight/coresight-dummy.c
drivers/hwtracing/coresight/coresight-etb10.c
drivers/hwtracing/coresight/coresight-etm-perf.c
drivers/hwtracing/coresight/coresight-priv.h
drivers/hwtracing/coresight/coresight-sysfs.c
drivers/hwtracing/coresight/coresight-tmc-etf.c
drivers/hwtracing/coresight/coresight-tmc-etr.c
drivers/hwtracing/coresight/coresight-tpiu.c
drivers/hwtracing/coresight/coresight-trbe.c
drivers/hwtracing/coresight/ultrasoc-smb.c
include/linux/coresight.h

index f44ec9e5b6926739d3701e9784747dbe29b182a8..c660cf8adb1c7cafff8f85e501f056e4e151e372 100644 (file)
@@ -300,9 +300,10 @@ unlock:
 EXPORT_SYMBOL_GPL(coresight_add_helper);
 
 static int coresight_enable_sink(struct coresight_device *csdev,
-                                enum cs_mode mode, void *data)
+                                enum cs_mode mode,
+                                struct coresight_path *path)
 {
-       return sink_ops(csdev)->enable(csdev, mode, data);
+       return sink_ops(csdev)->enable(csdev, mode, path);
 }
 
 static void coresight_disable_sink(struct coresight_device *csdev)
@@ -501,8 +502,7 @@ static int coresight_enable_helpers(struct coresight_device *csdev,
        return 0;
 }
 
-int coresight_enable_path(struct coresight_path *path, enum cs_mode mode,
-                         void *sink_data)
+int coresight_enable_path(struct coresight_path *path, enum cs_mode mode)
 {
        int ret = 0;
        u32 type;
@@ -532,7 +532,7 @@ int coresight_enable_path(struct coresight_path *path, enum cs_mode mode,
 
                switch (type) {
                case CORESIGHT_DEV_TYPE_SINK:
-                       ret = coresight_enable_sink(csdev, mode, sink_data);
+                       ret = coresight_enable_sink(csdev, mode, path);
                        /*
                         * Sink is the first component turned on. If we
                         * failed to enable the sink, there are no components
index aaa92b5081e3d2bb85d57f90ab68a1dc6a1f0dd8..14322c99e29d4696bc27ac2326280026412fe05f 100644 (file)
@@ -52,7 +52,7 @@ static int dummy_source_trace_id(struct coresight_device *csdev, __maybe_unused
 }
 
 static int dummy_sink_enable(struct coresight_device *csdev, enum cs_mode mode,
-                               void *data)
+                            struct coresight_path *path)
 {
        dev_dbg(csdev->dev.parent, "Dummy sink enabled\n");
 
index 35db1b6093d154d67dc567df42f838e2ba3d1d58..6657602d8f2e1b75ea6a8440e35c489d21f4245e 100644 (file)
@@ -167,13 +167,13 @@ out:
        return ret;
 }
 
-static int etb_enable_perf(struct coresight_device *csdev, void *data)
+static int etb_enable_perf(struct coresight_device *csdev, struct coresight_path *path)
 {
        int ret = 0;
        pid_t pid;
        unsigned long flags;
        struct etb_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
-       struct perf_output_handle *handle = data;
+       struct perf_output_handle *handle = path->handle;
        struct cs_buffers *buf = etm_perf_sink_config(handle);
 
        raw_spin_lock_irqsave(&drvdata->spinlock, flags);
@@ -224,7 +224,7 @@ out:
 }
 
 static int etb_enable(struct coresight_device *csdev, enum cs_mode mode,
-                     void *data)
+                     struct coresight_path *path)
 {
        int ret;
 
@@ -233,7 +233,7 @@ static int etb_enable(struct coresight_device *csdev, enum cs_mode mode,
                ret = etb_enable_sysfs(csdev);
                break;
        case CS_MODE_PERF:
-               ret = etb_enable_perf(csdev, data);
+               ret = etb_enable_perf(csdev, path);
                break;
        default:
                ret = -EINVAL;
index 5c256af6e54af0cef8ea5d2e94a6d30056395e39..17afa0f4cdeea94ddf428df4a502cefe02e382d5 100644 (file)
@@ -527,7 +527,7 @@ static void etm_event_start(struct perf_event *event, int flags)
                goto fail_end_stop;
 
        /* Nothing will happen without a path */
-       if (coresight_enable_path(path, CS_MODE_PERF, handle))
+       if (coresight_enable_path(path, CS_MODE_PERF))
                goto fail_end_stop;
 
        /* Finally enable the tracer */
index 33e22b1ba043264ad50acac69ece1ea6de25893b..fd896ac07942ec0a4c7acff9f32421352c1efef2 100644 (file)
@@ -135,8 +135,7 @@ static inline void CS_UNLOCK(void __iomem *addr)
 }
 
 void coresight_disable_path(struct coresight_path *path);
-int coresight_enable_path(struct coresight_path *path, enum cs_mode mode,
-                         void *sink_data);
+int coresight_enable_path(struct coresight_path *path, enum cs_mode mode);
 struct coresight_device *coresight_get_sink(struct coresight_path *path);
 struct coresight_device *coresight_get_sink_by_id(u32 id);
 struct coresight_device *
index 5e52324aa9ac7b3de9379bc3f2b349a2cdea83c2..d2a6ed8bcc74d64dccc735463f14790b4e80d101 100644 (file)
@@ -215,7 +215,7 @@ int coresight_enable_sysfs(struct coresight_device *csdev)
        if (!IS_VALID_CS_TRACE_ID(path->trace_id))
                goto err_path;
 
-       ret = coresight_enable_path(path, CS_MODE_SYSFS, NULL);
+       ret = coresight_enable_path(path, CS_MODE_SYSFS);
        if (ret)
                goto err_path;
 
index 0f45ab5e5249933ce7059dfee7fe7376ab33ed2d..8882b1c4cdc05353fb2efd6a9ba862943048f0ff 100644 (file)
@@ -246,13 +246,14 @@ out:
        return ret;
 }
 
-static int tmc_enable_etf_sink_perf(struct coresight_device *csdev, void *data)
+static int tmc_enable_etf_sink_perf(struct coresight_device *csdev,
+                                   struct coresight_path *path)
 {
        int ret = 0;
        pid_t pid;
        unsigned long flags;
        struct tmc_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
-       struct perf_output_handle *handle = data;
+       struct perf_output_handle *handle = path->handle;
        struct cs_buffers *buf = etm_perf_sink_config(handle);
 
        raw_spin_lock_irqsave(&drvdata->spinlock, flags);
@@ -304,7 +305,8 @@ static int tmc_enable_etf_sink_perf(struct coresight_device *csdev, void *data)
 }
 
 static int tmc_enable_etf_sink(struct coresight_device *csdev,
-                              enum cs_mode mode, void *data)
+                              enum cs_mode mode,
+                              struct coresight_path *path)
 {
        int ret;
 
@@ -313,7 +315,7 @@ static int tmc_enable_etf_sink(struct coresight_device *csdev,
                ret = tmc_enable_etf_sink_sysfs(csdev);
                break;
        case CS_MODE_PERF:
-               ret = tmc_enable_etf_sink_perf(csdev, data);
+               ret = tmc_enable_etf_sink_perf(csdev, path);
                break;
        /* We shouldn't be here */
        default:
index 51c6f73dd15c583f75d14383d7fd0527a2e5fd72..e0d83ee01b77a5318dbc7fb51a18cacfb8419b62 100644 (file)
@@ -1733,13 +1733,14 @@ out:
        return size;
 }
 
-static int tmc_enable_etr_sink_perf(struct coresight_device *csdev, void *data)
+static int tmc_enable_etr_sink_perf(struct coresight_device *csdev,
+                                   struct coresight_path *path)
 {
        int rc = 0;
        pid_t pid;
        unsigned long flags;
        struct tmc_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
-       struct perf_output_handle *handle = data;
+       struct perf_output_handle *handle = path->handle;
        struct etr_perf_buffer *etr_perf = etm_perf_sink_config(handle);
 
        raw_spin_lock_irqsave(&drvdata->spinlock, flags);
@@ -1787,13 +1788,14 @@ unlock_out:
 }
 
 static int tmc_enable_etr_sink(struct coresight_device *csdev,
-                              enum cs_mode mode, void *data)
+                              enum cs_mode mode,
+                              struct coresight_path *path)
 {
        switch (mode) {
        case CS_MODE_SYSFS:
                return tmc_enable_etr_sink_sysfs(csdev);
        case CS_MODE_PERF:
-               return tmc_enable_etr_sink_perf(csdev, data);
+               return tmc_enable_etr_sink_perf(csdev, path);
        default:
                return -EINVAL;
        }
index 9463afdbda8ad74eee78c72185fe7603f81b7888..aaa44bc521c330f5b2e385279e0cbda6ce72bccb 100644 (file)
@@ -75,7 +75,7 @@ static void tpiu_enable_hw(struct csdev_access *csa)
 }
 
 static int tpiu_enable(struct coresight_device *csdev, enum cs_mode mode,
-                      void *__unused)
+                      struct coresight_path *path)
 {
        struct tpiu_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
 
index 43643d2c5bdd0ac432f976dbe666ff0f494033ee..293715b4ff0eb0abe30f9b477700ca94f81cd4a2 100644 (file)
@@ -1013,11 +1013,11 @@ err:
 }
 
 static int arm_trbe_enable(struct coresight_device *csdev, enum cs_mode mode,
-                          void *data)
+                          struct coresight_path *path)
 {
        struct trbe_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
        struct trbe_cpudata *cpudata = dev_get_drvdata(&csdev->dev);
-       struct perf_output_handle *handle = data;
+       struct perf_output_handle *handle = path->handle;
        struct trbe_buf *buf = etm_perf_sink_config(handle);
 
        WARN_ON(cpudata->cpu != smp_processor_id());
index 26cfc939e5bd810295a336f392ac282ccf316f9f..8f7922a5e534fde57ae4c84f2e72b33749809857 100644 (file)
@@ -213,10 +213,11 @@ static void smb_enable_sysfs(struct coresight_device *csdev)
        coresight_set_mode(csdev, CS_MODE_SYSFS);
 }
 
-static int smb_enable_perf(struct coresight_device *csdev, void *data)
+static int smb_enable_perf(struct coresight_device *csdev,
+                          struct coresight_path *path)
 {
        struct smb_drv_data *drvdata = dev_get_drvdata(csdev->dev.parent);
-       struct perf_output_handle *handle = data;
+       struct perf_output_handle *handle = path->handle;
        struct cs_buffers *buf = etm_perf_sink_config(handle);
        pid_t pid;
 
@@ -240,7 +241,7 @@ static int smb_enable_perf(struct coresight_device *csdev, void *data)
 }
 
 static int smb_enable(struct coresight_device *csdev, enum cs_mode mode,
-                     void *data)
+                     struct coresight_path *path)
 {
        struct smb_drv_data *drvdata = dev_get_drvdata(csdev->dev.parent);
        int ret = 0;
@@ -261,7 +262,7 @@ static int smb_enable(struct coresight_device *csdev, enum cs_mode mode,
                smb_enable_sysfs(csdev);
                break;
        case CS_MODE_PERF:
-               ret = smb_enable_perf(csdev, data);
+               ret = smb_enable_perf(csdev, path);
                break;
        default:
                ret = -EINVAL;
index 2bee2e3bb1c6449fdafc1cb44e8ab5ba24191519..56d0108658db34b8f2d184cd3214ca172a3ce808 100644 (file)
@@ -367,7 +367,7 @@ enum cs_mode {
  */
 struct coresight_ops_sink {
        int (*enable)(struct coresight_device *csdev, enum cs_mode mode,
-                     void *data);
+                     struct coresight_path *path);
        int (*disable)(struct coresight_device *csdev);
        void *(*alloc_buffer)(struct coresight_device *csdev,
                              struct perf_event *event, void **pages,