STRUCT CXL_MEM_QUERY_COMMANDS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct cxl_mem_query_commands(9) β€” Kernel API Manual, but make it make sense

okay so bestie, welcome to the struct cxl_mem_query_commands page, aka the Kernel API Manual entry you were definitely procrastinating on. this is the little struct that lets userspace be nosy (respectfully) about what commands the driver and hardware actually support. pull up a chair, grab a strawberry πŸ“, we're getting into it.


✨ NAME ✨

struct cxl_mem_query_commands β€” Query supported commands. that's it, that's the whole vibe. it queries, it reports back, it slays. πŸ’…


🌸 SYNOPSIS 🌸

struct cxl_mem_query_commands {
    __u32 n_commands;
    __u32 rsvd;
    struct cxl_command_info __user commands[];
 };

literally the whole struct right there, no cap. three fields, maximum main character energy. πŸ‘‘


πŸŽ€ Members πŸŽ€

  • n_commands β€” the in/out parameter, and she's doing the most. when n_commands is > 0, the driver will return min(num_support_commands, n_commands). when n_commands is 0, the driver will return the number of total supported commands. so like… she's a question and an answer depending on what you feed her. icon behavior honestly. πŸ¦‹
  • rsvd β€” Reserved for future use. she's just sitting there being mysterious, do not touch, do not ask, we don't know her yet. πŸ™ˆ
  • commands β€” Output array of supported commands. and listen, this is the part where you have to do your own homework: this array must be allocated by userspace to be at least min(num_support_commands, n_commands). the kernel is not allocating it for you, bestie, that's a you problem. 😭

πŸ’– Description πŸ’–

so what's the point of all this? it allows userspace to query the available commands supported by both the driver and the hardware. key word: both.

commands that aren't supported by either the driver, or the hardware, are not returned in the query. like, they simply do not get an invite to the function. not in the list, not in the group chat, nowhere. 🚫✨

ngl this is the important bit β€” you're not getting a "maybe" pile, you're getting a filtered guest list of things that genuinely work on both sides. plan accordingly. 🫢

🧚 Examples 🧚

here's how the girlies actually use it:

  • { .n_commands = 0 } // Get number of supported commands

yes, zero. setting it to 0 is the "hey how many of y'all are there" move. it's giving reconnaissance. πŸ”

  • { .n_commands = 15, .commands = buf } // Return first 15 (or less) supported commands

and here you're like "okay give me up to 15" β€” note the or less, because sometimes there just aren't 15 to give and that's fine, she's doing her best. 🌈

also: See struct cxl_command_info. go read that one next, it's the sequel and it's honestly a must. πŸ’œ


πŸ¦‹ SEE ALSO πŸ¦‹

  • Kernel file ./include/uapi/linux/cxl_mem.h UAPI(9)
  • struct cxl_command_info(9)
  • struct cxl_send_command(9)

okay that's the whole page, you ate that fr fr πŸ”₯. this lil drop came from the source path ./include/uapi/linux, dated October 2026, and the page itself is struct cxl_...ery_commands(9) β€” yes the name is truncated in the header, no we don't know why, and yes it's still iconic. mwah, go query some commands bestie πŸ’‹πŸŽ€

πŸ“¦ where this page comes from