Skip to content

Commit 206f9fa

Browse files
Srinivasulu Thanneerudavejiang
authored andcommitted
cxl/mbox: Add Clear Log mailbox command
Adding UAPI support for CXL r3.1 8.2.9.5.4 Clear Log command. This proposed patch will be useful for clearing and populating the Vendor debug log in certain scenarios, allowing for the aggregation of results over time. Signed-off-by: Srinivasulu Thanneeru <[email protected]> Reviewed-by: Jonathan Cameron <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dave Jiang <[email protected]>
1 parent 940325a commit 206f9fa

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

drivers/cxl/core/mbox.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ static struct cxl_mem_command cxl_mem_commands[CXL_MEM_COMMAND_ID_MAX] = {
5757
CXL_CMD(GET_HEALTH_INFO, 0, 0x12, 0),
5858
CXL_CMD(GET_LOG, 0x18, CXL_VARIABLE_PAYLOAD, CXL_CMD_FLAG_FORCE_ENABLE),
5959
CXL_CMD(GET_LOG_CAPS, 0x10, 0x4, 0),
60+
CXL_CMD(CLEAR_LOG, 0x10, 0, 0),
6061
CXL_CMD(GET_SUP_LOG_SUBLIST, 0x2, CXL_VARIABLE_PAYLOAD, 0),
6162
CXL_CMD(SET_PARTITION_INFO, 0x0a, 0, 0),
6263
CXL_CMD(SET_LSA, CXL_VARIABLE_PAYLOAD, 0, 0),
@@ -333,6 +334,15 @@ static bool cxl_payload_from_user_allowed(u16 opcode, void *payload_in)
333334
return false;
334335
break;
335336
}
337+
case CXL_MBOX_OP_CLEAR_LOG: {
338+
const uuid_t *uuid = (uuid_t *)payload_in;
339+
340+
/*
341+
* Restrict the ‘Clear log’ action to only apply to
342+
* Vendor debug logs.
343+
*/
344+
return uuid_equal(uuid, &DEFINE_CXL_VENDOR_DEBUG_UUID);
345+
}
336346
default:
337347
break;
338348
}

drivers/cxl/cxlmem.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,7 @@ enum cxl_opcode {
528528
CXL_MBOX_OP_GET_SUPPORTED_LOGS = 0x0400,
529529
CXL_MBOX_OP_GET_LOG = 0x0401,
530530
CXL_MBOX_OP_GET_LOG_CAPS = 0x0402,
531+
CXL_MBOX_OP_CLEAR_LOG = 0x0403,
531532
CXL_MBOX_OP_GET_SUP_LOG_SUBLIST = 0x0405,
532533
CXL_MBOX_OP_IDENTIFY = 0x4000,
533534
CXL_MBOX_OP_GET_PARTITION_INFO = 0x4100,

include/uapi/linux/cxl_mem.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
___DEPRECATED(GET_SCAN_MEDIA, "Get Scan Media Results"), \
4949
___C(GET_TIMESTAMP, "Get Timestamp"), \
5050
___C(GET_LOG_CAPS, "Get Log Capabilities"), \
51+
___C(CLEAR_LOG, "Clear Log"), \
5152
___C(GET_SUP_LOG_SUBLIST, "Get Supported Logs Sub-List"), \
5253
___C(MAX, "invalid / last command")
5354

0 commit comments

Comments
 (0)