11
11
/**
12
12
* DOC: UAPI
13
13
*
14
- * Not all of all commands that the driver supports are always available for use
15
- * by userspace. Userspace must check the results from the QUERY command in
16
- * order to determine the live set of commands.
14
+ * Not all of the commands that the driver supports are available for use by
15
+ * userspace at all times. Userspace can check the result of the QUERY command
16
+ * to determine the live set of commands. Alternatively, it can issue the
17
+ * command and check for failure.
17
18
*/
18
19
19
20
#define CXL_MEM_QUERY_COMMANDS _IOR(0xCE, 1, struct cxl_mem_query_commands)
20
21
#define CXL_MEM_SEND_COMMAND _IOWR(0xCE, 2, struct cxl_send_command)
21
22
23
+ /*
24
+ * NOTE: New defines must be added to the end of the list to preserve
25
+ * compatibility because this enum is exported to user space.
26
+ */
22
27
#define CXL_CMDS \
23
28
___C(INVALID, "Invalid Command"), \
24
29
___C(IDENTIFY, "Identify Command"), \
@@ -68,6 +73,19 @@ static const struct {
68
73
* struct cxl_command_info - Command information returned from a query.
69
74
* @id: ID number for the command.
70
75
* @flags: Flags that specify command behavior.
76
+ *
77
+ * CXL_MEM_COMMAND_FLAG_USER_ENABLED
78
+ *
79
+ * The given command id is supported by the driver and is supported by
80
+ * a related opcode on the device.
81
+ *
82
+ * CXL_MEM_COMMAND_FLAG_EXCLUSIVE
83
+ *
84
+ * Requests with the given command id will terminate with EBUSY as the
85
+ * kernel actively owns management of the given resource. For example,
86
+ * the label-storage-area can not be written while the kernel is
87
+ * actively managing that space.
88
+ *
71
89
* @size_in: Expected input size, or ~0 if variable length.
72
90
* @size_out: Expected output size, or ~0 if variable length.
73
91
*
@@ -77,7 +95,7 @@ static const struct {
77
95
* bytes of output.
78
96
*
79
97
* - @id = 10
80
- * - @flags = 0
98
+ * - @flags = CXL_MEM_COMMAND_FLAG_ENABLED
81
99
* - @size_in = ~0
82
100
* - @size_out = 0
83
101
*
@@ -87,7 +105,9 @@ struct cxl_command_info {
87
105
__u32 id ;
88
106
89
107
__u32 flags ;
90
- #define CXL_MEM_COMMAND_FLAG_MASK GENMASK(0, 0)
108
+ #define CXL_MEM_COMMAND_FLAG_MASK GENMASK(1, 0)
109
+ #define CXL_MEM_COMMAND_FLAG_ENABLED BIT(0)
110
+ #define CXL_MEM_COMMAND_FLAG_EXCLUSIVE BIT(1)
91
111
92
112
__u32 size_in ;
93
113
__u32 size_out ;
0 commit comments