cxl/mbox: Add Clear Log mailbox command
authorSrinivasulu Thanneeru <sthanneeru.opensrc@micron.com>
Wed, 13 Mar 2024 07:12:18 +0000 (12:42 +0530)
committerDave Jiang <dave.jiang@intel.com>
Tue, 30 Apr 2024 15:48:10 +0000 (08:48 -0700)
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 <sthanneeru.opensrc@micron.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20240313071218.729-3-sthanneeru.opensrc@micron.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
drivers/cxl/core/mbox.c
drivers/cxl/cxlmem.h
include/uapi/linux/cxl_mem.h

index dbfee67b6319ff413d6d6896081c85ce6c4686c7..0c6216d1c58641798fb1a6038b626690f4088f46 100644 (file)
@@ -57,6 +57,7 @@ static struct cxl_mem_command cxl_mem_commands[CXL_MEM_COMMAND_ID_MAX] = {
        CXL_CMD(GET_HEALTH_INFO, 0, 0x12, 0),
        CXL_CMD(GET_LOG, 0x18, CXL_VARIABLE_PAYLOAD, CXL_CMD_FLAG_FORCE_ENABLE),
        CXL_CMD(GET_LOG_CAPS, 0x10, 0x4, 0),
+       CXL_CMD(CLEAR_LOG, 0x10, 0, 0),
        CXL_CMD(GET_SUP_LOG_SUBLIST, 0x2, CXL_VARIABLE_PAYLOAD, 0),
        CXL_CMD(SET_PARTITION_INFO, 0x0a, 0, 0),
        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)
                        return false;
                break;
        }
+       case CXL_MBOX_OP_CLEAR_LOG: {
+               const uuid_t *uuid = (uuid_t *)payload_in;
+
+               /*
+                * Restrict the ‘Clear log’ action to only apply to
+                * Vendor debug logs.
+                */
+               return uuid_equal(uuid, &DEFINE_CXL_VENDOR_DEBUG_UUID);
+       }
        default:
                break;
        }
index 39e06bf45a4371001ab22dad13a055d9f5c58934..19aba81cdf13208d525a8b28443007b979b1adbb 100644 (file)
@@ -528,6 +528,7 @@ enum cxl_opcode {
        CXL_MBOX_OP_GET_SUPPORTED_LOGS  = 0x0400,
        CXL_MBOX_OP_GET_LOG             = 0x0401,
        CXL_MBOX_OP_GET_LOG_CAPS        = 0x0402,
+       CXL_MBOX_OP_CLEAR_LOG           = 0x0403,
        CXL_MBOX_OP_GET_SUP_LOG_SUBLIST = 0x0405,
        CXL_MBOX_OP_IDENTIFY            = 0x4000,
        CXL_MBOX_OP_GET_PARTITION_INFO  = 0x4100,
index 49c25056c2225ab9a4b1369ef43077d5b29a6959..c6c0fe27495d31f25e99fb74818ea2b9c1dbbda7 100644 (file)
@@ -48,6 +48,7 @@
        ___DEPRECATED(GET_SCAN_MEDIA, "Get Scan Media Results"),          \
        ___C(GET_TIMESTAMP, "Get Timestamp"),                             \
        ___C(GET_LOG_CAPS, "Get Log Capabilities"),                       \
+       ___C(CLEAR_LOG, "Clear Log"),                                     \
        ___C(GET_SUP_LOG_SUBLIST, "Get Supported Logs Sub-List"),         \
        ___C(MAX, "invalid / last command")