coresight: etb10: Properly set AUX buffer head in snapshot mode
authorMathieu Poirier <mathieu.poirier@linaro.org>
Wed, 19 Jun 2019 17:29:05 +0000 (11:29 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Jun 2019 18:29:13 +0000 (20:29 +0200)
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hwtracing/coresight/coresight-etb10.c

index 4ee4c80..60e753b 100644 (file)
@@ -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: