On Mon, 25 Mar 2019 at 05:44, Suzuki K Poulose suzuki.poulose@arm.com wrote:
Hi Mathieu,
On 06/03/2019 22:57, Mathieu Poirier wrote:
When working with CPU-wide scenarios and the HW enacts an N:1 source/sink topology the sink is shared between source and needs to use double buffering. As such introduce a new function to easily determine if a sink is shared by multiple source.
Signed-off-by: Mathieu Poirier mathieu.poirier@linaro.org
drivers/hwtracing/coresight/coresight-priv.h | 1 + drivers/hwtracing/coresight/coresight.c | 25 ++++++++++++++++++++ 2 files changed, 26 insertions(+)
diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h index e0684d06e9ee..5d7213561e94 100644 --- a/drivers/hwtracing/coresight/coresight-priv.h +++ b/drivers/hwtracing/coresight/coresight-priv.h @@ -146,6 +146,7 @@ static inline void coresight_write_reg_pair(void __iomem *addr, u64 val,
void coresight_disable_path(struct list_head *path); int coresight_enable_path(struct list_head *path, u32 mode, void *sink_data); +int coresight_sink_is_shared(struct list_head *path); struct coresight_device *coresight_get_sink(struct list_head *path); struct coresight_device *coresight_get_enabled_sink(bool reset); struct coresight_device *coresight_get_sink_by_id(u32 id); diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index 19ba121d7451..d74b2f621885 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -483,6 +483,31 @@ int coresight_enable_path(struct list_head *path, u32 mode, void *sink_data) goto out; }
+int coresight_sink_is_shared(struct list_head *path) +{
enum coresight_dev_type type;
enum coresight_dev_subtype_link subtype;
struct coresight_node *nd;
struct coresight_device *csdev;
if (!path)
return -EINVAL;
/* Go through each of the entries in the path */
list_for_each_entry(nd, path, link) {
csdev = nd->csdev;
type = csdev->type;
subtype = csdev->subtype.link_subtype;
/* If we find a funnel the sink is shared */
if (type == CORESIGHT_DEV_TYPE_LINK &&
subtype == CORESIGHT_DEV_SUBTYPE_LINK_MERG)
return 1;
One caveat with this logic is that, we have systems where a funnel appears in the path, whose input ports are not connected, implying they may not be shared after all (e.g, imx7s in arm32). It may be a good idea to add (csdev->nr_inport > 1) check to the list, if we figure out that it is a funnel.
You are 100% right.
Otherwise, looks good to me.
Suzuki