This patch makes the ETR component aware of the topology the HW is enacting so that it can make choices about the memory mode to use when working in CPU-wide scenarios.
Signed-off-by: Mathieu Poirier mathieu.poirier@linaro.org --- .../hwtracing/coresight/coresight-tmc-etr.c | 19 +++++++++++++++++++ drivers/hwtracing/coresight/coresight-tmc.c | 2 ++ drivers/hwtracing/coresight/coresight-tmc.h | 2 ++ 3 files changed, 23 insertions(+)
diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index d8c71d22bdef..eace816ff042 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1276,6 +1276,22 @@ tmc_etr_setup_perf_buf(struct tmc_drvdata *drvdata, int node, pid_t pid, return etr_perf; }
+static int tmc_etr_is_shared(struct tmc_drvdata *drvdata, + struct list_head *path) +{ + int shared; + + /* The HW topology is static, no need to check this twice */ + if (drvdata->shared >= 0) + return 0; + + shared = coresight_sink_is_shared(path); + if (shared == -EINVAL) + return shared; + + drvdata->shared = shared; + return 0; +}
static void *tmc_alloc_etr_buffer(struct list_head *path, int cpu, pid_t pid, void **pages, int nr_pages, @@ -1291,6 +1307,9 @@ static void *tmc_alloc_etr_buffer(struct list_head *path, int cpu,
drvdata = dev_get_drvdata(csdev->dev.parent);
+ if (tmc_etr_is_shared(drvdata, path)) + return NULL; + if (cpu == -1) cpu = smp_processor_id();
diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c index b01e587f376d..13603249506c 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.c +++ b/drivers/hwtracing/coresight/coresight-tmc.c @@ -417,6 +417,8 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) drvdata->memwidth = tmc_get_memwidth(devid); /* This device is not associated with a session */ drvdata->pid = -1; + /* No way to know what kind of topology we have */ + drvdata->shared = -1;
if (drvdata->config_type == TMC_CONFIG_TYPE_ETR) { if (np) diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracing/coresight/coresight-tmc.h index 1726d77e6d7f..5373e5c7556e 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h @@ -178,6 +178,7 @@ struct etr_buf { * @trigger_cntr: amount of words to store after a trigger. * @etr_caps: Bitmask of capabilities of the TMC ETR, inferred from the * device configuration register (DEVID) + * @shared: This TMC is in an N:1 source/sink topology. * @perf_data: PERF buffer for ETR. * @sysfs_data: SYSFS buffer for ETR. */ @@ -200,6 +201,7 @@ struct tmc_drvdata { enum tmc_mem_intf_width memwidth; u32 trigger_cntr; u32 etr_caps; + int shared; struct etr_buf *sysfs_buf; void *perf_data; };