The CXL subsystem is adding formal mechanisms for managing device poison. Minimize the maintenance burden going forward, and maximize the investment in common tooling by deprecating direct user access to poison commands outside of CXL_MEM_RAW_COMMANDS debug scenarios. A new cxl_deprecated_commands[] list is created for querying which command ids defined in previous kernels are now deprecated. CXL Media and Poison Management commands, opcodes 0x43XX, defined in CXL 3.0 Spec, Table 8-93 are deprecated with one exception: Get Scan Media Capabilities. Keep Get Scan Media Capabilities as it simply provides information and has no impact on the device state. Effectively all of the commands defined in: commit 87815ee9d006 ("cxl/pci: Add media provisioning required commands") ...were defined prematurely and should have waited until the kernel implementation was decided. To my knowledge there are no shipping devices with poison support and no known tools that would regress with this change.
Showing the changes to include/uapi (1 of 2 files). Show all
Unified · Split
| @@ -40,19 +40,22 @@ · 39 unmodified lines | |||
| 40 | ___C(SET_ALERT_CONFIG, "Set Alert Configuration"), \ | 40 | ___C(SET_ALERT_CONFIG, "Set Alert Configuration"), \ |
| 41 | ___C(GET_SHUTDOWN_STATE, "Get Shutdown State"), \ | 41 | ___C(GET_SHUTDOWN_STATE, "Get Shutdown State"), \ |
| 42 | ___C(SET_SHUTDOWN_STATE, "Set Shutdown State"), \ | 42 | ___C(SET_SHUTDOWN_STATE, "Set Shutdown State"), \ |
| 43 | ___C(GET_POISON, "Get Poison List"), \ | 43 | ___DEPRECATED(GET_POISON, "Get Poison List"), \ |
| 44 | ___C(INJECT_POISON, "Inject Poison"), \ | 44 | ___DEPRECATED(INJECT_POISON, "Inject Poison"), \ |
| 45 | ___C(CLEAR_POISON, "Clear Poison"), \ | 45 | ___DEPRECATED(CLEAR_POISON, "Clear Poison"), \ |
| 46 | ___C(GET_SCAN_MEDIA_CAPS, "Get Scan Media Capabilities"), \ | 46 | ___C(GET_SCAN_MEDIA_CAPS, "Get Scan Media Capabilities"), \ |
| 47 | ___C(SCAN_MEDIA, "Scan Media"), \ | 47 | ___DEPRECATED(SCAN_MEDIA, "Scan Media"), \ |
| 48 | ___C(GET_SCAN_MEDIA, "Get Scan Media Results"), \ | 48 | ___DEPRECATED(GET_SCAN_MEDIA, "Get Scan Media Results"), \ |
| 49 | ___C(MAX, "invalid / last command") | 49 | ___C(MAX, "invalid / last command") |
| 50 | 50 | ||
| 51 | #define ___C(a, b) CXL_MEM_COMMAND_ID_##a | 51 | #define ___C(a, b) CXL_MEM_COMMAND_ID_##a |
| 52 | #define ___DEPRECATED(a, b) CXL_MEM_DEPRECATED_ID_##a | ||
| 52 | enum { CXL_CMDS }; | 53 | enum { CXL_CMDS }; |
| 53 | 54 | ||
| 54 | #undef ___C | 55 | #undef ___C |
| 56 | #undef ___DEPRECATED | ||
| 55 | #define ___C(a, b) { b } | 57 | #define ___C(a, b) { b } |
| 58 | #define ___DEPRECATED(a, b) { "Deprecated " b } | ||
| 56 | static const struct { | 59 | static const struct { |
| 57 | const char *name; | 60 | const char *name; |
| 58 | } cxl_command_names[] __attribute__((__unused__)) = { CXL_CMDS }; | 61 | } cxl_command_names[] __attribute__((__unused__)) = { CXL_CMDS }; |
| @@ -68,6 +71,28 @@ static const struct { · 9 unmodified lines | |||
| 68 | */ | 71 | */ |
| 69 | 72 | ||
| 70 | #undef ___C | 73 | #undef ___C |
| 74 | #undef ___DEPRECATED | ||
| 75 | #define ___C(a, b) (0) | ||
| 76 | #define ___DEPRECATED(a, b) (1) | ||
| 77 | |||
| 78 | static const __u8 cxl_deprecated_commands[] | ||
| 79 | __attribute__((__unused__)) = { CXL_CMDS }; | ||
| 80 | |||
| 81 | /* | ||
| 82 | * Here's how this actually breaks out: | ||
| 83 | * cxl_deprecated_commands[] = { | ||
| 84 | * [CXL_MEM_COMMAND_ID_INVALID] = 0, | ||
| 85 | * [CXL_MEM_COMMAND_ID_IDENTIFY] = 0, | ||
| 86 | * ... | ||
| 87 | * [CXL_MEM_DEPRECATED_ID_GET_POISON] = 1, | ||
| 88 | * [CXL_MEM_DEPRECATED_ID_INJECT_POISON] = 1, | ||
| 89 | * [CXL_MEM_DEPRECATED_ID_CLEAR_POISON] = 1, | ||
| 90 | * ... | ||
| 91 | * }; | ||
| 92 | */ | ||
| 93 | |||
| 94 | #undef ___C | ||
| 95 | #undef ___DEPRECATED | ||
| 71 | 96 | ||
| 72 | /** | 97 | /** |
| 73 | * struct cxl_command_info - Command information returned from a query. | 98 | * struct cxl_command_info - Command information returned from a query. |