mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
coresight: change helper_ops to accept coresight_path
Update the helper_enable and helper_disable 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-2-edd8a07c1646@oss.qualcomm.com
This commit is contained in:
committed by
Suzuki K Poulose
parent
aaa5abcc9d
commit
94baedb51d
@@ -397,7 +397,7 @@ static int catu_wait_for_ready(struct catu_drvdata *drvdata)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int catu_enable_hw(struct catu_drvdata *drvdata, enum cs_mode cs_mode,
|
static int catu_enable_hw(struct catu_drvdata *drvdata, enum cs_mode cs_mode,
|
||||||
void *data)
|
struct coresight_path *path)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
u32 control, mode;
|
u32 control, mode;
|
||||||
@@ -425,7 +425,7 @@ static int catu_enable_hw(struct catu_drvdata *drvdata, enum cs_mode cs_mode,
|
|||||||
etrdev = coresight_find_input_type(
|
etrdev = coresight_find_input_type(
|
||||||
csdev->pdata, CORESIGHT_DEV_TYPE_SINK, etr_subtype);
|
csdev->pdata, CORESIGHT_DEV_TYPE_SINK, etr_subtype);
|
||||||
if (etrdev) {
|
if (etrdev) {
|
||||||
etr_buf = tmc_etr_get_buffer(etrdev, cs_mode, data);
|
etr_buf = tmc_etr_get_buffer(etrdev, cs_mode, path);
|
||||||
if (IS_ERR(etr_buf))
|
if (IS_ERR(etr_buf))
|
||||||
return PTR_ERR(etr_buf);
|
return PTR_ERR(etr_buf);
|
||||||
}
|
}
|
||||||
@@ -455,7 +455,7 @@ static int catu_enable_hw(struct catu_drvdata *drvdata, enum cs_mode cs_mode,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int catu_enable(struct coresight_device *csdev, enum cs_mode mode,
|
static int catu_enable(struct coresight_device *csdev, enum cs_mode mode,
|
||||||
void *data)
|
struct coresight_path *path)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
struct catu_drvdata *catu_drvdata = csdev_to_catu_drvdata(csdev);
|
struct catu_drvdata *catu_drvdata = csdev_to_catu_drvdata(csdev);
|
||||||
@@ -463,7 +463,7 @@ static int catu_enable(struct coresight_device *csdev, enum cs_mode mode,
|
|||||||
guard(raw_spinlock_irqsave)(&catu_drvdata->spinlock);
|
guard(raw_spinlock_irqsave)(&catu_drvdata->spinlock);
|
||||||
if (csdev->refcnt == 0) {
|
if (csdev->refcnt == 0) {
|
||||||
CS_UNLOCK(catu_drvdata->base);
|
CS_UNLOCK(catu_drvdata->base);
|
||||||
rc = catu_enable_hw(catu_drvdata, mode, data);
|
rc = catu_enable_hw(catu_drvdata, mode, path);
|
||||||
CS_LOCK(catu_drvdata->base);
|
CS_LOCK(catu_drvdata->base);
|
||||||
}
|
}
|
||||||
if (!rc)
|
if (!rc)
|
||||||
@@ -488,7 +488,7 @@ static int catu_disable_hw(struct catu_drvdata *drvdata)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int catu_disable(struct coresight_device *csdev, void *__unused)
|
static int catu_disable(struct coresight_device *csdev, struct coresight_path *path)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
struct catu_drvdata *catu_drvdata = csdev_to_catu_drvdata(csdev);
|
struct catu_drvdata *catu_drvdata = csdev_to_catu_drvdata(csdev);
|
||||||
|
|||||||
@@ -355,17 +355,20 @@ static bool coresight_is_helper(struct coresight_device *csdev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int coresight_enable_helper(struct coresight_device *csdev,
|
static int coresight_enable_helper(struct coresight_device *csdev,
|
||||||
enum cs_mode mode, void *data)
|
enum cs_mode mode,
|
||||||
|
struct coresight_path *path)
|
||||||
{
|
{
|
||||||
return helper_ops(csdev)->enable(csdev, mode, data);
|
return helper_ops(csdev)->enable(csdev, mode, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void coresight_disable_helper(struct coresight_device *csdev, void *data)
|
static void coresight_disable_helper(struct coresight_device *csdev,
|
||||||
|
struct coresight_path *path)
|
||||||
{
|
{
|
||||||
helper_ops(csdev)->disable(csdev, data);
|
helper_ops(csdev)->disable(csdev, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void coresight_disable_helpers(struct coresight_device *csdev, void *data)
|
static void coresight_disable_helpers(struct coresight_device *csdev,
|
||||||
|
struct coresight_path *path)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct coresight_device *helper;
|
struct coresight_device *helper;
|
||||||
@@ -373,7 +376,7 @@ static void coresight_disable_helpers(struct coresight_device *csdev, void *data
|
|||||||
for (i = 0; i < csdev->pdata->nr_outconns; ++i) {
|
for (i = 0; i < csdev->pdata->nr_outconns; ++i) {
|
||||||
helper = csdev->pdata->out_conns[i]->dest_dev;
|
helper = csdev->pdata->out_conns[i]->dest_dev;
|
||||||
if (helper && coresight_is_helper(helper))
|
if (helper && coresight_is_helper(helper))
|
||||||
coresight_disable_helper(helper, data);
|
coresight_disable_helper(helper, path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -479,7 +482,8 @@ void coresight_disable_path(struct coresight_path *path)
|
|||||||
EXPORT_SYMBOL_GPL(coresight_disable_path);
|
EXPORT_SYMBOL_GPL(coresight_disable_path);
|
||||||
|
|
||||||
static int coresight_enable_helpers(struct coresight_device *csdev,
|
static int coresight_enable_helpers(struct coresight_device *csdev,
|
||||||
enum cs_mode mode, void *data)
|
enum cs_mode mode,
|
||||||
|
struct coresight_path *path)
|
||||||
{
|
{
|
||||||
int i, ret = 0;
|
int i, ret = 0;
|
||||||
struct coresight_device *helper;
|
struct coresight_device *helper;
|
||||||
@@ -489,7 +493,7 @@ static int coresight_enable_helpers(struct coresight_device *csdev,
|
|||||||
if (!helper || !coresight_is_helper(helper))
|
if (!helper || !coresight_is_helper(helper))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ret = coresight_enable_helper(helper, mode, data);
|
ret = coresight_enable_helper(helper, mode, path);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,17 +156,14 @@ static int ctcu_set_etr_traceid(struct coresight_device *csdev, struct coresight
|
|||||||
return __ctcu_set_etr_traceid(csdev, traceid, port_num, enable);
|
return __ctcu_set_etr_traceid(csdev, traceid, port_num, enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ctcu_enable(struct coresight_device *csdev, enum cs_mode mode, void *data)
|
static int ctcu_enable(struct coresight_device *csdev, enum cs_mode mode,
|
||||||
|
struct coresight_path *path)
|
||||||
{
|
{
|
||||||
struct coresight_path *path = (struct coresight_path *)data;
|
|
||||||
|
|
||||||
return ctcu_set_etr_traceid(csdev, path, true);
|
return ctcu_set_etr_traceid(csdev, path, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ctcu_disable(struct coresight_device *csdev, void *data)
|
static int ctcu_disable(struct coresight_device *csdev, struct coresight_path *path)
|
||||||
{
|
{
|
||||||
struct coresight_path *path = (struct coresight_path *)data;
|
|
||||||
|
|
||||||
return ctcu_set_etr_traceid(csdev, path, false);
|
return ctcu_set_etr_traceid(csdev, path, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -799,14 +799,15 @@ static void cti_pm_release(struct cti_drvdata *drvdata)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** cti ect operations **/
|
/** cti ect operations **/
|
||||||
int cti_enable(struct coresight_device *csdev, enum cs_mode mode, void *data)
|
int cti_enable(struct coresight_device *csdev, enum cs_mode mode,
|
||||||
|
struct coresight_path *path)
|
||||||
{
|
{
|
||||||
struct cti_drvdata *drvdata = csdev_to_cti_drvdata(csdev);
|
struct cti_drvdata *drvdata = csdev_to_cti_drvdata(csdev);
|
||||||
|
|
||||||
return cti_enable_hw(drvdata);
|
return cti_enable_hw(drvdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
int cti_disable(struct coresight_device *csdev, void *data)
|
int cti_disable(struct coresight_device *csdev, struct coresight_path *path)
|
||||||
{
|
{
|
||||||
struct cti_drvdata *drvdata = csdev_to_cti_drvdata(csdev);
|
struct cti_drvdata *drvdata = csdev_to_cti_drvdata(csdev);
|
||||||
|
|
||||||
|
|||||||
@@ -216,8 +216,9 @@ int cti_add_connection_entry(struct device *dev, struct cti_drvdata *drvdata,
|
|||||||
const char *assoc_dev_name);
|
const char *assoc_dev_name);
|
||||||
struct cti_trig_con *cti_allocate_trig_con(struct device *dev, int in_sigs,
|
struct cti_trig_con *cti_allocate_trig_con(struct device *dev, int in_sigs,
|
||||||
int out_sigs);
|
int out_sigs);
|
||||||
int cti_enable(struct coresight_device *csdev, enum cs_mode mode, void *data);
|
int cti_enable(struct coresight_device *csdev, enum cs_mode mode,
|
||||||
int cti_disable(struct coresight_device *csdev, void *data);
|
struct coresight_path *path);
|
||||||
|
int cti_disable(struct coresight_device *csdev, struct coresight_path *path);
|
||||||
void cti_write_all_hw_regs(struct cti_drvdata *drvdata);
|
void cti_write_all_hw_regs(struct cti_drvdata *drvdata);
|
||||||
void cti_write_intack(struct device *dev, u32 ackval);
|
void cti_write_intack(struct device *dev, u32 ackval);
|
||||||
void cti_write_single_reg(struct cti_drvdata *drvdata, int offset, u32 value);
|
void cti_write_single_reg(struct cti_drvdata *drvdata, int offset, u32 value);
|
||||||
|
|||||||
@@ -1332,9 +1332,9 @@ out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct etr_buf *tmc_etr_get_buffer(struct coresight_device *csdev,
|
struct etr_buf *tmc_etr_get_buffer(struct coresight_device *csdev,
|
||||||
enum cs_mode mode, void *data)
|
enum cs_mode mode,
|
||||||
|
struct coresight_path *path)
|
||||||
{
|
{
|
||||||
struct coresight_path *path = data;
|
|
||||||
struct perf_output_handle *handle = path->handle;
|
struct perf_output_handle *handle = path->handle;
|
||||||
struct etr_perf_buffer *etr_perf;
|
struct etr_perf_buffer *etr_perf;
|
||||||
|
|
||||||
|
|||||||
@@ -442,7 +442,8 @@ struct coresight_device *tmc_etr_get_catu_device(struct tmc_drvdata *drvdata);
|
|||||||
void tmc_etr_set_catu_ops(const struct etr_buf_operations *catu);
|
void tmc_etr_set_catu_ops(const struct etr_buf_operations *catu);
|
||||||
void tmc_etr_remove_catu_ops(void);
|
void tmc_etr_remove_catu_ops(void);
|
||||||
struct etr_buf *tmc_etr_get_buffer(struct coresight_device *csdev,
|
struct etr_buf *tmc_etr_get_buffer(struct coresight_device *csdev,
|
||||||
enum cs_mode mode, void *data);
|
enum cs_mode mode,
|
||||||
|
struct coresight_path *path);
|
||||||
extern const struct attribute_group coresight_etr_group;
|
extern const struct attribute_group coresight_etr_group;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -424,8 +424,9 @@ struct coresight_ops_source {
|
|||||||
*/
|
*/
|
||||||
struct coresight_ops_helper {
|
struct coresight_ops_helper {
|
||||||
int (*enable)(struct coresight_device *csdev, enum cs_mode mode,
|
int (*enable)(struct coresight_device *csdev, enum cs_mode mode,
|
||||||
void *data);
|
struct coresight_path *path);
|
||||||
int (*disable)(struct coresight_device *csdev, void *data);
|
int (*disable)(struct coresight_device *csdev,
|
||||||
|
struct coresight_path *path);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user