summaryrefslogtreecommitdiff
path: root/tools/perf/util/cs-etm.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/cs-etm.c')
-rw-r--r--tools/perf/util/cs-etm.c36
1 files changed, 13 insertions, 23 deletions
diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
index 95f439c96180..8a639d2e51a4 100644
--- a/tools/perf/util/cs-etm.c
+++ b/tools/perf/util/cs-etm.c
@@ -194,7 +194,7 @@ int cs_etm__get_cpu(struct cs_etm_queue *etmq, u8 trace_chan_id, int *cpu)
* CS_ETM_PIDFMT_CTXTID2: CONTEXTIDR_EL2 is traced.
* CS_ETM_PIDFMT_NONE: No context IDs
*
- * It's possible that the two bits ETM_OPT_CTXTID and ETM_OPT_CTXTID2
+ * It's possible that the two format attributes 'contextid1' and 'contextid2'
* are enabled at the same time when the session runs on an EL2 kernel.
* This means the CONTEXTIDR_EL1 and CONTEXTIDR_EL2 both will be
* recorded in the trace data, the tool will selectively use
@@ -210,15 +210,15 @@ static enum cs_etm_pid_fmt cs_etm__init_pid_fmt(u64 *metadata)
if (metadata[CS_ETM_MAGIC] == __perf_cs_etmv3_magic) {
val = metadata[CS_ETM_ETMCR];
/* CONTEXTIDR is traced */
- if (val & BIT(ETM_OPT_CTXTID))
+ if (val & ETMCR_CTXTID)
return CS_ETM_PIDFMT_CTXTID;
} else {
val = metadata[CS_ETMV4_TRCCONFIGR];
/* CONTEXTIDR_EL2 is traced */
- if (val & (BIT(ETM4_CFG_BIT_VMID) | BIT(ETM4_CFG_BIT_VMID_OPT)))
+ if (val & (TRCCONFIGR_VMID | TRCCONFIGR_VMIDOPT))
return CS_ETM_PIDFMT_CTXTID2;
/* CONTEXTIDR_EL1 is traced */
- else if (val & BIT(ETM4_CFG_BIT_CTXTID))
+ else if (val & TRCCONFIGR_CID)
return CS_ETM_PIDFMT_CTXTID;
}
@@ -2914,29 +2914,21 @@ static int cs_etm__process_auxtrace_event(struct perf_session *session,
return 0;
}
-static int cs_etm__setup_timeless_decoding(struct cs_etm_auxtrace *etm)
+static void cs_etm__setup_timeless_decoding(struct cs_etm_auxtrace *etm)
{
- struct evsel *evsel;
- struct evlist *evlist = etm->session->evlist;
+ /* Take first ETM as all options will be the same for all ETMs */
+ u64 *metadata = etm->metadata[0];
/* Override timeless mode with user input from --itrace=Z */
if (etm->synth_opts.timeless_decoding) {
etm->timeless_decoding = true;
- return 0;
+ return;
}
- /*
- * Find the cs_etm evsel and look at what its timestamp setting was
- */
- evlist__for_each_entry(evlist, evsel)
- if (cs_etm__evsel_is_auxtrace(etm->session, evsel)) {
- etm->timeless_decoding =
- !(evsel->core.attr.config & BIT(ETM_OPT_TS));
- return 0;
- }
-
- pr_err("CS ETM: Couldn't find ETM evsel\n");
- return -EINVAL;
+ if (metadata[CS_ETM_MAGIC] == __perf_cs_etmv3_magic)
+ etm->timeless_decoding = !(metadata[CS_ETM_ETMCR] & ETMCR_TIMESTAMP_EN);
+ else
+ etm->timeless_decoding = !(metadata[CS_ETMV4_TRCCONFIGR] & TRCCONFIGR_TS);
}
/*
@@ -3499,9 +3491,7 @@ int cs_etm__process_auxtrace_info_full(union perf_event *event,
etm->auxtrace.evsel_is_auxtrace = cs_etm__evsel_is_auxtrace;
session->auxtrace = &etm->auxtrace;
- err = cs_etm__setup_timeless_decoding(etm);
- if (err)
- return err;
+ cs_etm__setup_timeless_decoding(etm);
etm->tc.time_shift = tc->time_shift;
etm->tc.time_mult = tc->time_mult;