aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuzuki K Poulose <[email protected]>2021-10-19 17:31:49 +0100
committerMathieu Poirier <[email protected]>2021-10-27 11:45:57 -0600
commit7c2cc5e26cc0c6bc2478ac203e3fe71950418ea0 (patch)
tree682b29801953294e7101ad7582a4f2d7eaec043a
parent5cb75f18800bac3c4bfc46f28d3d42d87439d9e2 (diff)
coresight: trbe: Add a helper to determine the minimum buffer size
For the TRBE to operate, we need a minimum space available to collect meaningful trace session. This is currently a few bytes, but we may need to extend this for working around errata. So, abstract this into a helper function. Cc: Anshuman Khandual <[email protected]> Cc: Mike Leach <[email protected]> Cc: Mathieu Poirier <[email protected]> Cc: Leo Yan <[email protected]> Reviewed-by: Anshuman Khandual <[email protected]> Signed-off-by: Suzuki K Poulose <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mathieu Poirier <[email protected]>
-rw-r--r--drivers/hwtracing/coresight/coresight-trbe.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c
index 2d39e5ecb72c..02a639ece2af 100644
--- a/drivers/hwtracing/coresight/coresight-trbe.c
+++ b/drivers/hwtracing/coresight/coresight-trbe.c
@@ -303,6 +303,11 @@ static unsigned long trbe_snapshot_offset(struct perf_output_handle *handle)
return buf->nr_pages * PAGE_SIZE;
}
+static u64 trbe_min_trace_buf_size(struct perf_output_handle *handle)
+{
+ return TRBE_TRACE_MIN_BUF_SIZE;
+}
+
/*
* TRBE Limit Calculation
*
@@ -473,7 +478,7 @@ static unsigned long trbe_normal_offset(struct perf_output_handle *handle)
* have space for a meaningful run, we rather pad it
* and start fresh.
*/
- if (limit && (limit - head < TRBE_TRACE_MIN_BUF_SIZE)) {
+ if (limit && ((limit - head) < trbe_min_trace_buf_size(handle))) {
trbe_pad_buf(handle, limit - head);
limit = __trbe_normal_offset(handle);
}