xref: /linux/tools/perf/util/arm-spe.h (revision 7f71507851fc7764b36a3221839607d3a45c2025)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Arm Statistical Profiling Extensions (SPE) support
4  * Copyright (c) 2017-2018, Arm Ltd.
5  */
6 
7 #ifndef INCLUDE__PERF_ARM_SPE_H__
8 #define INCLUDE__PERF_ARM_SPE_H__
9 
10 #define ARM_SPE_PMU_NAME "arm_spe_"
11 
12 enum {
13 	ARM_SPE_PMU_TYPE,
14 	ARM_SPE_PER_CPU_MMAPS,
15 	ARM_SPE_AUXTRACE_V1_PRIV_MAX,
16 };
17 
18 #define ARM_SPE_AUXTRACE_V1_PRIV_SIZE	\
19 	(ARM_SPE_AUXTRACE_V1_PRIV_MAX * sizeof(u64))
20 
21 enum {
22 	/*
23 	 * The old metadata format (defined above) does not include a
24 	 * field for version number. Version 1 is reserved and starts
25 	 * from version 2.
26 	 */
27 	ARM_SPE_HEADER_VERSION,
28 	/* Number of sizeof(u64) */
29 	ARM_SPE_HEADER_SIZE,
30 	/* PMU type shared by CPUs */
31 	ARM_SPE_PMU_TYPE_V2,
32 	/* Number of CPUs */
33 	ARM_SPE_CPUS_NUM,
34 	ARM_SPE_AUXTRACE_PRIV_MAX,
35 };
36 
37 enum {
38 	/* Magic number */
39 	ARM_SPE_MAGIC,
40 	/* CPU logical number in system */
41 	ARM_SPE_CPU,
42 	/* Number of parameters */
43 	ARM_SPE_CPU_NR_PARAMS,
44 	/* CPU MIDR */
45 	ARM_SPE_CPU_MIDR,
46 	/* Associated PMU type */
47 	ARM_SPE_CPU_PMU_TYPE,
48 	/* Minimal interval */
49 	ARM_SPE_CAP_MIN_IVAL,
50 	ARM_SPE_CPU_PRIV_MAX,
51 };
52 
53 #define ARM_SPE_HEADER_CURRENT_VERSION	2
54 
55 
56 union perf_event;
57 struct perf_session;
58 struct perf_pmu;
59 
60 struct auxtrace_record *arm_spe_recording_init(int *err,
61 					       struct perf_pmu *arm_spe_pmu);
62 
63 int arm_spe_process_auxtrace_info(union perf_event *event,
64 				  struct perf_session *session);
65 
66 void arm_spe_pmu_default_config(const struct perf_pmu *arm_spe_pmu,
67 				struct perf_event_attr *attr);
68 
69 #endif
70