STRUCT CXL_SEND_COMMAND(9)
π struct cxl_send_command(9) β bestie edition π
okay so this is a page straight out of the Kernel API Manual, and it's literally the blueprint for yeeting a command at a memory device. no cap, it's giving "userspace talks to hardware" and honestly? iconic. let's get into it π«Ά
β¨ NAME β¨
struct cxl_send_command β Send a command to a memory device.</p> that's it, that's the whole vibe. π
πΈ SYNOPSIS πΈ
here's the struct in all her glory, character for character, don't touch a single brace bestie:
struct cxl_send_command {
__u32 id;
__u32 flags;
union {
struct {
__u16 opcode;
__u16 rsvd;
} raw;
__u32 rsvd;
};
__u32 retval;
struct {
__u32 size;
__u32 rsvd;
__u64 payload;
} in;
struct {
__u32 size;
__u32 rsvd;
__u64 payload;
} out;
};
π¦ Members π¦
time for the member-by-member tour, lowkey my favorite part π
idβ the command you're sending to the memory device. and like, it must be one of the commands that the query command returned. no making up your own ids, bestie, that's not the move. πflagsβ flags for the command (input). π©{unnamed_union}β anonymous. she has no name but she's still main character energy. πrawβ special fields for raw commands. the β¨rawβ¨ girlies.raw.opcodeβ the opcode passed to hardware when you're using theRAWcommand. very direct, very "i'll handle it myself". π₯raw.rsvdβ must be zero. not optional, not a suggestion. zero. periodt.rsvdβ must be zero. yeah, same. zero it out. βretvalβ return value from the memory device (output). the device's lil text-back, if you will. π¬inβ parameters associated with input payload. what you're feeding her. πin.sizeβ size of the payload to provide to the device (input). πin.rsvdβ must be zero. (yes, again. i know. but rules are rules.) πin.payloadβ pointer to memory for payload input, and the payload is little endian. pointers and endianness, the classic combo. π§outβ parameters associated with output payload. what she's giving back to you. πout.sizeβ size of the payload received from the device (input/output). okay this one's a two-way street: userspace fills this in to let the driver know how much space was allocated for output, and then it gets populated by the driver to let userspace know how large the output payload actually was. she's doing double duty and she's slaying it. πout.rsvdβ must be zero. one more time for the people in the back. πout.payloadβ pointer to memory for payload output, payload is little endian. same endian energy asin.payload, we love consistency. π
π Description π
so this whole struct is the mechanism for userspace to send a command to the hardware for processing. that's the entire point. π―
the driver will do basic validation on the command sizes β key word basic, so don't get cocky. in some cases even the payload may be introspected. π
β οΈ bestie listen: userspace is required to allocate large enough buffers for size_out, which can be variable length in certain situations. variable length means you can't just eyeball it. allocate generously or perish. π
π SEE ALSO π
go read these next, fr fr:
- Kernel file
./include/uapi/linux/cxl_mem.hUAPI(9) struct cxl_command_info(9)struct cxl_mem_query_commands(9)
and that's the whole page, bestie!! π₯³ this absolute icon lives in ./include/uapi/linux, dated October 2026, and she slays every day. mwah π bye bestie, go zero those rsvd fields!! π¦β¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms