• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ***   To edit the content of this header, modify the corresponding
11  ***   source file (e.g. under external/kernel-headers/original/) then
12  ***   run bionic/libc/kernel/tools/update_all.py
13  ***
14  ***   Any manual change here will be lost the next time this script will
15  ***   be run. You've been warned!
16  ***
17  ****************************************************************************
18  ****************************************************************************/
19 #ifndef _UAPI_LINUX_PERF_EVENT_H
20 #define _UAPI_LINUX_PERF_EVENT_H
21 #include <linux/types.h>
22 #include <linux/ioctl.h>
23 #include <asm/byteorder.h>
24 enum perf_type_id {
25   PERF_TYPE_HARDWARE = 0,
26   PERF_TYPE_SOFTWARE = 1,
27   PERF_TYPE_TRACEPOINT = 2,
28   PERF_TYPE_HW_CACHE = 3,
29   PERF_TYPE_RAW = 4,
30   PERF_TYPE_BREAKPOINT = 5,
31   PERF_TYPE_MAX,
32 };
33 #define PERF_PMU_TYPE_SHIFT 32
34 #define PERF_HW_EVENT_MASK 0xffffffff
35 enum perf_hw_id {
36   PERF_COUNT_HW_CPU_CYCLES = 0,
37   PERF_COUNT_HW_INSTRUCTIONS = 1,
38   PERF_COUNT_HW_CACHE_REFERENCES = 2,
39   PERF_COUNT_HW_CACHE_MISSES = 3,
40   PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4,
41   PERF_COUNT_HW_BRANCH_MISSES = 5,
42   PERF_COUNT_HW_BUS_CYCLES = 6,
43   PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 7,
44   PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 8,
45   PERF_COUNT_HW_REF_CPU_CYCLES = 9,
46   PERF_COUNT_HW_MAX,
47 };
48 enum perf_hw_cache_id {
49   PERF_COUNT_HW_CACHE_L1D = 0,
50   PERF_COUNT_HW_CACHE_L1I = 1,
51   PERF_COUNT_HW_CACHE_LL = 2,
52   PERF_COUNT_HW_CACHE_DTLB = 3,
53   PERF_COUNT_HW_CACHE_ITLB = 4,
54   PERF_COUNT_HW_CACHE_BPU = 5,
55   PERF_COUNT_HW_CACHE_NODE = 6,
56   PERF_COUNT_HW_CACHE_MAX,
57 };
58 enum perf_hw_cache_op_id {
59   PERF_COUNT_HW_CACHE_OP_READ = 0,
60   PERF_COUNT_HW_CACHE_OP_WRITE = 1,
61   PERF_COUNT_HW_CACHE_OP_PREFETCH = 2,
62   PERF_COUNT_HW_CACHE_OP_MAX,
63 };
64 enum perf_hw_cache_op_result_id {
65   PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0,
66   PERF_COUNT_HW_CACHE_RESULT_MISS = 1,
67   PERF_COUNT_HW_CACHE_RESULT_MAX,
68 };
69 enum perf_sw_ids {
70   PERF_COUNT_SW_CPU_CLOCK = 0,
71   PERF_COUNT_SW_TASK_CLOCK = 1,
72   PERF_COUNT_SW_PAGE_FAULTS = 2,
73   PERF_COUNT_SW_CONTEXT_SWITCHES = 3,
74   PERF_COUNT_SW_CPU_MIGRATIONS = 4,
75   PERF_COUNT_SW_PAGE_FAULTS_MIN = 5,
76   PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6,
77   PERF_COUNT_SW_ALIGNMENT_FAULTS = 7,
78   PERF_COUNT_SW_EMULATION_FAULTS = 8,
79   PERF_COUNT_SW_DUMMY = 9,
80   PERF_COUNT_SW_BPF_OUTPUT = 10,
81   PERF_COUNT_SW_CGROUP_SWITCHES = 11,
82   PERF_COUNT_SW_MAX,
83 };
84 enum perf_event_sample_format {
85   PERF_SAMPLE_IP = 1U << 0,
86   PERF_SAMPLE_TID = 1U << 1,
87   PERF_SAMPLE_TIME = 1U << 2,
88   PERF_SAMPLE_ADDR = 1U << 3,
89   PERF_SAMPLE_READ = 1U << 4,
90   PERF_SAMPLE_CALLCHAIN = 1U << 5,
91   PERF_SAMPLE_ID = 1U << 6,
92   PERF_SAMPLE_CPU = 1U << 7,
93   PERF_SAMPLE_PERIOD = 1U << 8,
94   PERF_SAMPLE_STREAM_ID = 1U << 9,
95   PERF_SAMPLE_RAW = 1U << 10,
96   PERF_SAMPLE_BRANCH_STACK = 1U << 11,
97   PERF_SAMPLE_REGS_USER = 1U << 12,
98   PERF_SAMPLE_STACK_USER = 1U << 13,
99   PERF_SAMPLE_WEIGHT = 1U << 14,
100   PERF_SAMPLE_DATA_SRC = 1U << 15,
101   PERF_SAMPLE_IDENTIFIER = 1U << 16,
102   PERF_SAMPLE_TRANSACTION = 1U << 17,
103   PERF_SAMPLE_REGS_INTR = 1U << 18,
104   PERF_SAMPLE_PHYS_ADDR = 1U << 19,
105   PERF_SAMPLE_AUX = 1U << 20,
106   PERF_SAMPLE_CGROUP = 1U << 21,
107   PERF_SAMPLE_DATA_PAGE_SIZE = 1U << 22,
108   PERF_SAMPLE_CODE_PAGE_SIZE = 1U << 23,
109   PERF_SAMPLE_WEIGHT_STRUCT = 1U << 24,
110   PERF_SAMPLE_MAX = 1U << 25,
111 };
112 #define PERF_SAMPLE_WEIGHT_TYPE (PERF_SAMPLE_WEIGHT | PERF_SAMPLE_WEIGHT_STRUCT)
113 enum perf_branch_sample_type_shift {
114   PERF_SAMPLE_BRANCH_USER_SHIFT = 0,
115   PERF_SAMPLE_BRANCH_KERNEL_SHIFT = 1,
116   PERF_SAMPLE_BRANCH_HV_SHIFT = 2,
117   PERF_SAMPLE_BRANCH_ANY_SHIFT = 3,
118   PERF_SAMPLE_BRANCH_ANY_CALL_SHIFT = 4,
119   PERF_SAMPLE_BRANCH_ANY_RETURN_SHIFT = 5,
120   PERF_SAMPLE_BRANCH_IND_CALL_SHIFT = 6,
121   PERF_SAMPLE_BRANCH_ABORT_TX_SHIFT = 7,
122   PERF_SAMPLE_BRANCH_IN_TX_SHIFT = 8,
123   PERF_SAMPLE_BRANCH_NO_TX_SHIFT = 9,
124   PERF_SAMPLE_BRANCH_COND_SHIFT = 10,
125   PERF_SAMPLE_BRANCH_CALL_STACK_SHIFT = 11,
126   PERF_SAMPLE_BRANCH_IND_JUMP_SHIFT = 12,
127   PERF_SAMPLE_BRANCH_CALL_SHIFT = 13,
128   PERF_SAMPLE_BRANCH_NO_FLAGS_SHIFT = 14,
129   PERF_SAMPLE_BRANCH_NO_CYCLES_SHIFT = 15,
130   PERF_SAMPLE_BRANCH_TYPE_SAVE_SHIFT = 16,
131   PERF_SAMPLE_BRANCH_HW_INDEX_SHIFT = 17,
132   PERF_SAMPLE_BRANCH_PRIV_SAVE_SHIFT = 18,
133   PERF_SAMPLE_BRANCH_MAX_SHIFT
134 };
135 enum perf_branch_sample_type {
136   PERF_SAMPLE_BRANCH_USER = 1U << PERF_SAMPLE_BRANCH_USER_SHIFT,
137   PERF_SAMPLE_BRANCH_KERNEL = 1U << PERF_SAMPLE_BRANCH_KERNEL_SHIFT,
138   PERF_SAMPLE_BRANCH_HV = 1U << PERF_SAMPLE_BRANCH_HV_SHIFT,
139   PERF_SAMPLE_BRANCH_ANY = 1U << PERF_SAMPLE_BRANCH_ANY_SHIFT,
140   PERF_SAMPLE_BRANCH_ANY_CALL = 1U << PERF_SAMPLE_BRANCH_ANY_CALL_SHIFT,
141   PERF_SAMPLE_BRANCH_ANY_RETURN = 1U << PERF_SAMPLE_BRANCH_ANY_RETURN_SHIFT,
142   PERF_SAMPLE_BRANCH_IND_CALL = 1U << PERF_SAMPLE_BRANCH_IND_CALL_SHIFT,
143   PERF_SAMPLE_BRANCH_ABORT_TX = 1U << PERF_SAMPLE_BRANCH_ABORT_TX_SHIFT,
144   PERF_SAMPLE_BRANCH_IN_TX = 1U << PERF_SAMPLE_BRANCH_IN_TX_SHIFT,
145   PERF_SAMPLE_BRANCH_NO_TX = 1U << PERF_SAMPLE_BRANCH_NO_TX_SHIFT,
146   PERF_SAMPLE_BRANCH_COND = 1U << PERF_SAMPLE_BRANCH_COND_SHIFT,
147   PERF_SAMPLE_BRANCH_CALL_STACK = 1U << PERF_SAMPLE_BRANCH_CALL_STACK_SHIFT,
148   PERF_SAMPLE_BRANCH_IND_JUMP = 1U << PERF_SAMPLE_BRANCH_IND_JUMP_SHIFT,
149   PERF_SAMPLE_BRANCH_CALL = 1U << PERF_SAMPLE_BRANCH_CALL_SHIFT,
150   PERF_SAMPLE_BRANCH_NO_FLAGS = 1U << PERF_SAMPLE_BRANCH_NO_FLAGS_SHIFT,
151   PERF_SAMPLE_BRANCH_NO_CYCLES = 1U << PERF_SAMPLE_BRANCH_NO_CYCLES_SHIFT,
152   PERF_SAMPLE_BRANCH_TYPE_SAVE = 1U << PERF_SAMPLE_BRANCH_TYPE_SAVE_SHIFT,
153   PERF_SAMPLE_BRANCH_HW_INDEX = 1U << PERF_SAMPLE_BRANCH_HW_INDEX_SHIFT,
154   PERF_SAMPLE_BRANCH_PRIV_SAVE = 1U << PERF_SAMPLE_BRANCH_PRIV_SAVE_SHIFT,
155   PERF_SAMPLE_BRANCH_MAX = 1U << PERF_SAMPLE_BRANCH_MAX_SHIFT,
156 };
157 enum {
158   PERF_BR_UNKNOWN = 0,
159   PERF_BR_COND = 1,
160   PERF_BR_UNCOND = 2,
161   PERF_BR_IND = 3,
162   PERF_BR_CALL = 4,
163   PERF_BR_IND_CALL = 5,
164   PERF_BR_RET = 6,
165   PERF_BR_SYSCALL = 7,
166   PERF_BR_SYSRET = 8,
167   PERF_BR_COND_CALL = 9,
168   PERF_BR_COND_RET = 10,
169   PERF_BR_ERET = 11,
170   PERF_BR_IRQ = 12,
171   PERF_BR_SERROR = 13,
172   PERF_BR_NO_TX = 14,
173   PERF_BR_EXTEND_ABI = 15,
174   PERF_BR_MAX,
175 };
176 enum {
177   PERF_BR_SPEC_NA = 0,
178   PERF_BR_SPEC_WRONG_PATH = 1,
179   PERF_BR_NON_SPEC_CORRECT_PATH = 2,
180   PERF_BR_SPEC_CORRECT_PATH = 3,
181   PERF_BR_SPEC_MAX,
182 };
183 enum {
184   PERF_BR_NEW_FAULT_ALGN = 0,
185   PERF_BR_NEW_FAULT_DATA = 1,
186   PERF_BR_NEW_FAULT_INST = 2,
187   PERF_BR_NEW_ARCH_1 = 3,
188   PERF_BR_NEW_ARCH_2 = 4,
189   PERF_BR_NEW_ARCH_3 = 5,
190   PERF_BR_NEW_ARCH_4 = 6,
191   PERF_BR_NEW_ARCH_5 = 7,
192   PERF_BR_NEW_MAX,
193 };
194 enum {
195   PERF_BR_PRIV_UNKNOWN = 0,
196   PERF_BR_PRIV_USER = 1,
197   PERF_BR_PRIV_KERNEL = 2,
198   PERF_BR_PRIV_HV = 3,
199 };
200 #define PERF_BR_ARM64_FIQ PERF_BR_NEW_ARCH_1
201 #define PERF_BR_ARM64_DEBUG_HALT PERF_BR_NEW_ARCH_2
202 #define PERF_BR_ARM64_DEBUG_EXIT PERF_BR_NEW_ARCH_3
203 #define PERF_BR_ARM64_DEBUG_INST PERF_BR_NEW_ARCH_4
204 #define PERF_BR_ARM64_DEBUG_DATA PERF_BR_NEW_ARCH_5
205 #define PERF_SAMPLE_BRANCH_PLM_ALL (PERF_SAMPLE_BRANCH_USER | PERF_SAMPLE_BRANCH_KERNEL | PERF_SAMPLE_BRANCH_HV)
206 enum perf_sample_regs_abi {
207   PERF_SAMPLE_REGS_ABI_NONE = 0,
208   PERF_SAMPLE_REGS_ABI_32 = 1,
209   PERF_SAMPLE_REGS_ABI_64 = 2,
210 };
211 enum {
212   PERF_TXN_ELISION = (1 << 0),
213   PERF_TXN_TRANSACTION = (1 << 1),
214   PERF_TXN_SYNC = (1 << 2),
215   PERF_TXN_ASYNC = (1 << 3),
216   PERF_TXN_RETRY = (1 << 4),
217   PERF_TXN_CONFLICT = (1 << 5),
218   PERF_TXN_CAPACITY_WRITE = (1 << 6),
219   PERF_TXN_CAPACITY_READ = (1 << 7),
220   PERF_TXN_MAX = (1 << 8),
221   PERF_TXN_ABORT_MASK = (0xffffffffULL << 32),
222   PERF_TXN_ABORT_SHIFT = 32,
223 };
224 enum perf_event_read_format {
225   PERF_FORMAT_TOTAL_TIME_ENABLED = 1U << 0,
226   PERF_FORMAT_TOTAL_TIME_RUNNING = 1U << 1,
227   PERF_FORMAT_ID = 1U << 2,
228   PERF_FORMAT_GROUP = 1U << 3,
229   PERF_FORMAT_LOST = 1U << 4,
230   PERF_FORMAT_MAX = 1U << 5,
231 };
232 #define PERF_ATTR_SIZE_VER0 64
233 #define PERF_ATTR_SIZE_VER1 72
234 #define PERF_ATTR_SIZE_VER2 80
235 #define PERF_ATTR_SIZE_VER3 96
236 #define PERF_ATTR_SIZE_VER4 104
237 #define PERF_ATTR_SIZE_VER5 112
238 #define PERF_ATTR_SIZE_VER6 120
239 #define PERF_ATTR_SIZE_VER7 128
240 struct perf_event_attr {
241   __u32 type;
242   __u32 size;
243   __u64 config;
244   union {
245     __u64 sample_period;
246     __u64 sample_freq;
247   };
248   __u64 sample_type;
249   __u64 read_format;
250   __u64 disabled : 1, inherit : 1, pinned : 1, exclusive : 1, exclude_user : 1, exclude_kernel : 1, exclude_hv : 1, exclude_idle : 1, mmap : 1, comm : 1, freq : 1, inherit_stat : 1, enable_on_exec : 1, task : 1, watermark : 1, precise_ip : 2, mmap_data : 1, sample_id_all : 1, exclude_host : 1, exclude_guest : 1, exclude_callchain_kernel : 1, exclude_callchain_user : 1, mmap2 : 1, comm_exec : 1, use_clockid : 1, context_switch : 1, write_backward : 1, namespaces : 1, ksymbol : 1, bpf_event : 1, aux_output : 1, cgroup : 1, text_poke : 1, build_id : 1, inherit_thread : 1, remove_on_exec : 1, sigtrap : 1, __reserved_1 : 26;
251   union {
252     __u32 wakeup_events;
253     __u32 wakeup_watermark;
254   };
255   __u32 bp_type;
256   union {
257     __u64 bp_addr;
258     __u64 kprobe_func;
259     __u64 uprobe_path;
260     __u64 config1;
261   };
262   union {
263     __u64 bp_len;
264     __u64 kprobe_addr;
265     __u64 probe_offset;
266     __u64 config2;
267   };
268   __u64 branch_sample_type;
269   __u64 sample_regs_user;
270   __u32 sample_stack_user;
271   __s32 clockid;
272   __u64 sample_regs_intr;
273   __u32 aux_watermark;
274   __u16 sample_max_stack;
275   __u16 __reserved_2;
276   __u32 aux_sample_size;
277   __u32 __reserved_3;
278   __u64 sig_data;
279 };
280 struct perf_event_query_bpf {
281   __u32 ids_len;
282   __u32 prog_cnt;
283   __u32 ids[];
284 };
285 #define PERF_EVENT_IOC_ENABLE _IO('$', 0)
286 #define PERF_EVENT_IOC_DISABLE _IO('$', 1)
287 #define PERF_EVENT_IOC_REFRESH _IO('$', 2)
288 #define PERF_EVENT_IOC_RESET _IO('$', 3)
289 #define PERF_EVENT_IOC_PERIOD _IOW('$', 4, __u64)
290 #define PERF_EVENT_IOC_SET_OUTPUT _IO('$', 5)
291 #define PERF_EVENT_IOC_SET_FILTER _IOW('$', 6, char *)
292 #define PERF_EVENT_IOC_ID _IOR('$', 7, __u64 *)
293 #define PERF_EVENT_IOC_SET_BPF _IOW('$', 8, __u32)
294 #define PERF_EVENT_IOC_PAUSE_OUTPUT _IOW('$', 9, __u32)
295 #define PERF_EVENT_IOC_QUERY_BPF _IOWR('$', 10, struct perf_event_query_bpf *)
296 #define PERF_EVENT_IOC_MODIFY_ATTRIBUTES _IOW('$', 11, struct perf_event_attr *)
297 enum perf_event_ioc_flags {
298   PERF_IOC_FLAG_GROUP = 1U << 0,
299 };
300 struct perf_event_mmap_page {
301   __u32 version;
302   __u32 compat_version;
303   __u32 lock;
304   __u32 index;
305   __s64 offset;
306   __u64 time_enabled;
307   __u64 time_running;
308   union {
309     __u64 capabilities;
310     struct {
311       __u64 cap_bit0 : 1, cap_bit0_is_deprecated : 1, cap_user_rdpmc : 1, cap_user_time : 1, cap_user_time_zero : 1, cap_user_time_short : 1, cap_____res : 58;
312     };
313   };
314   __u16 pmc_width;
315   __u16 time_shift;
316   __u32 time_mult;
317   __u64 time_offset;
318   __u64 time_zero;
319   __u32 size;
320   __u32 __reserved_1;
321   __u64 time_cycles;
322   __u64 time_mask;
323   __u8 __reserved[116 * 8];
324   __u64 data_head;
325   __u64 data_tail;
326   __u64 data_offset;
327   __u64 data_size;
328   __u64 aux_head;
329   __u64 aux_tail;
330   __u64 aux_offset;
331   __u64 aux_size;
332 };
333 #define PERF_RECORD_MISC_CPUMODE_MASK (7 << 0)
334 #define PERF_RECORD_MISC_CPUMODE_UNKNOWN (0 << 0)
335 #define PERF_RECORD_MISC_KERNEL (1 << 0)
336 #define PERF_RECORD_MISC_USER (2 << 0)
337 #define PERF_RECORD_MISC_HYPERVISOR (3 << 0)
338 #define PERF_RECORD_MISC_GUEST_KERNEL (4 << 0)
339 #define PERF_RECORD_MISC_GUEST_USER (5 << 0)
340 #define PERF_RECORD_MISC_PROC_MAP_PARSE_TIMEOUT (1 << 12)
341 #define PERF_RECORD_MISC_MMAP_DATA (1 << 13)
342 #define PERF_RECORD_MISC_COMM_EXEC (1 << 13)
343 #define PERF_RECORD_MISC_FORK_EXEC (1 << 13)
344 #define PERF_RECORD_MISC_SWITCH_OUT (1 << 13)
345 #define PERF_RECORD_MISC_EXACT_IP (1 << 14)
346 #define PERF_RECORD_MISC_SWITCH_OUT_PREEMPT (1 << 14)
347 #define PERF_RECORD_MISC_MMAP_BUILD_ID (1 << 14)
348 #define PERF_RECORD_MISC_EXT_RESERVED (1 << 15)
349 struct perf_event_header {
350   __u32 type;
351   __u16 misc;
352   __u16 size;
353 };
354 struct perf_ns_link_info {
355   __u64 dev;
356   __u64 ino;
357 };
358 enum {
359   NET_NS_INDEX = 0,
360   UTS_NS_INDEX = 1,
361   IPC_NS_INDEX = 2,
362   PID_NS_INDEX = 3,
363   USER_NS_INDEX = 4,
364   MNT_NS_INDEX = 5,
365   CGROUP_NS_INDEX = 6,
366   NR_NAMESPACES,
367 };
368 enum perf_event_type {
369   PERF_RECORD_MMAP = 1,
370   PERF_RECORD_LOST = 2,
371   PERF_RECORD_COMM = 3,
372   PERF_RECORD_EXIT = 4,
373   PERF_RECORD_THROTTLE = 5,
374   PERF_RECORD_UNTHROTTLE = 6,
375   PERF_RECORD_FORK = 7,
376   PERF_RECORD_READ = 8,
377   PERF_RECORD_SAMPLE = 9,
378   PERF_RECORD_MMAP2 = 10,
379   PERF_RECORD_AUX = 11,
380   PERF_RECORD_ITRACE_START = 12,
381   PERF_RECORD_LOST_SAMPLES = 13,
382   PERF_RECORD_SWITCH = 14,
383   PERF_RECORD_SWITCH_CPU_WIDE = 15,
384   PERF_RECORD_NAMESPACES = 16,
385   PERF_RECORD_KSYMBOL = 17,
386   PERF_RECORD_BPF_EVENT = 18,
387   PERF_RECORD_CGROUP = 19,
388   PERF_RECORD_TEXT_POKE = 20,
389   PERF_RECORD_AUX_OUTPUT_HW_ID = 21,
390   PERF_RECORD_MAX,
391 };
392 enum perf_record_ksymbol_type {
393   PERF_RECORD_KSYMBOL_TYPE_UNKNOWN = 0,
394   PERF_RECORD_KSYMBOL_TYPE_BPF = 1,
395   PERF_RECORD_KSYMBOL_TYPE_OOL = 2,
396   PERF_RECORD_KSYMBOL_TYPE_MAX
397 };
398 #define PERF_RECORD_KSYMBOL_FLAGS_UNREGISTER (1 << 0)
399 enum perf_bpf_event_type {
400   PERF_BPF_EVENT_UNKNOWN = 0,
401   PERF_BPF_EVENT_PROG_LOAD = 1,
402   PERF_BPF_EVENT_PROG_UNLOAD = 2,
403   PERF_BPF_EVENT_MAX,
404 };
405 #define PERF_MAX_STACK_DEPTH 127
406 #define PERF_MAX_CONTEXTS_PER_STACK 8
407 enum perf_callchain_context {
408   PERF_CONTEXT_HV = (__u64) - 32,
409   PERF_CONTEXT_KERNEL = (__u64) - 128,
410   PERF_CONTEXT_USER = (__u64) - 512,
411   PERF_CONTEXT_GUEST = (__u64) - 2048,
412   PERF_CONTEXT_GUEST_KERNEL = (__u64) - 2176,
413   PERF_CONTEXT_GUEST_USER = (__u64) - 2560,
414   PERF_CONTEXT_MAX = (__u64) - 4095,
415 };
416 #define PERF_AUX_FLAG_TRUNCATED 0x01
417 #define PERF_AUX_FLAG_OVERWRITE 0x02
418 #define PERF_AUX_FLAG_PARTIAL 0x04
419 #define PERF_AUX_FLAG_COLLISION 0x08
420 #define PERF_AUX_FLAG_PMU_FORMAT_TYPE_MASK 0xff00
421 #define PERF_AUX_FLAG_CORESIGHT_FORMAT_CORESIGHT 0x0000
422 #define PERF_AUX_FLAG_CORESIGHT_FORMAT_RAW 0x0100
423 #define PERF_FLAG_FD_NO_GROUP (1UL << 0)
424 #define PERF_FLAG_FD_OUTPUT (1UL << 1)
425 #define PERF_FLAG_PID_CGROUP (1UL << 2)
426 #define PERF_FLAG_FD_CLOEXEC (1UL << 3)
427 #ifdef __LITTLE_ENDIAN_BITFIELD
428 union perf_mem_data_src {
429   __u64 val;
430   struct {
431     __u64 mem_op : 5, mem_lvl : 14, mem_snoop : 5, mem_lock : 2, mem_dtlb : 7, mem_lvl_num : 4, mem_remote : 1, mem_snoopx : 2, mem_blk : 3, mem_hops : 3, mem_rsvd : 18;
432   };
433 };
434 #elif defined(__BIG_ENDIAN_BITFIELD)
435 union perf_mem_data_src {
436   __u64 val;
437   struct {
438     __u64 mem_rsvd : 18, mem_hops : 3, mem_blk : 3, mem_snoopx : 2, mem_remote : 1, mem_lvl_num : 4, mem_dtlb : 7, mem_lock : 2, mem_snoop : 5, mem_lvl : 14, mem_op : 5;
439   };
440 };
441 #else
442 #error "Unknown endianness"
443 #endif
444 #define PERF_MEM_OP_NA 0x01
445 #define PERF_MEM_OP_LOAD 0x02
446 #define PERF_MEM_OP_STORE 0x04
447 #define PERF_MEM_OP_PFETCH 0x08
448 #define PERF_MEM_OP_EXEC 0x10
449 #define PERF_MEM_OP_SHIFT 0
450 #define PERF_MEM_LVL_NA 0x01
451 #define PERF_MEM_LVL_HIT 0x02
452 #define PERF_MEM_LVL_MISS 0x04
453 #define PERF_MEM_LVL_L1 0x08
454 #define PERF_MEM_LVL_LFB 0x10
455 #define PERF_MEM_LVL_L2 0x20
456 #define PERF_MEM_LVL_L3 0x40
457 #define PERF_MEM_LVL_LOC_RAM 0x80
458 #define PERF_MEM_LVL_REM_RAM1 0x100
459 #define PERF_MEM_LVL_REM_RAM2 0x200
460 #define PERF_MEM_LVL_REM_CCE1 0x400
461 #define PERF_MEM_LVL_REM_CCE2 0x800
462 #define PERF_MEM_LVL_IO 0x1000
463 #define PERF_MEM_LVL_UNC 0x2000
464 #define PERF_MEM_LVL_SHIFT 5
465 #define PERF_MEM_REMOTE_REMOTE 0x01
466 #define PERF_MEM_REMOTE_SHIFT 37
467 #define PERF_MEM_LVLNUM_L1 0x01
468 #define PERF_MEM_LVLNUM_L2 0x02
469 #define PERF_MEM_LVLNUM_L3 0x03
470 #define PERF_MEM_LVLNUM_L4 0x04
471 #define PERF_MEM_LVLNUM_CXL 0x09
472 #define PERF_MEM_LVLNUM_IO 0x0a
473 #define PERF_MEM_LVLNUM_ANY_CACHE 0x0b
474 #define PERF_MEM_LVLNUM_LFB 0x0c
475 #define PERF_MEM_LVLNUM_RAM 0x0d
476 #define PERF_MEM_LVLNUM_PMEM 0x0e
477 #define PERF_MEM_LVLNUM_NA 0x0f
478 #define PERF_MEM_LVLNUM_SHIFT 33
479 #define PERF_MEM_SNOOP_NA 0x01
480 #define PERF_MEM_SNOOP_NONE 0x02
481 #define PERF_MEM_SNOOP_HIT 0x04
482 #define PERF_MEM_SNOOP_MISS 0x08
483 #define PERF_MEM_SNOOP_HITM 0x10
484 #define PERF_MEM_SNOOP_SHIFT 19
485 #define PERF_MEM_SNOOPX_FWD 0x01
486 #define PERF_MEM_SNOOPX_PEER 0x02
487 #define PERF_MEM_SNOOPX_SHIFT 38
488 #define PERF_MEM_LOCK_NA 0x01
489 #define PERF_MEM_LOCK_LOCKED 0x02
490 #define PERF_MEM_LOCK_SHIFT 24
491 #define PERF_MEM_TLB_NA 0x01
492 #define PERF_MEM_TLB_HIT 0x02
493 #define PERF_MEM_TLB_MISS 0x04
494 #define PERF_MEM_TLB_L1 0x08
495 #define PERF_MEM_TLB_L2 0x10
496 #define PERF_MEM_TLB_WK 0x20
497 #define PERF_MEM_TLB_OS 0x40
498 #define PERF_MEM_TLB_SHIFT 26
499 #define PERF_MEM_BLK_NA 0x01
500 #define PERF_MEM_BLK_DATA 0x02
501 #define PERF_MEM_BLK_ADDR 0x04
502 #define PERF_MEM_BLK_SHIFT 40
503 #define PERF_MEM_HOPS_0 0x01
504 #define PERF_MEM_HOPS_1 0x02
505 #define PERF_MEM_HOPS_2 0x03
506 #define PERF_MEM_HOPS_3 0x04
507 #define PERF_MEM_HOPS_SHIFT 43
508 #define PERF_MEM_S(a,s) (((__u64) PERF_MEM_ ##a ##_ ##s) << PERF_MEM_ ##a ##_SHIFT)
509 struct perf_branch_entry {
510   __u64 from;
511   __u64 to;
512   __u64 mispred : 1, predicted : 1, in_tx : 1, abort : 1, cycles : 16, type : 4, spec : 2, new_type : 4, priv : 3, reserved : 31;
513 };
514 union perf_sample_weight {
515   __u64 full;
516 #ifdef __LITTLE_ENDIAN_BITFIELD
517   struct {
518     __u32 var1_dw;
519     __u16 var2_w;
520     __u16 var3_w;
521   };
522 #elif defined(__BIG_ENDIAN_BITFIELD)
523   struct {
524     __u16 var3_w;
525     __u16 var2_w;
526     __u32 var1_dw;
527   };
528 #else
529 #error "Unknown endianness"
530 #endif
531 };
532 #endif
533