Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / include / uapi / linux / user_events.h
bloba03de03dccbcf4edac6e4efd0adffaf368af4966
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3 * Copyright (c) 2021-2022, Microsoft Corporation.
5 * Authors:
6 * Beau Belgrave <beaub@linux.microsoft.com>
7 */
8 #ifndef _UAPI_LINUX_USER_EVENTS_H
9 #define _UAPI_LINUX_USER_EVENTS_H
11 #include <linux/types.h>
12 #include <linux/ioctl.h>
14 #define USER_EVENTS_SYSTEM "user_events"
15 #define USER_EVENTS_MULTI_SYSTEM "user_events_multi"
16 #define USER_EVENTS_PREFIX "u:"
18 /* Create dynamic location entry within a 32-bit value */
19 #define DYN_LOC(offset, size) ((size) << 16 | (offset))
21 /* List of supported registration flags */
22 enum user_reg_flag {
23 /* Event will not delete upon last reference closing */
24 USER_EVENT_REG_PERSIST = 1U << 0,
26 /* Event will be allowed to have multiple formats */
27 USER_EVENT_REG_MULTI_FORMAT = 1U << 1,
29 /* This value or above is currently non-ABI */
30 USER_EVENT_REG_MAX = 1U << 2,
34 * Describes an event registration and stores the results of the registration.
35 * This structure is passed to the DIAG_IOCSREG ioctl, callers at a minimum
36 * must set the size and name_args before invocation.
38 struct user_reg {
40 /* Input: Size of the user_reg structure being used */
41 __u32 size;
43 /* Input: Bit in enable address to use */
44 __u8 enable_bit;
46 /* Input: Enable size in bytes at address */
47 __u8 enable_size;
49 /* Input: Flags to use, if any */
50 __u16 flags;
52 /* Input: Address to update when enabled */
53 __u64 enable_addr;
55 /* Input: Pointer to string with event name, description and flags */
56 __u64 name_args;
58 /* Output: Index of the event to use when writing data */
59 __u32 write_index;
60 } __attribute__((__packed__));
63 * Describes an event unregister, callers must set the size, address and bit.
64 * This structure is passed to the DIAG_IOCSUNREG ioctl to disable bit updates.
66 struct user_unreg {
67 /* Input: Size of the user_unreg structure being used */
68 __u32 size;
70 /* Input: Bit to unregister */
71 __u8 disable_bit;
73 /* Input: Reserved, set to 0 */
74 __u8 __reserved;
76 /* Input: Reserved, set to 0 */
77 __u16 __reserved2;
79 /* Input: Address to unregister */
80 __u64 disable_addr;
81 } __attribute__((__packed__));
83 #define DIAG_IOC_MAGIC '*'
85 /* Request to register a user_event */
86 #define DIAG_IOCSREG _IOWR(DIAG_IOC_MAGIC, 0, struct user_reg *)
88 /* Request to delete a user_event */
89 #define DIAG_IOCSDEL _IOW(DIAG_IOC_MAGIC, 1, char *)
91 /* Requests to unregister a user_event */
92 #define DIAG_IOCSUNREG _IOW(DIAG_IOC_MAGIC, 2, struct user_unreg*)
94 #endif /* _UAPI_LINUX_USER_EVENTS_H */