aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathieu Poirier <mathieu.poirier@linaro.org>2018-12-04 15:39:04 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2018-12-17 12:59:01 -0500
commit15a5cd19627a3046e7b66626abdeed3f92daafd2 (patch)
tree96477b256ba1fbac8e928dcc5b0e1855c3d934c7
parent7d0f4fefc492498a180da8fd5c9ebe11dc768c83 (diff)
perf cs-etm: Add support for PTMv1.1 decoding
This patch is re-using the mechanic set forth by ETMv3 to add support for PTM decoding. Configuration for both encoding protocol is similar but the generated stream itself is very different, hence requiring special handling. Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: coresight@lists.linaro.org Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/1543955944-10042-4-git-send-email-mathieu.poirier@linaro.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/util/cs-etm-decoder/cs-etm-decoder.c10
-rw-r--r--tools/perf/util/cs-etm-decoder/cs-etm-decoder.h1
-rw-r--r--tools/perf/util/cs-etm.c23
3 files changed, 30 insertions, 4 deletions
diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
index 952d1f43f3fa..0b4c8629f578 100644
--- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
+++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
@@ -256,8 +256,11 @@ cs_etm_decoder__create_etm_packet_printer(struct cs_etm_trace_params *t_params,
256 256
257 switch (t_params->protocol) { 257 switch (t_params->protocol) {
258 case CS_ETM_PROTO_ETMV3: 258 case CS_ETM_PROTO_ETMV3:
259 case CS_ETM_PROTO_PTM:
259 cs_etm_decoder__gen_etmv3_config(t_params, &config_etmv3); 260 cs_etm_decoder__gen_etmv3_config(t_params, &config_etmv3);
260 decoder_name = OCSD_BUILTIN_DCD_ETMV3; 261 decoder_name = (t_params->protocol == CS_ETM_PROTO_ETMV3) ?
262 OCSD_BUILTIN_DCD_ETMV3 :
263 OCSD_BUILTIN_DCD_PTM;
261 trace_config = &config_etmv3; 264 trace_config = &config_etmv3;
262 break; 265 break;
263 case CS_ETM_PROTO_ETMV4i: 266 case CS_ETM_PROTO_ETMV4i:
@@ -453,8 +456,11 @@ static int cs_etm_decoder__create_etm_packet_decoder(
453 456
454 switch (t_params->protocol) { 457 switch (t_params->protocol) {
455 case CS_ETM_PROTO_ETMV3: 458 case CS_ETM_PROTO_ETMV3:
459 case CS_ETM_PROTO_PTM:
456 cs_etm_decoder__gen_etmv3_config(t_params, &config_etmv3); 460 cs_etm_decoder__gen_etmv3_config(t_params, &config_etmv3);
457 decoder_name = OCSD_BUILTIN_DCD_ETMV3; 461 decoder_name = (t_params->protocol == CS_ETM_PROTO_ETMV3) ?
462 OCSD_BUILTIN_DCD_ETMV3 :
463 OCSD_BUILTIN_DCD_PTM;
458 trace_config = &config_etmv3; 464 trace_config = &config_etmv3;
459 break; 465 break;
460 case CS_ETM_PROTO_ETMV4i: 466 case CS_ETM_PROTO_ETMV4i:
diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h
index 6b5525410a43..b295dd2b8292 100644
--- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h
+++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h
@@ -96,6 +96,7 @@ enum {
96 CS_ETM_PROTO_ETMV3 = 1, 96 CS_ETM_PROTO_ETMV3 = 1,
97 CS_ETM_PROTO_ETMV4i, 97 CS_ETM_PROTO_ETMV4i,
98 CS_ETM_PROTO_ETMV4d, 98 CS_ETM_PROTO_ETMV4d,
99 CS_ETM_PROTO_PTM,
99}; 100};
100 101
101enum { 102enum {
diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
index 76e509c32a28..23159c33db2a 100644
--- a/tools/perf/util/cs-etm.c
+++ b/tools/perf/util/cs-etm.c
@@ -83,6 +83,19 @@ static int cs_etm__update_queues(struct cs_etm_auxtrace *etm);
83static int cs_etm__process_timeless_queues(struct cs_etm_auxtrace *etm, 83static int cs_etm__process_timeless_queues(struct cs_etm_auxtrace *etm,
84 pid_t tid, u64 time_); 84 pid_t tid, u64 time_);
85 85
86/* PTMs ETMIDR [11:8] set to b0011 */
87#define ETMIDR_PTM_VERSION 0x00000300
88
89static u32 cs_etm__get_v7_protocol_version(u32 etmidr)
90{
91 etmidr &= ETMIDR_PTM_VERSION;
92
93 if (etmidr == ETMIDR_PTM_VERSION)
94 return CS_ETM_PROTO_PTM;
95
96 return CS_ETM_PROTO_ETMV3;
97}
98
86static void cs_etm__packet_dump(const char *pkt_string) 99static void cs_etm__packet_dump(const char *pkt_string)
87{ 100{
88 const char *color = PERF_COLOR_BLUE; 101 const char *color = PERF_COLOR_BLUE;
@@ -115,7 +128,10 @@ static void cs_etm__dump_event(struct cs_etm_auxtrace *etm,
115 t_params = zalloc(sizeof(*t_params) * etm->num_cpu); 128 t_params = zalloc(sizeof(*t_params) * etm->num_cpu);
116 for (i = 0; i < etm->num_cpu; i++) { 129 for (i = 0; i < etm->num_cpu; i++) {
117 if (etm->metadata[i][CS_ETM_MAGIC] == __perf_cs_etmv3_magic) { 130 if (etm->metadata[i][CS_ETM_MAGIC] == __perf_cs_etmv3_magic) {
118 t_params[i].protocol = CS_ETM_PROTO_ETMV3; 131 u32 etmidr = etm->metadata[i][CS_ETM_ETMIDR];
132
133 t_params[i].protocol =
134 cs_etm__get_v7_protocol_version(etmidr);
119 t_params[i].etmv3.reg_ctrl = 135 t_params[i].etmv3.reg_ctrl =
120 etm->metadata[i][CS_ETM_ETMCR]; 136 etm->metadata[i][CS_ETM_ETMCR];
121 t_params[i].etmv3.reg_trc_id = 137 t_params[i].etmv3.reg_trc_id =
@@ -366,7 +382,10 @@ static struct cs_etm_queue *cs_etm__alloc_queue(struct cs_etm_auxtrace *etm,
366 382
367 for (i = 0; i < etm->num_cpu; i++) { 383 for (i = 0; i < etm->num_cpu; i++) {
368 if (etm->metadata[i][CS_ETM_MAGIC] == __perf_cs_etmv3_magic) { 384 if (etm->metadata[i][CS_ETM_MAGIC] == __perf_cs_etmv3_magic) {
369 t_params[i].protocol = CS_ETM_PROTO_ETMV3; 385 u32 etmidr = etm->metadata[i][CS_ETM_ETMIDR];
386
387 t_params[i].protocol =
388 cs_etm__get_v7_protocol_version(etmidr);
370 t_params[i].etmv3.reg_ctrl = 389 t_params[i].etmv3.reg_ctrl =
371 etm->metadata[i][CS_ETM_ETMCR]; 390 etm->metadata[i][CS_ETM_ETMCR];
372 t_params[i].etmv3.reg_trc_id = 391 t_params[i].etmv3.reg_trc_id =