coresight: etm4x: Fix enabling of cycle accurate tracing in perf.
authorMike Leach <mike.leach@linaro.org>
Mon, 23 Jan 2017 17:41:23 +0000 (10:41 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Jan 2017 10:46:42 +0000 (11:46 +0100)
Using perf record 'cyclacc' option in cs_etm event was not setting up cycle
accurate trace correctly.

Corrects bit set in TRCCONFIGR to enable cycle accurate trace.
Programs TRCCCCTLR with a valid threshold value as required by ETMv4 spec.

Signed-off-by: Mike Leach <mike.leach@linaro.org>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hwtracing/coresight/coresight-etm4x.c
drivers/hwtracing/coresight/coresight-etm4x.h

index 031480f2c34d0f68166e924b180167a7c943d4d9..f432febdda49b6c2868784e6fe4dca0959338122 100644 (file)
@@ -216,8 +216,11 @@ static int etm4_parse_event_config(struct etmv4_drvdata *drvdata,
                goto out;
 
        /* Go from generic option to ETMv4 specifics */
-       if (attr->config & BIT(ETM_OPT_CYCACC))
-               config->cfg |= ETMv4_MODE_CYCACC;
+       if (attr->config & BIT(ETM_OPT_CYCACC)) {
+               config->cfg |= BIT(4);
+               /* TRM: Must program this for cycacc to work */
+               config->ccctlr = ETM_CYC_THRESHOLD_DEFAULT;
+       }
        if (attr->config & BIT(ETM_OPT_TS))
                config->cfg |= ETMv4_MODE_TIMESTAMP;
 
index ba8d3f86de2129dd869f156ade0d4a286ff158eb..b3b5ea7b7fb3b25fb2adc7fb077f01fabade613e 100644 (file)
 #define ETM_ARCH_V4                    0x40
 #define ETMv4_SYNC_MASK                        0x1F
 #define ETM_CYC_THRESHOLD_MASK         0xFFF
+#define ETM_CYC_THRESHOLD_DEFAULT       0x100
 #define ETMv4_EVENT_MASK               0xFF
 #define ETM_CNTR_MAX_VAL               0xFFFF
 #define ETM_TRACEID_MASK               0x3f