include/uapi/linux/cxl_mem.h

Source file repositories/reference/linux-study-clean/include/uapi/linux/cxl_mem.h

File Facts

System
Linux kernel
Corpus path
include/uapi/linux/cxl_mem.h
Extension
.h
Size
8160 bytes
Lines
234
Domain
Core OS
Bucket
Core Kernel Interface
Inferred role
Core OS: implementation source
Status
source implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

struct cxl_command_info {
	__u32 id;

	__u32 flags;
#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;
};

/**
 * struct cxl_mem_query_commands - Query supported commands.
 * @n_commands: In/out parameter. When @n_commands is > 0, the driver will
 *		return min(num_support_commands, n_commands). When @n_commands
 *		is 0, driver will return the number of total supported commands.
 * @rsvd: Reserved for future use.
 * @commands: Output array of supported commands. This array must be allocated
 *            by userspace to be at least min(num_support_commands, @n_commands)
 *
 * Allow userspace to query the available commands supported by both the driver,
 * and the hardware. Commands that aren't supported by either the driver, or the
 * hardware are not returned in the query.
 *
 * Examples:
 *
 *  - { .n_commands = 0 } // Get number of supported commands
 *  - { .n_commands = 15, .commands = buf } // Return first 15 (or less)
 *    supported commands
 *
 *  See struct cxl_command_info.
 */
struct cxl_mem_query_commands {
	/*
	 * Input: Number of commands to return (space allocated by user)
	 * Output: Number of commands supported by the driver/hardware
	 *
	 * If n_commands is 0, kernel will only return number of commands and
	 * not try to populate commands[], thus allowing userspace to know how
	 * much space to allocate
	 */
	__u32 n_commands;
	__u32 rsvd;

	struct cxl_command_info __user commands[]; /* out: supported commands */
};

/**
 * struct cxl_send_command - Send a command to a memory device.
 * @id: The command to send to the memory device. This must be one of the
 *	commands returned by the query command.
 * @flags: Flags for the command (input).
 * @raw: Special fields for raw commands
 * @raw.opcode: Opcode passed to hardware when using the RAW command.
 * @raw.rsvd: Must be zero.
 * @rsvd: Must be zero.
 * @retval: Return value from the memory device (output).
 * @in: Parameters associated with input payload.
 * @in.size: Size of the payload to provide to the device (input).
 * @in.rsvd: Must be zero.
 * @in.payload: Pointer to memory for payload input, payload is little endian.
 * @out: Parameters associated with output payload.
 * @out.size: Size of the payload received from the device (input/output). This
 *	      field is filled in by userspace to let the driver know how much
 *	      space was allocated for output. It is populated by the driver to
 *	      let userspace know how large the output payload actually was.
 * @out.rsvd: Must be zero.
 * @out.payload: Pointer to memory for payload output, payload is little endian.
 *
 * Mechanism for userspace to send a command to the hardware for processing. The
 * driver will do basic validation on the command sizes. In some cases even the
 * payload may be introspected. Userspace is required to allocate large enough
 * buffers for size_out which can be variable length in certain situations.
 */
struct cxl_send_command {
	__u32 id;
	__u32 flags;
	union {
		struct {
			__u16 opcode;
			__u16 rsvd;
		} raw;
		__u32 rsvd;
	};
	__u32 retval;

	struct {
		__u32 size;
		__u32 rsvd;

Annotation

Implementation Notes