1111/**
1212 * DOC: UAPI
1313 *
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.
1718 */
1819
1920#define CXL_MEM_QUERY_COMMANDS _IOR(0xCE, 1, struct cxl_mem_query_commands)
2021#define CXL_MEM_SEND_COMMAND _IOWR(0xCE, 2, struct cxl_send_command)
2122
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+ */
2227#define CXL_CMDS \
2328 ___C(INVALID, "Invalid Command"), \
2429 ___C(IDENTIFY, "Identify Command"), \
@@ -68,6 +73,19 @@ static const struct {
6873 * struct cxl_command_info - Command information returned from a query.
6974 * @id: ID number for the command.
7075 * @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+ *
7189 * @size_in: Expected input size, or ~0 if variable length.
7290 * @size_out: Expected output size, or ~0 if variable length.
7391 *
@@ -77,7 +95,7 @@ static const struct {
7795 * bytes of output.
7896 *
7997 * - @id = 10
80- * - @flags = 0
98+ * - @flags = CXL_MEM_COMMAND_FLAG_ENABLED
8199 * - @size_in = ~0
82100 * - @size_out = 0
83101 *
@@ -87,7 +105,9 @@ struct cxl_command_info {
87105 __u32 id ;
88106
89107 __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)
91111
92112 __u32 size_in ;
93113 __u32 size_out ;
0 commit comments