aboutsummaryrefslogtreecommitdiff
path: root/drivers/hwtracing/coresight/coresight-tmc-etf.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwtracing/coresight/coresight-tmc-etf.c')
-rw-r--r--drivers/hwtracing/coresight/coresight-tmc-etf.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/hwtracing/coresight/coresight-tmc-etf.c b/drivers/hwtracing/coresight/coresight-tmc-etf.c
index 2527b5d3b65e..7694833b13cb 100644
--- a/drivers/hwtracing/coresight/coresight-tmc-etf.c
+++ b/drivers/hwtracing/coresight/coresight-tmc-etf.c
@@ -380,6 +380,26 @@ static void *tmc_alloc_etf_buffer(struct coresight_device *csdev,
{
int node, cpu = event->cpu;
struct cs_buffers *buf;
+ struct tmc_drvdata *drvdata;
+
+ /*
+ * In snapsot mode the size of the perf ring buffer needs to be equal
+ * to the size of the device's internal memory if we want to reuse the
+ * generic AUX buffer management mechanic.
+ *
+ * For example (assuming 4096 byte page size):
+ *
+ * # cat /sys/bus/coresight/devices/20010000.etf/buffer_size
+ * 0x10000
+ * # perf record -e cs_etm/@20010000.etf/ -S -m,16 --per-thread $APP
+ *
+ */
+ drvdata = dev_get_drvdata(csdev->dev.parent);
+ if (overwrite &&
+ ((nr_pages << PAGE_SHIFT) != drvdata->size)) {
+ dev_err(&csdev->dev, "Ring buffer not equal to device buffer");
+ return NULL;
+ }
if (cpu == -1)
cpu = smp_processor_id();