History

cxl/mem: Add a "RAW" send command

The CXL memory device send interface will have a number of supported commands. The raw command is not such a command. Raw commands allow userspace to send a specified opcode to the underlying hardware and bypass all driver checks on the command. The primary use for this command is to [begrudgingly] allow undocumented vendor specific hardware commands. While not the main motivation, it also allows prototyping new hardware commands without a driver patch and rebuild. While this all sounds very powerful it comes with a couple of caveats: 1. Bug reports using raw commands will not get the same level of attention as bug reports using supported commands (via taint). 2. Supported commands will be rejected by the RAW command. With this comes new debugfs knob to allow full access to your toes with your weapon of choice.

Ben Widawsky committed 5 years ago

Commit 13237181 parent 583fa5e3 files · +161 −1Browse files

Showing the changes to include/uapi (1 of 3 files). Show all

Unified · Split

include/uapi/linux/cxl_mem.h+11−1
@@ -22,6 +22,7 @@ · 21 unmodified lines
2222 #define CXL_CMDS \
2323 ___C(INVALID, "Invalid Command"), \
2424 ___C(IDENTIFY, "Identify Command"), \
25+ ___C(RAW, "Raw device command"), \
2526 ___C(MAX, "invalid / last command")
2627
2728 #define ___C(a, b) CXL_MEM_COMMAND_ID_##a
@@ -115,6 +116,9 @@ struct cxl_mem_query_commands { · 87 unmodified lines
115116 * @id: The command to send to the memory device. This must be one of the
116117 * commands returned by the query command.
117118 * @flags: Flags for the command (input).
119+ * @raw: Special fields for raw commands
120+ * @raw.opcode: Opcode passed to hardware when using the RAW command.
121+ * @raw.rsvd: Must be zero.
118122 * @rsvd: Must be zero.
119123 * @retval: Return value from the memory device (output).
120124 * @in: Parameters associated with input payload.
@@ -137,7 +141,13 @@ struct cxl_mem_query_commands { · 16 unmodified lines
137141 struct cxl_send_command {
138142 __u32 id;
139143 __u32 flags;
140− __u32 rsvd;
144+ union {
145+ struct {
146+ __u16 opcode;
147+ __u16 rsvd;
148+ } raw;
149+ __u32 rsvd;
150+ };
141151 __u32 retval;
142152
143153 struct {