|
@@ -319,37 +319,7 @@ static int etb_set_buffer(struct coresight_device *csdev,
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-static unsigned long etb_reset_buffer(struct coresight_device *csdev,
|
|
|
- struct perf_output_handle *handle,
|
|
|
- void *sink_config)
|
|
|
-{
|
|
|
- unsigned long size = 0;
|
|
|
- struct cs_buffers *buf = sink_config;
|
|
|
-
|
|
|
- if (buf) {
|
|
|
- /*
|
|
|
- * In snapshot mode ->data_size holds the new address of the
|
|
|
- * ring buffer's head. The size itself is the whole address
|
|
|
- * range since we want the latest information.
|
|
|
- */
|
|
|
- if (buf->snapshot)
|
|
|
- handle->head = local_xchg(&buf->data_size,
|
|
|
- buf->nr_pages << PAGE_SHIFT);
|
|
|
-
|
|
|
- /*
|
|
|
- * Tell the tracer PMU how much we got in this run and if
|
|
|
- * something went wrong along the way. Nobody else can use
|
|
|
- * this cs_buffers instance until we are done. As such
|
|
|
- * resetting parameters here and squaring off with the ring
|
|
|
- * buffer API in the tracer PMU is fine.
|
|
|
- */
|
|
|
- size = local_xchg(&buf->data_size, 0);
|
|
|
- }
|
|
|
-
|
|
|
- return size;
|
|
|
-}
|
|
|
-
|
|
|
-static void etb_update_buffer(struct coresight_device *csdev,
|
|
|
+static unsigned long etb_update_buffer(struct coresight_device *csdev,
|
|
|
struct perf_output_handle *handle,
|
|
|
void *sink_config)
|
|
|
{
|
|
@@ -358,13 +328,13 @@ static void etb_update_buffer(struct coresight_device *csdev,
|
|
|
u8 *buf_ptr;
|
|
|
const u32 *barrier;
|
|
|
u32 read_ptr, write_ptr, capacity;
|
|
|
- u32 status, read_data, to_read;
|
|
|
- unsigned long offset;
|
|
|
+ u32 status, read_data;
|
|
|
+ unsigned long offset, to_read;
|
|
|
struct cs_buffers *buf = sink_config;
|
|
|
struct etb_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
|
|
|
|
|
|
if (!buf)
|
|
|
- return;
|
|
|
+ return 0;
|
|
|
|
|
|
capacity = drvdata->buffer_depth * ETB_FRAME_SIZE_WORDS;
|
|
|
|
|
@@ -469,18 +439,17 @@ static void etb_update_buffer(struct coresight_device *csdev,
|
|
|
writel_relaxed(0x0, drvdata->base + ETB_RAM_WRITE_POINTER);
|
|
|
|
|
|
/*
|
|
|
- * In snapshot mode all we have to do is communicate to
|
|
|
- * perf_aux_output_end() the address of the current head. In full
|
|
|
- * trace mode the same function expects a size to move rb->aux_head
|
|
|
- * forward.
|
|
|
+ * In snapshot mode we have to update the handle->head to point
|
|
|
+ * to the new location.
|
|
|
*/
|
|
|
- if (buf->snapshot)
|
|
|
- local_set(&buf->data_size, (cur * PAGE_SIZE) + offset);
|
|
|
- else
|
|
|
- local_add(to_read, &buf->data_size);
|
|
|
-
|
|
|
+ if (buf->snapshot) {
|
|
|
+ handle->head = (cur * PAGE_SIZE) + offset;
|
|
|
+ to_read = buf->nr_pages << PAGE_SHIFT;
|
|
|
+ }
|
|
|
etb_enable_hw(drvdata);
|
|
|
CS_LOCK(drvdata->base);
|
|
|
+
|
|
|
+ return to_read;
|
|
|
}
|
|
|
|
|
|
static const struct coresight_ops_sink etb_sink_ops = {
|
|
@@ -489,7 +458,6 @@ static const struct coresight_ops_sink etb_sink_ops = {
|
|
|
.alloc_buffer = etb_alloc_buffer,
|
|
|
.free_buffer = etb_free_buffer,
|
|
|
.set_buffer = etb_set_buffer,
|
|
|
- .reset_buffer = etb_reset_buffer,
|
|
|
.update_buffer = etb_update_buffer,
|
|
|
};
|
|
|
|