coresight: tmc: Fix byte-address alignment for RRP
authorLeo Yan <leo.yan@linaro.org>
Thu, 20 Sep 2018 19:18:02 +0000 (13:18 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 25 Sep 2018 18:09:18 +0000 (20:09 +0200)
>From the comment in the code, it claims the requirement for byte-address
alignment for RRP register: 'for 32-bit, 64-bit and 128-bit wide trace
memory, the four LSBs must be 0s. For 256-bit wide trace memory, the
five LSBs must be 0s'.  This isn't consistent with the program, the
program sets five LSBs as zeros for 32/64/128-bit wide trace memory and
set six LSBs zeros for 256-bit wide trace memory.

After checking with the CoreSight Trace Memory Controller technical
reference manual (ARM DDI 0461B, section 3.3.4 RAM Read Pointer
Register), it proves the comment is right and the program does wrong
setting.

This patch fixes byte-address alignment for RRP by following correct
definition in the technical reference manual.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>
Signed-off-by: Leo Yan <leo.yan@linaro.org>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hwtracing/coresight/coresight-tmc-etf.c

index 4bf3bfd7c078b81bf139eeaa2c37a9bc7e0d5d61..b54a3db13feecc3bf5b73ac09d77e03988eb8f36 100644 (file)
@@ -417,10 +417,10 @@ static unsigned long tmc_update_etf_buffer(struct coresight_device *csdev,
                case TMC_MEM_INTF_WIDTH_32BITS:
                case TMC_MEM_INTF_WIDTH_64BITS:
                case TMC_MEM_INTF_WIDTH_128BITS:
-                       mask = GENMASK(31, 5);
+                       mask = GENMASK(31, 4);
                        break;
                case TMC_MEM_INTF_WIDTH_256BITS:
-                       mask = GENMASK(31, 6);
+                       mask = GENMASK(31, 5);
                        break;
                }