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
22#define CXL_CMDS \22#define CXL_CMDS \
23 ___C(INVALID, "Invalid Command"), \23 ___C(INVALID, "Invalid Command"), \
24 ___C(IDENTIFY, "Identify Command"), \24 ___C(IDENTIFY, "Identify Command"), \
25 ___C(RAW, "Raw device command"), \
25 ___C(MAX, "invalid / last command")26 ___C(MAX, "invalid / last command")
26 27
27#define ___C(a, b) CXL_MEM_COMMAND_ID_##a28#define ___C(a, b) CXL_MEM_COMMAND_ID_##a
@@ -115,6 +116,9 @@ struct cxl_mem_query_commands { · 87 unmodified lines
115 * @id: The command to send to the memory device. This must be one of the116 * @id: The command to send to the memory device. This must be one of the
116 * commands returned by the query command.117 * commands returned by the query command.
117 * @flags: Flags for the command (input).118 * @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.
118 * @rsvd: Must be zero.122 * @rsvd: Must be zero.
119 * @retval: Return value from the memory device (output).123 * @retval: Return value from the memory device (output).
120 * @in: Parameters associated with input payload.124 * @in: Parameters associated with input payload.
@@ -137,7 +141,13 @@ struct cxl_mem_query_commands { · 16 unmodified lines
137struct cxl_send_command {141struct cxl_send_command {
138 __u32 id;142 __u32 id;
139 __u32 flags;143 __u32 flags;
140 __u32 rsvd;144 union {
145 struct {
146 __u16 opcode;
147 __u16 rsvd;
148 } raw;
149 __u32 rsvd;
150 };
141 __u32 retval;151 __u32 retval;
142 152
143 struct {153 struct {