From: mathieu.poirier@linaro.org (Mathieu Poirier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] coresight: etm4x: Fix enabling of cycle accurate tracing in perf.
Date: Tue, 3 Jan 2017 09:57:34 -0700 [thread overview]
Message-ID: <20170103165734.GA3775@linaro.org> (raw)
In-Reply-To: <1483397719-22235-1-git-send-email-mike.leach@linaro.org>
On Mon, Jan 02, 2017 at 10:55:19PM +0000, Mike Leach wrote:
> 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.
This look good - just a tiny blip below.
>
> Signed-off-by: Mike Leach <mike.leach@linaro.org>
> ---
> drivers/hwtracing/coresight/coresight-etm4x.c | 7 +++++--
> drivers/hwtracing/coresight/coresight-etm4x.h | 1 +
> 2 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c
> index 4db8d6a..07be032 100644
> --- a/drivers/hwtracing/coresight/coresight-etm4x.c
> +++ b/drivers/hwtracing/coresight/coresight-etm4x.c
> @@ -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;
>
> diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h
> index ba8d3f8..8a62c6c 100644
> --- a/drivers/hwtracing/coresight/coresight-etm4x.h
> +++ b/drivers/hwtracing/coresight/coresight-etm4x.h
> @@ -146,6 +146,7 @@
> #define ETM_ARCH_V4 0x40
> #define ETMv4_SYNC_MASK 0x1F
> #define ETM_CYC_THRESHOLD_MASK 0xFFF
> +#define ETM_CYC_THRESHOLD_DEFAULT 256
If only to be consistent with the rest of the defines, please write this value
in base-16.
Thanks,
Mathieu
> #define ETMv4_EVENT_MASK 0xFF
> #define ETM_CNTR_MAX_VAL 0xFFFF
> #define ETM_TRACEID_MASK 0x3f
> --
> 2.7.4
>
prev parent reply other threads:[~2017-01-03 16:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-02 22:55 [PATCH] coresight: etm4x: Fix enabling of cycle accurate tracing in perf Mike Leach
2017-01-03 16:57 ` Mathieu Poirier [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170103165734.GA3775@linaro.org \
--to=mathieu.poirier@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).