2 * Copyright (c) 2022 Arm and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #ifndef __perfmon_arm_h
17 #define __perfmon_arm_h
20 * Events from the Armv8 PMUv3 - See "Arm Architecture Reference Manual Armv8,
21 * for Armv8-A architecture profile" D7.10 PMU events and event numbers:
22 * https://developer.arm.com/documentation/ddi0487/latest/
23 * EventCode, name, description
25 #define foreach_perf_arm_event \
26 _ (0x0D, BR_IMMED_RETIRED, "Immediate branch architecturally executed") \
27 _ (0x10, BR_MIS_PRED, \
28 "Mispredicted or not predicted branch Speculatively executed") \
29 _ (0x22, BR_MIS_PRED_RETIRED, \
30 "Instruction architecturally executed, mispredicted branch") \
31 _ (0x12, BR_PRED, "Predictable branch Speculatively executed") \
32 _ (0x21, BR_RETIRED, "Branch instruction architecturally executed") \
33 _ (0x0E, BR_RETURN_RETIRED, \
34 "Function return instruction architecturally executed and the " \
35 "condition code check pass") \
36 _ (0x19, BUS_ACCESS, "Attributable Bus access") \
37 _ (0x1D, BUS_CYCLES, "Bus cycle") \
39 "For an odd numbered counter, increment when an overflow occurs on" \
40 "the preceding even-numbered counter on the same PE") \
41 _ (0x0B, CID_WRITE_RETIRED, \
42 "Instruction architecturally executed, Condition code check pass, " \
43 "write to CONTEXTIDR") \
44 _ (0x11, CPU_CYCLES, "Cycle counter") \
46 "Access to data or unified TLB causes a translation table walk") \
47 _ (0x0A, EXC_RETURN, \
48 "Exception return instruction architecturally executed and the " \
49 "condition code check pass") \
50 _ (0x09, EXC_TAKEN, "Exception entry") \
51 _ (0x08, INST_RETIRED, "Instruction architecturally executed") \
52 _ (0x1B, INST_SPEC, "Operation Speculatively executed") \
54 "Access to instruction TLB that causes a translation table walk") \
55 _ (0x04, L1D_CACHE, "Level 1 data cache access") \
56 _ (0x1F, L1D_CACHE_ALLOCATE, \
57 "Level 1 data cache allocation without refill") \
58 _ (0x39, L1D_CACHE_LMISS_RD, "Level 1 data cache long-latency read miss") \
59 _ (0x03, L1D_CACHE_REFILL, "Level 1 data cache refill") \
60 _ (0x15, L1D_CACHE_WB, "Attributable Level 1 data cache write-back") \
61 _ (0x25, L1D_TLB, "Level 1 data or unified TLB access") \
62 _ (0x05, L1D_TLB_REFILL, "Level 1 data or unified TLB refill") \
63 _ (0x14, L1I_CACHE, "Level 1 instruction cache access") \
64 _ (0x01, L1I_CACHE_REFILL, "Level 1 instruction cache refill") \
65 _ (0x26, L1I_TLB, "Level 1 instruction TLB access") \
66 _ (0x02, L1I_TLB_REFILL, "Level 1 instruction TLB refill") \
67 _ (0x16, L2D_CACHE, "Level 2 data cache access") \
68 _ (0x20, L2D_CACHE_ALLOCATE, \
69 "Level 2 data cache allocation without refill") \
70 _ (0x17, L2D_CACHE_REFILL, "Level 2 data cache refill") \
71 _ (0x18, L2D_CACHE_WB, "Attributable Level 2 data cache write-back") \
72 _ (0x2F, L2D_TLB, "Level 2 data or unified TLB access") \
73 _ (0x2D, L2D_TLB_REFILL, "Level 2 data or unified TLB refill") \
74 _ (0x27, L2I_CACHE, "Level 2 instruction cache access") \
75 _ (0x28, L2I_CACHE_REFILL, "Attributable Level 2 instruction cache refill") \
76 _ (0x30, L2I_TLB, "Level 2 instruction TLB access") \
77 _ (0x2E, L2I_TLB_REFILL, "Level 2 instruction TLB refill") \
78 _ (0x2B, L3D_CACHE, "Level 3 data cache access") \
79 _ (0x29, L3D_CACHE_ALLOCATE, \
80 "Level 3 data cache allocation without refill") \
81 _ (0x2A, L3D_CACHE_REFILL, "Attributable Level 3 data cache refill") \
82 _ (0x2C, L3D_CACHE_WB, "Attributable Level 3 data cache write-back") \
83 _ (0x06, LD_RETIRED, \
84 "Memory-reading instruction architecturally executed and condition" \
86 _ (0x32, LL_CACHE, "Last Level cache access") \
87 _ (0x33, LL_CACHE_MISS, "Last Level cache miss") \
88 _ (0x37, LL_CACHE_MISS_RD, "Last level cache miss, read") \
89 _ (0x36, LL_CACHE_RD, "Last level data cache access, read") \
90 _ (0x1A, MEMORY_ERROR, "Local memory error") \
91 _ (0x13, MEM_ACCESS, "Data memory access") \
92 _ (0x3A, OP_RETIRED, "Micro-operation architecturally executed") \
93 _ (0x3B, OP_SPEC, "Micro-operation Speculatively executed") \
94 _ (0x0C, PC_WRITE_RETIRED, \
95 "Software change to the Program Counter (PC). Instruction is " \
96 "architecturally executed and condition code check pass") \
97 _ (0x31, REMOTE_ACCESS, \
98 "Access to another socket in a multi-socket system") \
99 _ (0x38, REMOTE_ACCESS_RD, \
100 "Access to another socket in a multi-socket system, read") \
101 _ (0x3C, STALL, "No operation sent for execution") \
102 _ (0x24, STALL_BACKEND, "No operation issued due to the backend") \
103 _ (0x23, STALL_FRONTEND, "No operation issued due to the frontend") \
104 _ (0x3F, STALL_SLOT, "No operation sent for execution on a Slot") \
105 _ (0x3D, STALL_SLOT_BACKEND, \
106 "No operation sent for execution on a Slot due to the backend") \
107 _ (0x3E, STALL_SLOT_FRONTEND, \
108 "No operation sent for execution on a Slot due to the frontend") \
109 _ (0x07, ST_RETIRED, \
110 "Memory-writing instruction architecturally executed and condition" \
111 " code check pass") \
113 "Instruction architecturally executed, Condition code check pass, " \
114 "software increment") \
115 _ (0x1C, TTBR_WRITE_RETIRED, \
116 "Instruction architecturally executed, Condition code check pass, " \
118 _ (0x0F, UNALIGNED_LDST_RETIRED, \
119 "Unaligned memory memory-reading or memory-writing instruction " \
120 "architecturally executed and condition code check pass")
124 #define _(event, n, desc) ARMV8_PMUV3_##n,
125 foreach_perf_arm_event