Skip to content

Commit 7c2cc5e

Browse files
Suzuki K Poulosemathieupoirier
authored andcommitted
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]>
1 parent 5cb75f1 commit 7c2cc5e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/hwtracing/coresight/coresight-trbe.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,11 @@ static unsigned long trbe_snapshot_offset(struct perf_output_handle *handle)
303303
return buf->nr_pages * PAGE_SIZE;
304304
}
305305

306+
static u64 trbe_min_trace_buf_size(struct perf_output_handle *handle)
307+
{
308+
return TRBE_TRACE_MIN_BUF_SIZE;
309+
}
310+
306311
/*
307312
* TRBE Limit Calculation
308313
*
@@ -473,7 +478,7 @@ static unsigned long trbe_normal_offset(struct perf_output_handle *handle)
473478
* have space for a meaningful run, we rather pad it
474479
* and start fresh.
475480
*/
476-
if (limit && (limit - head < TRBE_TRACE_MIN_BUF_SIZE)) {
481+
if (limit && ((limit - head) < trbe_min_trace_buf_size(handle))) {
477482
trbe_pad_buf(handle, limit - head);
478483
limit = __trbe_normal_offset(handle);
479484
}

0 commit comments

Comments
 (0)