1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright(C) 2015 Linaro Limited. All rights reserved.
4 * Author: Mathieu Poirier <mathieu.poirier@linaro.org>
7 #ifndef INCLUDE__UTIL_PERF_CS_ETM_H__
8 #define INCLUDE__UTIL_PERF_CS_ETM_H__
10 #include "util/event.h"
11 #include "util/session.h"
13 /* Versionning header in case things need tro change in the future. That way
14 * decoding of old snapshot is still possible.
17 /* Starting with 0x0 */
19 /* PMU->type (32 bit), total # of CPUs (32 bit) */
22 CS_HEADER_VERSION_0_MAX,
25 /* Beginning of header common to both ETMv3 and V4 */
31 /* ETMv3/PTM metadata */
33 /* Dynamic, configurable parameters */
34 CS_ETM_ETMCR = CS_ETM_CPU + 1,
36 /* RO, taken from sysFS */
44 /* Dynamic, configurable parameters */
45 CS_ETMV4_TRCCONFIGR = CS_ETM_CPU + 1,
47 /* RO, taken from sysFS */
52 CS_ETMV4_TRCAUTHSTATUS,
56 #define KiB(x) ((x) * 1024)
57 #define MiB(x) ((x) * 1024 * 1024)
59 #define CS_ETM_HEADER_SIZE (CS_HEADER_VERSION_0_MAX * sizeof(u64))
61 static const u64 __perf_cs_etmv3_magic = 0x3030303030303030ULL;
62 static const u64 __perf_cs_etmv4_magic = 0x4040404040404040ULL;
63 #define CS_ETMV3_PRIV_SIZE (CS_ETM_PRIV_MAX * sizeof(u64))
64 #define CS_ETMV4_PRIV_SIZE (CS_ETMV4_PRIV_MAX * sizeof(u64))
66 #ifdef HAVE_CSTRACE_SUPPORT
67 int cs_etm__process_auxtrace_info(union perf_event *event,
68 struct perf_session *session);
69 int cs_etm__get_cpu(u8 trace_chan_id, int *cpu);
72 cs_etm__process_auxtrace_info(union perf_event *event __maybe_unused,
73 struct perf_session *session __maybe_unused)
78 static inline int cs_etm__get_cpu(u8 trace_chan_id __maybe_unused,
79 int *cpu __maybe_unused)