Skip to content

Commit 1ab3bb9

Browse files
Suzuki K Poulosegregkh
authored andcommitted
coresight: etm4x: Add necessary synchronization for sysreg access
As per the specification any update to the TRCPRGCTLR must be synchronized by a context synchronization event (in our case an explicist ISB) before the TRCSTATR is checked. Link: https://lore.kernel.org/r/[email protected] Cc: Mike Leach <[email protected]> Signed-off-by: Suzuki K Poulose <[email protected]> Signed-off-by: Mathieu Poirier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 4211bfc commit 1ab3bb9

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

drivers/hwtracing/coresight/coresight-etm4x-core.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,15 @@ static int etm4_enable_hw(struct etmv4_drvdata *drvdata)
284284
/* Disable the trace unit before programming trace registers */
285285
etm4x_relaxed_write32(csa, 0, TRCPRGCTLR);
286286

287+
/*
288+
* If we use system instructions, we need to synchronize the
289+
* write to the TRCPRGCTLR, before accessing the TRCSTATR.
290+
* See ARM IHI0064F, section
291+
* "4.3.7 Synchronization of register updates"
292+
*/
293+
if (!csa->io_mem)
294+
isb();
295+
287296
/* wait for TRCSTATR.IDLE to go up */
288297
if (coresight_timeout(csa, TRCSTATR, TRCSTATR_IDLE_BIT, 1))
289298
dev_err(etm_dev,
@@ -362,6 +371,10 @@ static int etm4_enable_hw(struct etmv4_drvdata *drvdata)
362371
/* Enable the trace unit */
363372
etm4x_relaxed_write32(csa, 1, TRCPRGCTLR);
364373

374+
/* Synchronize the register updates for sysreg access */
375+
if (!csa->io_mem)
376+
isb();
377+
365378
/* wait for TRCSTATR.IDLE to go back down to '0' */
366379
if (coresight_timeout(csa, TRCSTATR, TRCSTATR_IDLE_BIT, 0))
367380
dev_err(etm_dev,

0 commit comments

Comments
 (0)