The connections between CoreSight sources, links and sinks is not obvious without documentation or access to the device tree / ACPI definitions for the platform.
This patchset provides sysfs links to enable the user to follow the trace patch from source to sink.
Components in the trace path are updated to have a connections sysfs group, which collates all the links for that component.
This supplements the sysfs links created for connections between CTI devices and applies on top of that work from the patchset [1].
Adaptation of an original patchset [2] from Suzuki, reusing 2 patches unchanged with update to 3rd adapt to the CTI v4 RFC set and new code to add default connections group.
Tested on DB410c 5.3-rc1, coresight/next branch.
[1] https://lists.linaro.org/pipermail/coresight/2019-August/003146.html [2] https://lists.linaro.org/pipermail/coresight/2019-May/002803.html
Mike Leach (2): coresight: Move common sysfs functions into separate file. coresight: add default connections group in sysfs to components.
Suzuki K Poulose (3): coresight: Pass coresight_device for coresight_release_platform_data coresight: add return value for fixup connections coresight: Expose device connections via sysfs
drivers/hwtracing/coresight/Makefile | 3 +- drivers/hwtracing/coresight/coresight-etm3x.c | 1 + drivers/hwtracing/coresight/coresight-etm4x.c | 1 + .../hwtracing/coresight/coresight-funnel.c | 1 + .../hwtracing/coresight/coresight-platform.c | 2 +- drivers/hwtracing/coresight/coresight-priv.h | 10 +- .../coresight/coresight-replicator.c | 1 + drivers/hwtracing/coresight/coresight-stm.c | 1 + drivers/hwtracing/coresight/coresight-sysfs.c | 232 ++++++++++++++++++ drivers/hwtracing/coresight/coresight-tmc.c | 1 + drivers/hwtracing/coresight/coresight.c | 146 ++++------- include/linux/coresight.h | 7 + 12 files changed, 306 insertions(+), 100 deletions(-) create mode 100644 drivers/hwtracing/coresight/coresight-sysfs.c
From: Suzuki K Poulose suzuki.poulose@arm.com
As we prepare to expose the links between the devices in sysfs, pass the coresight_device instance to the coresight_release_platform_data in order to free up the connections when the device is removed.
No functional changes as such in this patch.
Reviewed-by: Mathieu Poirier mathieu.poirier@linaro.org Signed-off-by: Suzuki K Poulose suzuki.poulose@arm.com --- drivers/hwtracing/coresight/coresight-platform.c | 2 +- drivers/hwtracing/coresight/coresight-priv.h | 3 ++- drivers/hwtracing/coresight/coresight.c | 7 ++++--- 3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c index 6721cb1af5fe..15024b422019 100644 --- a/drivers/hwtracing/coresight/coresight-platform.c +++ b/drivers/hwtracing/coresight/coresight-platform.c @@ -825,7 +825,7 @@ coresight_get_platform_data(struct device *dev) error: if (!IS_ERR_OR_NULL(pdata)) /* Cleanup the connection information */ - coresight_release_platform_data(pdata); + coresight_release_platform_data(NULL, pdata); return ERR_PTR(ret); } EXPORT_SYMBOL_GPL(coresight_get_platform_data); diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h index d02e9d6b80ab..fa4b02ed3900 100644 --- a/drivers/hwtracing/coresight/coresight-priv.h +++ b/drivers/hwtracing/coresight/coresight-priv.h @@ -210,6 +210,7 @@ static inline void *coresight_get_uci_data(const struct amba_id *id) return 0; }
-void coresight_release_platform_data(struct coresight_platform_data *pdata); +void coresight_release_platform_data(struct coresight_device *csdev, + struct coresight_platform_data *pdata);
#endif diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 5a07ba9e3a00..3111bfda0744 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -1295,7 +1295,8 @@ postcore_initcall(coresight_init); * coresight_release_platform_data: Release references to the devices connected * to the output port of this device. */ -void coresight_release_platform_data(struct coresight_platform_data *pdata) +void coresight_release_platform_data(struct coresight_device *csdev, + struct coresight_platform_data *pdata) { int i;
@@ -1398,7 +1399,7 @@ struct coresight_device *coresight_register(struct coresight_desc *desc) kfree(csdev); err_out: /* Cleanup the connection information */ - coresight_release_platform_data(desc->pdata); + coresight_release_platform_data(NULL, desc->pdata); return ERR_PTR(ret); } EXPORT_SYMBOL_GPL(coresight_register); @@ -1408,7 +1409,7 @@ void coresight_unregister(struct coresight_device *csdev) etm_perf_del_symlink_sink(csdev); /* Remove references of that device in the topology */ coresight_remove_conns(csdev); - coresight_release_platform_data(csdev->pdata); + coresight_release_platform_data(csdev, csdev->pdata); device_unregister(&csdev->dev); } EXPORT_SYMBOL_GPL(coresight_unregister);
From: Suzuki K Poulose suzuki.poulose@arm.com
Handle failures in fixing up connections for a newly registered device. This will be useful to handle cases where we fail to expose the links via sysfs for the connections.
Reviewed-by: Mathieu Poirier mathieu.poirier@linaro.org Signed-off-by: Suzuki K Poulose suzuki.poulose@arm.com --- drivers/hwtracing/coresight/coresight.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 3111bfda0744..efd6b2f0d4fd 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -1149,18 +1149,14 @@ static int coresight_orphan_match(struct device *dev, void *data) return 0; }
-static void coresight_fixup_orphan_conns(struct coresight_device *csdev) +static int coresight_fixup_orphan_conns(struct coresight_device *csdev) { - /* - * No need to check for a return value as orphan connection(s) - * are hooked-up with each newly added component. - */ - bus_for_each_dev(&coresight_bustype, NULL, + return bus_for_each_dev(&coresight_bustype, NULL, csdev, coresight_orphan_match); }
-static void coresight_fixup_device_conns(struct coresight_device *csdev) +static int coresight_fixup_device_conns(struct coresight_device *csdev) { int i;
@@ -1178,6 +1174,8 @@ static void coresight_fixup_device_conns(struct coresight_device *csdev) conn->child_dev = NULL; } } + + return 0; }
static int coresight_remove_match(struct device *dev, void *data) @@ -1387,11 +1385,17 @@ struct coresight_device *coresight_register(struct coresight_desc *desc)
mutex_lock(&coresight_mutex);
- coresight_fixup_device_conns(csdev); - coresight_fixup_orphan_conns(csdev); - cti_add_assoc_to_csdev(csdev); + ret = coresight_fixup_device_conns(csdev); + if (!ret) + ret = coresight_fixup_orphan_conns(csdev); + if (!ret) + cti_add_assoc_to_csdev(csdev);
mutex_unlock(&coresight_mutex); + if (ret) { + coresight_unregister(csdev); + return ERR_PTR(ret); + }
return csdev;
In preparation for adding more common sysfs & links functionality, move the existing sysfs functions into a separate common file.
Signed-off-by: Mike Leach mike.leach@linaro.org --- drivers/hwtracing/coresight/Makefile | 3 +- drivers/hwtracing/coresight/coresight-sysfs.c | 82 +++++++++++++++++++ drivers/hwtracing/coresight/coresight.c | 73 ----------------- 3 files changed, 84 insertions(+), 74 deletions(-) create mode 100644 drivers/hwtracing/coresight/coresight-sysfs.c
diff --git a/drivers/hwtracing/coresight/Makefile b/drivers/hwtracing/coresight/Makefile index 43d563705e98..43b79e538477 100644 --- a/drivers/hwtracing/coresight/Makefile +++ b/drivers/hwtracing/coresight/Makefile @@ -2,7 +2,8 @@ # # Makefile for CoreSight drivers. # -obj-$(CONFIG_CORESIGHT) += coresight.o coresight-etm-perf.o coresight-platform.o +obj-$(CONFIG_CORESIGHT) += coresight.o coresight-etm-perf.o \ + coresight-platform.o coresight-sysfs.o obj-$(CONFIG_CORESIGHT_LINK_AND_SINK_TMC) += coresight-tmc.o \ coresight-tmc-etf.o \ coresight-tmc-etr.o diff --git a/drivers/hwtracing/coresight/coresight-sysfs.c b/drivers/hwtracing/coresight/coresight-sysfs.c new file mode 100644 index 000000000000..058a092ba75f --- /dev/null +++ b/drivers/hwtracing/coresight/coresight-sysfs.c @@ -0,0 +1,82 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2019, The Linux Foundation. All rights reserved. + */ + +#include <linux/device.h> +#include <linux/kernel.h> + +#include "coresight-priv.h" + +static int coresight_create_sysfs_link(struct kobject *from, + struct kobject *to, + const char *link_name, + const char *group_name) +{ + if (group_name) + return sysfs_add_link_to_group(from, group_name, + to, link_name); + else + return sysfs_create_link(from, to, link_name); +} + +static void coresight_delete_sysfs_link(struct kobject *kobj, + const char *link_name, + const char *group_name) +{ + if (group_name) + sysfs_remove_link_from_group(kobj, group_name, link_name); + else + sysfs_remove_link(kobj, link_name); +} + +int coresight_add_sysfs_link(struct coresight_sysfs_link *info) +{ + int ret = 0; + + if (!info) + return -EINVAL; + if (!info->orig || !info->target || + !info->orig_name || !info->target_name) + return -EINVAL; + + /* first link orig->target */ + ret = coresight_create_sysfs_link(&info->orig->dev.kobj, + &info->target->dev.kobj, + info->orig_name, + info->orig->sysfs_link_grp); + if (ret) + return ret; + + /* second link target->orig */ + ret = coresight_create_sysfs_link(&info->target->dev.kobj, + &info->orig->dev.kobj, + info->target_name, + info->target->sysfs_link_grp); + + /* error in second link - remove first */ + if (ret) { + coresight_delete_sysfs_link(&info->orig->dev.kobj, + info->orig_name, + info->orig->sysfs_link_grp); + } + + return ret; +} + +void coresight_remove_sysfs_link(struct coresight_sysfs_link *info) +{ + if (!info) + return; + if (!info->orig || !info->target || + !info->orig_name || !info->target_name) + return; + + coresight_delete_sysfs_link(&info->orig->dev.kobj, + info->orig_name, + info->orig->sysfs_link_grp); + + coresight_delete_sysfs_link(&info->target->dev.kobj, + info->target_name, + info->target->sysfs_link_grp); +} diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index efd6b2f0d4fd..1e75cc7203b5 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -1032,79 +1032,6 @@ static void coresight_device_release(struct device *dev) kfree(csdev); }
-static int coresight_create_sysfs_link(struct kobject *from, - struct kobject *to, - const char *link_name, - const char *group_name) -{ - if (group_name) - return sysfs_add_link_to_group(from, group_name, - to, link_name); - else - return sysfs_create_link(from, to, link_name); -} - -static void coresight_delete_sysfs_link(struct kobject *kobj, - const char *link_name, - const char *group_name) -{ - if (group_name) - sysfs_remove_link_from_group(kobj, group_name, link_name); - else - sysfs_remove_link(kobj, link_name); -} - -int coresight_add_sysfs_link(struct coresight_sysfs_link *info) -{ - int ret = 0; - - if (!info) - return -EINVAL; - if (!info->orig || !info->target || - !info->orig_name || !info->target_name) - return -EINVAL; - - /* first link orig->target */ - ret = coresight_create_sysfs_link(&info->orig->dev.kobj, - &info->target->dev.kobj, - info->orig_name, - info->orig->sysfs_link_grp); - if (ret) - return ret; - - /* second link target->orig */ - ret = coresight_create_sysfs_link(&info->target->dev.kobj, - &info->orig->dev.kobj, - info->target_name, - info->target->sysfs_link_grp); - - /* error in second link - remove first */ - if (ret) { - coresight_delete_sysfs_link(&info->orig->dev.kobj, - info->orig_name, - info->orig->sysfs_link_grp); - } - - return ret; -} - -void coresight_remove_sysfs_link(struct coresight_sysfs_link *info) -{ - if (!info) - return; - if (!info->orig || !info->target || - !info->orig_name || !info->target_name) - return; - - coresight_delete_sysfs_link(&info->orig->dev.kobj, - info->orig_name, - info->orig->sysfs_link_grp); - - coresight_delete_sysfs_link(&info->target->dev.kobj, - info->target_name, - info->target->sysfs_link_grp); -} - static int coresight_orphan_match(struct device *dev, void *data) { int i;
From: Suzuki K Poulose suzuki.poulose@arm.com
Coresight device connections are a bit complicated and is not exposed currently to the user. One has to look at the platform descriptions (DT bindings or ACPI bindings) to make an understanding. Given the new naming scheme, it will be helpful to have this information to choose the appropriate devices for tracing. This patch exposes the device connections via links in the sysfs directories.
e.g, for a connection devA[OutputPort_X] -> devB[InputPort_Y] is represented as two symlinks:
/sys/bus/coresight/.../devA/out:X -> /sys/bus/coresight/.../devB /sys/bus/coresight/.../devB/in:Y -> /sys/bus/coresight/.../devA
Provides default connections group if requested for any CoreSight device using the coresight_connections structure.
If a connections group is present on a device then links are collated there.
Co-developed-by: Mike Leach mike.leach@linaro.org Signed-off-by: Mike Leach mike.leach@linaro.org Cc: Mathieu Poirier mathieu.poirier@linaro.org Signed-off-by: Suzuki K Poulose suzuki.poulose@arm.com --- drivers/hwtracing/coresight/coresight-priv.h | 7 + drivers/hwtracing/coresight/coresight-sysfs.c | 150 ++++++++++++++++++ drivers/hwtracing/coresight/coresight.c | 42 +++-- include/linux/coresight.h | 7 + 4 files changed, 195 insertions(+), 11 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h index fa4b02ed3900..120928db426a 100644 --- a/drivers/hwtracing/coresight/coresight-priv.h +++ b/drivers/hwtracing/coresight/coresight-priv.h @@ -155,6 +155,13 @@ struct list_head *coresight_build_path(struct coresight_device *csdev, void coresight_release_path(struct list_head *path); int coresight_add_sysfs_link(struct coresight_sysfs_link *info); void coresight_remove_sysfs_link(struct coresight_sysfs_link *info); +int coresight_make_links(struct coresight_device *orig, + struct coresight_connection *conn, + struct coresight_device *target); +void coresight_remove_links(struct coresight_device *orig, + struct coresight_connection *conn); +int coresight_create_conns_sysfs_group(struct coresight_device *csdev); +void coresight_remove_conns_sysfs_group(struct coresight_device *csdev);
#ifdef CONFIG_CORESIGHT_SOURCE_ETM3X extern int etm_readl_cp14(u32 off, unsigned int *val); diff --git a/drivers/hwtracing/coresight/coresight-sysfs.c b/drivers/hwtracing/coresight/coresight-sysfs.c index 058a092ba75f..f2ece44e2158 100644 --- a/drivers/hwtracing/coresight/coresight-sysfs.c +++ b/drivers/hwtracing/coresight/coresight-sysfs.c @@ -80,3 +80,153 @@ void coresight_remove_sysfs_link(struct coresight_sysfs_link *info) info->target_name, info->target->sysfs_link_grp); } + +/* + * coresight_make_links: Make a link for a connection from a @orig + * device to @target, represented by @conn. + * + * e.g, for devOrig[output_X] -> devTarget[input_Y] is represented + * as two symbolic links : + * + * /sys/.../devOrig/out:X -> /sys/.../devTarget/ + * /sys/.../devTarget/in:Y -> /sys/.../devOrig/ + * + * The link names are allocated for a device where it appears. i.e, the + * "out" link on the master and "in" link on the slave device. + * The link info is stored in the connection record for avoiding + * the reconstruction of names for removal. + */ +int coresight_make_links(struct coresight_device *orig, + struct coresight_connection *conn, + struct coresight_device *target) +{ + int ret = -ENOMEM; + char *outs = NULL, *ins = NULL; + struct coresight_sysfs_link *link = NULL; + + do { + outs = devm_kasprintf(&orig->dev, GFP_KERNEL, + "out:%d", conn->outport); + if (!outs) + break; + ins = devm_kasprintf(&target->dev, GFP_KERNEL, + "in:%d", conn->child_port); + if (!ins) + break; + link = devm_kzalloc(&orig->dev, + sizeof(struct coresight_sysfs_link), + GFP_KERNEL); + if (!link) + break; + + link->orig = orig; + link->target = target; + link->orig_name = outs; + link->target_name = ins; + + ret = coresight_add_sysfs_link(link); + if (ret) + break; + + conn->link = link; + + /* + * Install the device connection. This also indicates that + * the links are operational on both ends. + */ + conn->child_dev = target; + return 0; + } while (0); + + if (outs) + devm_kfree(&orig->dev, outs); + if (ins) + devm_kfree(&target->dev, ins); + if (link) + devm_kfree(&orig->dev, link); + return ret; +} + +/* + * coresight_remove_links: Remove the sysfs links for a given connection @conn, + * from @orig device to @target device. See coresight_make_links() for more + * details. + */ +void coresight_remove_links(struct coresight_device *orig, + struct coresight_connection *conn) +{ + if (!orig || !conn->link) + return; + + coresight_remove_sysfs_link(conn->link); + + devm_kfree(&conn->child_dev->dev, conn->link->target_name); + devm_kfree(&orig->dev, conn->link->orig_name); + devm_kfree(&orig->dev, conn->link); + conn->link = NULL; + conn->child_dev = NULL; +} + +static ssize_t nr_outports_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct coresight_device *csdev = to_coresight_device(dev); + + return scnprintf(buf, PAGE_SIZE, "%d\n", csdev->pdata->nr_outport); +} +static DEVICE_ATTR_RO(nr_outports); + +static ssize_t nr_inports_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct coresight_device *csdev = to_coresight_device(dev); + + return scnprintf(buf, PAGE_SIZE, "%d\n", csdev->pdata->nr_inport); +} +static DEVICE_ATTR_RO(nr_inports); + +static struct attribute *coresight_conns_attrs[] = { + &dev_attr_nr_outports.attr, + &dev_attr_nr_inports.attr, + NULL, +}; + +static struct attribute_group coresight_conns_group = { + .attrs = coresight_conns_attrs, + .name = "connections", +}; + +/* + * Create connections group for CoreSight devices on the trace path + * which use inports and outports to represent connections. + * This group will then be used to collate the sysfs links between + * devices. + */ +int coresight_create_conns_sysfs_group(struct coresight_device *csdev) +{ + int ret = 0; + + if (!csdev) + return -EINVAL; + + ret = sysfs_create_group(&csdev->dev.kobj, &coresight_conns_group); + if (ret) + return ret; + + csdev->sysfs_link_grp = coresight_conns_group.name; + csdev->default_conns_grp = true; + return ret; +} + +void coresight_remove_conns_sysfs_group(struct coresight_device *csdev) +{ + if (!csdev) + return; + + if (csdev->sysfs_link_grp && csdev->default_conns_grp) { + sysfs_remove_group(&csdev->dev.kobj, &coresight_conns_group); + csdev->sysfs_link_grp = NULL; + } +} diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 1e75cc7203b5..e6e1850a6e96 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -1034,7 +1034,7 @@ static void coresight_device_release(struct device *dev)
static int coresight_orphan_match(struct device *dev, void *data) { - int i; + int i, ret = 0; bool still_orphan = false; struct coresight_device *csdev, *i_csdev; struct coresight_connection *conn; @@ -1059,19 +1059,23 @@ static int coresight_orphan_match(struct device *dev, void *data) /* We have found at least one orphan connection */ if (conn->child_dev == NULL) { /* Does it match this newly added device? */ - if (conn->child_fwnode == csdev->dev.fwnode) - conn->child_dev = csdev; - else + if (conn->child_fwnode == csdev->dev.fwnode) { + ret = coresight_make_links(i_csdev, + conn, csdev); + if (ret) + return ret; + } else { /* This component still has an orphan */ still_orphan = true; + } } }
i_csdev->orphan = still_orphan;
/* - * Returning '0' ensures that all known component on the - * bus will be checked. + * Returning '0' in case we didn't encounter any error, + * ensures that all known component on the bus will be checked. */ return 0; } @@ -1085,7 +1089,7 @@ static int coresight_fixup_orphan_conns(struct coresight_device *csdev)
static int coresight_fixup_device_conns(struct coresight_device *csdev) { - int i; + int i, ret = 0;
for (i = 0; i < csdev->pdata->nr_outport; i++) { struct coresight_connection *conn = &csdev->pdata->conns[i]; @@ -1093,9 +1097,12 @@ static int coresight_fixup_device_conns(struct coresight_device *csdev)
dev = bus_find_device_by_fwnode(&coresight_bustype, conn->child_fwnode); if (dev) { - conn->child_dev = to_coresight_device(dev); + ret = coresight_make_links(csdev, conn, + to_coresight_device(dev)); /* and put reference from 'bus_find_device()' */ put_device(dev); + if (ret) + break; } else { csdev->orphan = true; conn->child_dev = NULL; @@ -1130,7 +1137,7 @@ static int coresight_remove_match(struct device *dev, void *data)
if (csdev->dev.fwnode == conn->child_fwnode) { iterator->orphan = true; - conn->child_dev = NULL; + coresight_remove_links(iterator, conn); /* * Drop the reference to the handle for the remote * device acquired in parsing the connections from @@ -1224,13 +1231,23 @@ void coresight_release_platform_data(struct coresight_device *csdev, struct coresight_platform_data *pdata) { int i; + struct coresight_connection *conns = pdata->conns;
for (i = 0; i < pdata->nr_outport; i++) { - if (pdata->conns[i].child_fwnode) { - fwnode_handle_put(pdata->conns[i].child_fwnode); + /* If we have made the links, remove them now */ + if (csdev && conns[i].child_dev) + coresight_remove_links(csdev, &conns[i]); + /* + * Drop the refcount and clear the handle as this device + * is going away + */ + if (conns[i].child_fwnode) { + fwnode_handle_put(conns[i].child_fwnode); pdata->conns[i].child_fwnode = NULL; } } + if (csdev) + coresight_remove_conns_sysfs_group(csdev); }
struct coresight_device *coresight_register(struct coresight_desc *desc) @@ -1312,6 +1329,9 @@ struct coresight_device *coresight_register(struct coresight_desc *desc)
mutex_lock(&coresight_mutex);
+ if (desc->add_conns_group) + ret = coresight_create_conns_sysfs_group(csdev); + ret = coresight_fixup_device_conns(csdev); if (!ret) ret = coresight_fixup_orphan_conns(csdev); diff --git a/include/linux/coresight.h b/include/linux/coresight.h index cd0d92611be6..95634d4ce7ff 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -122,6 +122,8 @@ struct coresight_platform_data { * @groups: operations specific to this component. These will end up * in the component's sysfs sub-directory. * @name: name for the coresight device, also shown under sysfs. + * @add_conns_group: Dynamically add default connections group to the supplied + * groups. */ struct coresight_desc { enum coresight_dev_type type; @@ -131,6 +133,7 @@ struct coresight_desc { struct device *dev; const struct attribute_group **groups; const char *name; + bool add_conns_group; };
/** @@ -140,12 +143,14 @@ struct coresight_desc { * @chid_fwnode: remote component's fwnode handle. * @child_dev: a @coresight_device representation of the component connected to @outport. + * @link: Representation of the connection as a sysfs link. */ struct coresight_connection { int outport; int child_port; struct fwnode_handle *child_fwnode; struct coresight_device *child_dev; + struct coresight_sysfs_link *link; };
/** @@ -182,6 +187,7 @@ struct coresight_sysfs_link { * @sysfs_link_grp: Optional name for a group created to add sysfs links into * on this device. Group must have been created on device * registration. + * @default_conns_grp: Added a default connections group. */ struct coresight_device { struct coresight_platform_data *pdata; @@ -198,6 +204,7 @@ struct coresight_device { /* cross trigger handling */ struct coresight_device *ect_dev; const char *sysfs_link_grp; + bool default_conns_grp; };
/*
Add the default connections group in sysfs to etm4x, etm3x, stm, tmc, funnel and replicator components.
This group will be used to collate the sysfs links representing the trace data path to and from the devices.
Signed-off-by: Mike Leach mike.leach@linaro.org --- drivers/hwtracing/coresight/coresight-etm3x.c | 1 + drivers/hwtracing/coresight/coresight-etm4x.c | 1 + drivers/hwtracing/coresight/coresight-funnel.c | 1 + drivers/hwtracing/coresight/coresight-replicator.c | 1 + drivers/hwtracing/coresight/coresight-stm.c | 1 + drivers/hwtracing/coresight/coresight-tmc.c | 1 + 6 files changed, 6 insertions(+)
diff --git a/drivers/hwtracing/coresight/coresight-etm3x.c b/drivers/hwtracing/coresight/coresight-etm3x.c index e2cb6873c3f2..aa017ed1e2fe 100644 --- a/drivers/hwtracing/coresight/coresight-etm3x.c +++ b/drivers/hwtracing/coresight/coresight-etm3x.c @@ -864,6 +864,7 @@ static int etm_probe(struct amba_device *adev, const struct amba_id *id) desc.pdata = pdata; desc.dev = dev; desc.groups = coresight_etm_groups; + desc.add_conns_group = true; drvdata->csdev = coresight_register(&desc); if (IS_ERR(drvdata->csdev)) { ret = PTR_ERR(drvdata->csdev); diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c index a128b5063f46..7d94096191c3 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.c +++ b/drivers/hwtracing/coresight/coresight-etm4x.c @@ -1160,6 +1160,7 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id) desc.pdata = pdata; desc.dev = dev; desc.groups = coresight_etmv4_groups; + desc.add_conns_group = true; drvdata->csdev = coresight_register(&desc); if (IS_ERR(drvdata->csdev)) { ret = PTR_ERR(drvdata->csdev); diff --git a/drivers/hwtracing/coresight/coresight-funnel.c b/drivers/hwtracing/coresight/coresight-funnel.c index 05f7896c3a01..9cdbfb75a246 100644 --- a/drivers/hwtracing/coresight/coresight-funnel.c +++ b/drivers/hwtracing/coresight/coresight-funnel.c @@ -238,6 +238,7 @@ static int funnel_probe(struct device *dev, struct resource *res) desc.ops = &funnel_cs_ops; desc.pdata = pdata; desc.dev = dev; + desc.add_conns_group = true; drvdata->csdev = coresight_register(&desc); if (IS_ERR(drvdata->csdev)) { ret = PTR_ERR(drvdata->csdev); diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c index b29ba640eb25..eac2690c0fda 100644 --- a/drivers/hwtracing/coresight/coresight-replicator.c +++ b/drivers/hwtracing/coresight/coresight-replicator.c @@ -230,6 +230,7 @@ static int replicator_probe(struct device *dev, struct resource *res) desc.ops = &replicator_cs_ops; desc.pdata = dev->platform_data; desc.dev = dev; + desc.add_conns_group = true;
drvdata->csdev = coresight_register(&desc); if (IS_ERR(drvdata->csdev)) { diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c index b908ca104645..5a7c7b43d48c 100644 --- a/drivers/hwtracing/coresight/coresight-stm.c +++ b/drivers/hwtracing/coresight/coresight-stm.c @@ -933,6 +933,7 @@ static int stm_probe(struct amba_device *adev, const struct amba_id *id) desc.pdata = pdata; desc.dev = dev; desc.groups = coresight_stm_groups; + desc.add_conns_group = true; drvdata->csdev = coresight_register(&desc); if (IS_ERR(drvdata->csdev)) { ret = PTR_ERR(drvdata->csdev); diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c index 3055bf8e2236..b74f32253951 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.c +++ b/drivers/hwtracing/coresight/coresight-tmc.c @@ -491,6 +491,7 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) } adev->dev.platform_data = pdata; desc.pdata = pdata; + desc.add_conns_group = true;
drvdata->csdev = coresight_register(&desc); if (IS_ERR(drvdata->csdev)) {