mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
coresight: change the sink_ops to accept coresight_path
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
This commit is contained in:
committed by
Suzuki K Poulose
parent
94baedb51d
commit
b139702a88
@@ -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
|
||||
|
||||
@@ -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");
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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 *
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user