Loading drivers/hwtracing/coresight/coresight-hwevent.c +3 −6 Original line number Diff line number Diff line /* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved. /* Copyright (c) 2013-2019, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -200,9 +200,8 @@ static int hwevent_probe(struct platform_device *pdev) drvdata->nr_hmux = of_property_count_strings(pdev->dev.of_node, "reg-names"); if (!drvdata->nr_hmux) return -ENODEV; if (drvdata->nr_hmux < 0) drvdata->nr_hmux = 0; if (drvdata->nr_hmux > 0) { drvdata->hmux = devm_kzalloc(dev, drvdata->nr_hmux * Loading @@ -223,8 +222,6 @@ static int hwevent_probe(struct platform_device *pdev) drvdata->hmux[i].start = res->start; drvdata->hmux[i].end = res->end; } } else { return drvdata->nr_hmux; } mutex_init(&drvdata->mutex); Loading drivers/hwtracing/coresight/coresight.c +55 −13 Original line number Diff line number Diff line Loading @@ -29,6 +29,9 @@ #include "coresight-priv.h" static int coresight_source_filter(struct list_head *path, struct coresight_connection *conn); static DEFINE_MUTEX(coresight_mutex); static struct coresight_device *curr_sink; /** Loading Loading @@ -165,13 +168,16 @@ void coresight_disable_reg_clk(struct coresight_device *csdev) EXPORT_SYMBOL(coresight_disable_reg_clk); static int coresight_find_link_inport(struct coresight_device *csdev, struct coresight_device *parent) struct coresight_device *parent, struct list_head *path) { int i; struct coresight_connection *conn; for (i = 0; i < parent->nr_outport; i++) { conn = &parent->conns[i]; if (coresight_source_filter(path, conn)) continue; if (conn->child_dev == csdev) return conn->child_port; } Loading @@ -183,13 +189,16 @@ static int coresight_find_link_inport(struct coresight_device *csdev, } static int coresight_find_link_outport(struct coresight_device *csdev, struct coresight_device *child) struct coresight_device *child, struct list_head *path) { int i; struct coresight_connection *conn; for (i = 0; i < csdev->nr_outport; i++) { conn = &csdev->conns[i]; if (coresight_source_filter(path, conn)) continue; if (conn->child_dev == child) return conn->outport; } Loading Loading @@ -235,7 +244,8 @@ static void coresight_disable_sink(struct coresight_device *csdev) static int coresight_enable_link(struct coresight_device *csdev, struct coresight_device *parent, struct coresight_device *child) struct coresight_device *child, struct list_head *path) { int ret; int link_subtype; Loading @@ -244,8 +254,8 @@ static int coresight_enable_link(struct coresight_device *csdev, if (!parent || !child) return -EINVAL; inport = coresight_find_link_inport(csdev, parent); outport = coresight_find_link_outport(csdev, child); inport = coresight_find_link_inport(csdev, parent, path); outport = coresight_find_link_outport(csdev, child, path); link_subtype = csdev->subtype.link_subtype; if (link_subtype == CORESIGHT_DEV_SUBTYPE_LINK_MERG) Loading Loading @@ -277,7 +287,8 @@ static int coresight_enable_link(struct coresight_device *csdev, static void coresight_disable_link(struct coresight_device *csdev, struct coresight_device *parent, struct coresight_device *child) struct coresight_device *child, struct list_head *path) { int i, nr_conns; int link_subtype; Loading @@ -286,8 +297,8 @@ static void coresight_disable_link(struct coresight_device *csdev, if (!parent || !child) return; inport = coresight_find_link_inport(csdev, parent); outport = coresight_find_link_outport(csdev, child); inport = coresight_find_link_inport(csdev, parent, path); outport = coresight_find_link_outport(csdev, child, path); link_subtype = csdev->subtype.link_subtype; if (link_subtype == CORESIGHT_DEV_SUBTYPE_LINK_MERG) { Loading Loading @@ -392,7 +403,7 @@ static void coresigh_disable_list_node(struct list_head *path, case CORESIGHT_DEV_TYPE_LINK: parent = list_prev_entry(nd, link)->csdev; child = list_next_entry(nd, link)->csdev; coresight_disable_link(csdev, parent, child); coresight_disable_link(csdev, parent, child, path); break; default: break; Loading Loading @@ -460,7 +471,7 @@ int coresight_enable_path(struct list_head *path, u32 mode) case CORESIGHT_DEV_TYPE_LINK: parent = list_prev_entry(nd, link)->csdev; child = list_next_entry(nd, link)->csdev; ret = coresight_enable_link(csdev, parent, child); ret = coresight_enable_link(csdev, parent, child, path); if (ret) goto err; break; Loading Loading @@ -551,6 +562,31 @@ struct coresight_device *coresight_get_enabled_sink(bool deactivate) return dev ? to_coresight_device(dev) : NULL; } /** * coresight_source_filter - checks whether the connection matches the source * of path if connection is binded to specific source. * @path: The list of devices * @conn: The connection of one outport * * Return zero if the connection doesn't have a source binded or source of the * path matches the source binds to connection. */ static int coresight_source_filter(struct list_head *path, struct coresight_connection *conn) { int ret = 0; struct coresight_device *source = NULL; if (conn->source_name == NULL) return ret; source = coresight_get_source(path); if (source == NULL) return ret; return strcmp(conn->source_name, dev_name(&source->dev)); } /** * _coresight_build_path - recursively build a path from a @csdev to a sink. * @csdev: The device to start from. Loading @@ -564,7 +600,8 @@ struct coresight_device *coresight_get_enabled_sink(bool deactivate) */ static int _coresight_build_path(struct coresight_device *csdev, struct coresight_device *sink, struct list_head *path) struct list_head *path, struct coresight_device *source) { int i; bool found = false; Loading @@ -577,9 +614,13 @@ static int _coresight_build_path(struct coresight_device *csdev, /* Not a sink - recursively explore each port found on this element */ for (i = 0; i < csdev->nr_outport; i++) { struct coresight_device *child_dev = csdev->conns[i].child_dev; if (csdev->conns[i].source_name && strcmp(csdev->conns[i].source_name, dev_name(&source->dev))) continue; if (child_dev && _coresight_build_path(child_dev, sink, path) == 0) { _coresight_build_path(child_dev, sink, path, source) == 0) { found = true; break; } Loading Loading @@ -621,7 +662,7 @@ struct list_head *coresight_build_path(struct coresight_device *source, INIT_LIST_HEAD(path); rc = _coresight_build_path(source, sink, path); rc = _coresight_build_path(source, sink, path, source); if (rc) { kfree(path); return ERR_PTR(rc); Loading Loading @@ -1202,6 +1243,7 @@ struct coresight_device *coresight_register(struct coresight_desc *desc) conns[i].outport = desc->pdata->outports[i]; conns[i].child_name = desc->pdata->child_names[i]; conns[i].child_port = desc->pdata->child_ports[i]; conns[i].source_name = desc->pdata->source_names[i]; } } Loading drivers/hwtracing/coresight/of_coresight.c +17 −1 Original line number Diff line number Diff line /* Copyright (c) 2012, 2017-2018 The Linux Foundation. All rights reserved. /* Copyright (c) 2012, 2017-2019 The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -84,6 +84,12 @@ static int of_coresight_alloc_memory(struct device *dev, if (!pdata->outports) return -ENOMEM; pdata->source_names = devm_kzalloc(dev, pdata->nr_outport * sizeof(*pdata->source_names), GFP_KERNEL); if (!pdata->source_names) return -ENOMEM; /* Children connected to this component via @outports */ pdata->child_names = devm_kzalloc(dev, pdata->nr_outport * sizeof(*pdata->child_names), Loading Loading @@ -181,6 +187,7 @@ of_get_coresight_platform_data(struct device *dev, struct device_node *ep = NULL; struct device_node *rparent = NULL; struct device_node *rport = NULL; struct device_node *sn = NULL; pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); if (!pdata) Loading Loading @@ -245,6 +252,15 @@ of_get_coresight_platform_data(struct device *dev, pdata->child_names[i] = dev_name(rdev); pdata->child_ports[i] = rendpoint.id; pdata->source_names[i] = NULL; sn = of_parse_phandle(ep, "source", 0); if (sn) { ret = of_property_read_string(sn, "coresight-name", &pdata->source_names[i]); of_node_put(sn); } i++; } while (ep); } Loading include/linux/coresight.h +4 −0 Original line number Diff line number Diff line Loading @@ -104,6 +104,7 @@ struct coresight_reg_clk { * @name: name of the component as shown under sysfs. * @nr_inport: number of input ports for this component. * @outports: list of remote endpoint port number. * @source_names:name of all source components connected to this device. * @child_names:name of all child components connected to this device. * @child_ports:child component port number the current component is connected to. Loading @@ -116,6 +117,7 @@ struct coresight_platform_data { const char *name; int nr_inport; int *outports; const char **source_names; const char **child_names; int *child_ports; int nr_outport; Loading Loading @@ -146,6 +148,7 @@ struct coresight_desc { /** * struct coresight_connection - representation of a single connection * @outport: a connection's output port number. * @source_name:source component's name. * @chid_name: remote component's name. * @child_port: remote component's port number @output is connected to. * @child_dev: a @coresight_device representation of the component Loading @@ -153,6 +156,7 @@ struct coresight_desc { */ struct coresight_connection { int outport; const char *source_name; const char *child_name; int child_port; struct coresight_device *child_dev; Loading Loading
drivers/hwtracing/coresight/coresight-hwevent.c +3 −6 Original line number Diff line number Diff line /* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved. /* Copyright (c) 2013-2019, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -200,9 +200,8 @@ static int hwevent_probe(struct platform_device *pdev) drvdata->nr_hmux = of_property_count_strings(pdev->dev.of_node, "reg-names"); if (!drvdata->nr_hmux) return -ENODEV; if (drvdata->nr_hmux < 0) drvdata->nr_hmux = 0; if (drvdata->nr_hmux > 0) { drvdata->hmux = devm_kzalloc(dev, drvdata->nr_hmux * Loading @@ -223,8 +222,6 @@ static int hwevent_probe(struct platform_device *pdev) drvdata->hmux[i].start = res->start; drvdata->hmux[i].end = res->end; } } else { return drvdata->nr_hmux; } mutex_init(&drvdata->mutex); Loading
drivers/hwtracing/coresight/coresight.c +55 −13 Original line number Diff line number Diff line Loading @@ -29,6 +29,9 @@ #include "coresight-priv.h" static int coresight_source_filter(struct list_head *path, struct coresight_connection *conn); static DEFINE_MUTEX(coresight_mutex); static struct coresight_device *curr_sink; /** Loading Loading @@ -165,13 +168,16 @@ void coresight_disable_reg_clk(struct coresight_device *csdev) EXPORT_SYMBOL(coresight_disable_reg_clk); static int coresight_find_link_inport(struct coresight_device *csdev, struct coresight_device *parent) struct coresight_device *parent, struct list_head *path) { int i; struct coresight_connection *conn; for (i = 0; i < parent->nr_outport; i++) { conn = &parent->conns[i]; if (coresight_source_filter(path, conn)) continue; if (conn->child_dev == csdev) return conn->child_port; } Loading @@ -183,13 +189,16 @@ static int coresight_find_link_inport(struct coresight_device *csdev, } static int coresight_find_link_outport(struct coresight_device *csdev, struct coresight_device *child) struct coresight_device *child, struct list_head *path) { int i; struct coresight_connection *conn; for (i = 0; i < csdev->nr_outport; i++) { conn = &csdev->conns[i]; if (coresight_source_filter(path, conn)) continue; if (conn->child_dev == child) return conn->outport; } Loading Loading @@ -235,7 +244,8 @@ static void coresight_disable_sink(struct coresight_device *csdev) static int coresight_enable_link(struct coresight_device *csdev, struct coresight_device *parent, struct coresight_device *child) struct coresight_device *child, struct list_head *path) { int ret; int link_subtype; Loading @@ -244,8 +254,8 @@ static int coresight_enable_link(struct coresight_device *csdev, if (!parent || !child) return -EINVAL; inport = coresight_find_link_inport(csdev, parent); outport = coresight_find_link_outport(csdev, child); inport = coresight_find_link_inport(csdev, parent, path); outport = coresight_find_link_outport(csdev, child, path); link_subtype = csdev->subtype.link_subtype; if (link_subtype == CORESIGHT_DEV_SUBTYPE_LINK_MERG) Loading Loading @@ -277,7 +287,8 @@ static int coresight_enable_link(struct coresight_device *csdev, static void coresight_disable_link(struct coresight_device *csdev, struct coresight_device *parent, struct coresight_device *child) struct coresight_device *child, struct list_head *path) { int i, nr_conns; int link_subtype; Loading @@ -286,8 +297,8 @@ static void coresight_disable_link(struct coresight_device *csdev, if (!parent || !child) return; inport = coresight_find_link_inport(csdev, parent); outport = coresight_find_link_outport(csdev, child); inport = coresight_find_link_inport(csdev, parent, path); outport = coresight_find_link_outport(csdev, child, path); link_subtype = csdev->subtype.link_subtype; if (link_subtype == CORESIGHT_DEV_SUBTYPE_LINK_MERG) { Loading Loading @@ -392,7 +403,7 @@ static void coresigh_disable_list_node(struct list_head *path, case CORESIGHT_DEV_TYPE_LINK: parent = list_prev_entry(nd, link)->csdev; child = list_next_entry(nd, link)->csdev; coresight_disable_link(csdev, parent, child); coresight_disable_link(csdev, parent, child, path); break; default: break; Loading Loading @@ -460,7 +471,7 @@ int coresight_enable_path(struct list_head *path, u32 mode) case CORESIGHT_DEV_TYPE_LINK: parent = list_prev_entry(nd, link)->csdev; child = list_next_entry(nd, link)->csdev; ret = coresight_enable_link(csdev, parent, child); ret = coresight_enable_link(csdev, parent, child, path); if (ret) goto err; break; Loading Loading @@ -551,6 +562,31 @@ struct coresight_device *coresight_get_enabled_sink(bool deactivate) return dev ? to_coresight_device(dev) : NULL; } /** * coresight_source_filter - checks whether the connection matches the source * of path if connection is binded to specific source. * @path: The list of devices * @conn: The connection of one outport * * Return zero if the connection doesn't have a source binded or source of the * path matches the source binds to connection. */ static int coresight_source_filter(struct list_head *path, struct coresight_connection *conn) { int ret = 0; struct coresight_device *source = NULL; if (conn->source_name == NULL) return ret; source = coresight_get_source(path); if (source == NULL) return ret; return strcmp(conn->source_name, dev_name(&source->dev)); } /** * _coresight_build_path - recursively build a path from a @csdev to a sink. * @csdev: The device to start from. Loading @@ -564,7 +600,8 @@ struct coresight_device *coresight_get_enabled_sink(bool deactivate) */ static int _coresight_build_path(struct coresight_device *csdev, struct coresight_device *sink, struct list_head *path) struct list_head *path, struct coresight_device *source) { int i; bool found = false; Loading @@ -577,9 +614,13 @@ static int _coresight_build_path(struct coresight_device *csdev, /* Not a sink - recursively explore each port found on this element */ for (i = 0; i < csdev->nr_outport; i++) { struct coresight_device *child_dev = csdev->conns[i].child_dev; if (csdev->conns[i].source_name && strcmp(csdev->conns[i].source_name, dev_name(&source->dev))) continue; if (child_dev && _coresight_build_path(child_dev, sink, path) == 0) { _coresight_build_path(child_dev, sink, path, source) == 0) { found = true; break; } Loading Loading @@ -621,7 +662,7 @@ struct list_head *coresight_build_path(struct coresight_device *source, INIT_LIST_HEAD(path); rc = _coresight_build_path(source, sink, path); rc = _coresight_build_path(source, sink, path, source); if (rc) { kfree(path); return ERR_PTR(rc); Loading Loading @@ -1202,6 +1243,7 @@ struct coresight_device *coresight_register(struct coresight_desc *desc) conns[i].outport = desc->pdata->outports[i]; conns[i].child_name = desc->pdata->child_names[i]; conns[i].child_port = desc->pdata->child_ports[i]; conns[i].source_name = desc->pdata->source_names[i]; } } Loading
drivers/hwtracing/coresight/of_coresight.c +17 −1 Original line number Diff line number Diff line /* Copyright (c) 2012, 2017-2018 The Linux Foundation. All rights reserved. /* Copyright (c) 2012, 2017-2019 The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -84,6 +84,12 @@ static int of_coresight_alloc_memory(struct device *dev, if (!pdata->outports) return -ENOMEM; pdata->source_names = devm_kzalloc(dev, pdata->nr_outport * sizeof(*pdata->source_names), GFP_KERNEL); if (!pdata->source_names) return -ENOMEM; /* Children connected to this component via @outports */ pdata->child_names = devm_kzalloc(dev, pdata->nr_outport * sizeof(*pdata->child_names), Loading Loading @@ -181,6 +187,7 @@ of_get_coresight_platform_data(struct device *dev, struct device_node *ep = NULL; struct device_node *rparent = NULL; struct device_node *rport = NULL; struct device_node *sn = NULL; pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); if (!pdata) Loading Loading @@ -245,6 +252,15 @@ of_get_coresight_platform_data(struct device *dev, pdata->child_names[i] = dev_name(rdev); pdata->child_ports[i] = rendpoint.id; pdata->source_names[i] = NULL; sn = of_parse_phandle(ep, "source", 0); if (sn) { ret = of_property_read_string(sn, "coresight-name", &pdata->source_names[i]); of_node_put(sn); } i++; } while (ep); } Loading
include/linux/coresight.h +4 −0 Original line number Diff line number Diff line Loading @@ -104,6 +104,7 @@ struct coresight_reg_clk { * @name: name of the component as shown under sysfs. * @nr_inport: number of input ports for this component. * @outports: list of remote endpoint port number. * @source_names:name of all source components connected to this device. * @child_names:name of all child components connected to this device. * @child_ports:child component port number the current component is connected to. Loading @@ -116,6 +117,7 @@ struct coresight_platform_data { const char *name; int nr_inport; int *outports; const char **source_names; const char **child_names; int *child_ports; int nr_outport; Loading Loading @@ -146,6 +148,7 @@ struct coresight_desc { /** * struct coresight_connection - representation of a single connection * @outport: a connection's output port number. * @source_name:source component's name. * @chid_name: remote component's name. * @child_port: remote component's port number @output is connected to. * @child_dev: a @coresight_device representation of the component Loading @@ -153,6 +156,7 @@ struct coresight_desc { */ struct coresight_connection { int outport; const char *source_name; const char *child_name; int child_port; struct coresight_device *child_dev; Loading