diff mbox series

[01/45] coresight: etb10: Properly set AUX buffer head in snapshot mode

Message ID 20190619172949.4522-2-mathieu.poirier@linaro.org (mailing list archive)
State Mainlined, archived
Commit 514e5150e7c6b247d7a473f935fc49d6f194688b
Headers show
Series coresight: next v5.2-rc5 | expand

Commit Message

Mathieu Poirier June 19, 2019, 5:29 p.m. UTC
Unify amongst sink drivers how the AUX ring buffer head is communicated
to user space.  That way the same algorithm in user space can be used to
determine where the latest data is and how much of it to access.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Tested-by: Leo Yan <leo.yan@linaro.org>
---
 drivers/hwtracing/coresight/coresight-etb10.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

Comments

Greg KH June 19, 2019, 6:28 p.m. UTC | #1
On Wed, Jun 19, 2019 at 11:29:05AM -0600, Mathieu Poirier wrote:
> Unify amongst sink drivers how the AUX ring buffer head is communicated
> to user space.  That way the same algorithm in user space can be used to
> determine where the latest data is and how much of it to access.
> 
> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> Tested-by: Leo Yan <leo.yan@linaro.org>
> ---
>  drivers/hwtracing/coresight/coresight-etb10.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c
> index 4ee4c80a4354..60e753b1768d 100644
> --- a/drivers/hwtracing/coresight/coresight-etb10.c
> +++ b/drivers/hwtracing/coresight/coresight-etb10.c
> @@ -548,13 +548,14 @@ static unsigned long etb_update_buffer(struct coresight_device *csdev,
>  	writel_relaxed(0x0, drvdata->base + ETB_RAM_WRITE_POINTER);
>  
>  	/*
> -	 * In snapshot mode we have to update the handle->head to point
> -	 * to the new location.
> +	 * In snapshot mode we simply increment the head by the number of byte
> +	 * that were written.  User space function  cs_etm_find_snapshot() will
                                                  ^^
						  two spaces?  :)

happens everywhere you cut/pasted this comment.  Not a big deal...
diff mbox series

Patch

diff --git a/drivers/hwtracing/coresight/coresight-etb10.c b/drivers/hwtracing/coresight/coresight-etb10.c
index 4ee4c80a4354..60e753b1768d 100644
--- a/drivers/hwtracing/coresight/coresight-etb10.c
+++ b/drivers/hwtracing/coresight/coresight-etb10.c
@@ -548,13 +548,14 @@  static unsigned long etb_update_buffer(struct coresight_device *csdev,
 	writel_relaxed(0x0, drvdata->base + ETB_RAM_WRITE_POINTER);
 
 	/*
-	 * In snapshot mode we have to update the handle->head to point
-	 * to the new location.
+	 * In snapshot mode we simply increment the head by the number of byte
+	 * that were written.  User space function  cs_etm_find_snapshot() will
+	 * figure out how many bytes to get from the AUX buffer based on the
+	 * position of the head.
 	 */
-	if (buf->snapshot) {
-		handle->head = (cur * PAGE_SIZE) + offset;
-		to_read = buf->nr_pages << PAGE_SHIFT;
-	}
+	if (buf->snapshot)
+		handle->head += to_read;
+
 	__etb_enable_hw(drvdata);
 	CS_LOCK(drvdata->base);
 out: