Merge branch 'for-6.3/cxl' into cxl/next

Pick up some final miscellaneous updates for v6.3 including support for
communicating 'exclusive' and 'enabled' state of commands.
This commit is contained in:
Dan Williams 2023-02-10 18:05:59 -08:00
commit dfd423e0a3
4 changed files with 33 additions and 9 deletions

View file

@ -11,14 +11,19 @@
/**
* DOC: UAPI
*
* Not all of all commands that the driver supports are always available for use
* by userspace. Userspace must check the results from the QUERY command in
* order to determine the live set of commands.
* Not all of the commands that the driver supports are available for use by
* userspace at all times. Userspace can check the result of the QUERY command
* to determine the live set of commands. Alternatively, it can issue the
* command and check for failure.
*/
#define CXL_MEM_QUERY_COMMANDS _IOR(0xCE, 1, struct cxl_mem_query_commands)
#define CXL_MEM_SEND_COMMAND _IOWR(0xCE, 2, struct cxl_send_command)
/*
* NOTE: New defines must be added to the end of the list to preserve
* compatibility because this enum is exported to user space.
*/
#define CXL_CMDS \
___C(INVALID, "Invalid Command"), \
___C(IDENTIFY, "Identify Command"), \
@ -68,6 +73,19 @@ static const struct {
* struct cxl_command_info - Command information returned from a query.
* @id: ID number for the command.
* @flags: Flags that specify command behavior.
*
* CXL_MEM_COMMAND_FLAG_USER_ENABLED
*
* The given command id is supported by the driver and is supported by
* a related opcode on the device.
*
* CXL_MEM_COMMAND_FLAG_EXCLUSIVE
*
* Requests with the given command id will terminate with EBUSY as the
* kernel actively owns management of the given resource. For example,
* the label-storage-area can not be written while the kernel is
* actively managing that space.
*
* @size_in: Expected input size, or ~0 if variable length.
* @size_out: Expected output size, or ~0 if variable length.
*
@ -77,7 +95,7 @@ static const struct {
* bytes of output.
*
* - @id = 10
* - @flags = 0
* - @flags = CXL_MEM_COMMAND_FLAG_ENABLED
* - @size_in = ~0
* - @size_out = 0
*
@ -87,7 +105,9 @@ struct cxl_command_info {
__u32 id;
__u32 flags;
#define CXL_MEM_COMMAND_FLAG_MASK GENMASK(0, 0)
#define CXL_MEM_COMMAND_FLAG_MASK GENMASK(1, 0)
#define CXL_MEM_COMMAND_FLAG_ENABLED BIT(0)
#define CXL_MEM_COMMAND_FLAG_EXCLUSIVE BIT(1)
__u32 size_in;
__u32 size_out;