]> www.infradead.org Git - users/mchehab/rasdaemon.git/commitdiff
rasdaemon: cxl: Update common event to CXL spec rev 3.1
authorShiju Jose <shiju.jose@huawei.com>
Tue, 5 Nov 2024 17:51:29 +0000 (17:51 +0000)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mon, 10 Mar 2025 10:22:42 +0000 (11:22 +0100)
CXL spec 3.1 section 8.2.9.2.1 Table 8-42, Common Event Record format has
updated with Maintenance Operation Subclass information.

Add updates in rasdaemon CXL event handler for the above spec change
and for the corresponding changes in kernel CXL common trace event
implementation.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
ras-cxl-handler.c
ras-record.c
ras-record.h
ras-report.c

index ad8318f7479aa5064324139ed7a0eec890d51a1c..e34c4641762751e530c8e3cbd442e785f6202db6 100644 (file)
@@ -576,18 +576,20 @@ int ras_cxl_overflow_event_handler(struct trace_seq *s,
 
 /*
  * Common Event Record Format
- * CXL 3.0 section 8.2.9.2.1; Table 8-42
+ * CXL 3.1 section 8.2.9.2.1; Table 8-43
  */
 #define CXL_EVENT_RECORD_FLAG_PERMANENT                BIT(2)
 #define CXL_EVENT_RECORD_FLAG_MAINT_NEEDED     BIT(3)
 #define CXL_EVENT_RECORD_FLAG_PERF_DEGRADED    BIT(4)
 #define CXL_EVENT_RECORD_FLAG_HW_REPLACE       BIT(5)
+#define CXL_EVENT_RECORD_FLAG_MAINT_OP_SUB_CLASS_VALID BIT(6)
 
 static const struct  cxl_event_flags cxl_hdr_flags[] = {
        { .bit = CXL_EVENT_RECORD_FLAG_PERMANENT, .flag = "PERMANENT_CONDITION" },
        { .bit = CXL_EVENT_RECORD_FLAG_MAINT_NEEDED, .flag = "MAINTENANCE_NEEDED" },
        { .bit = CXL_EVENT_RECORD_FLAG_PERF_DEGRADED, .flag = "PERFORMANCE_DEGRADED" },
        { .bit = CXL_EVENT_RECORD_FLAG_HW_REPLACE, .flag = "HARDWARE_REPLACEMENT_NEEDED" },
+       { .bit = CXL_EVENT_RECORD_FLAG_MAINT_OP_SUB_CLASS_VALID, .flag = "MAINT_OP_SUB_CLASS_VALID" },
 };
 
 static int handle_ras_cxl_common_hdr(struct trace_seq *s,
@@ -671,6 +673,12 @@ static int handle_ras_cxl_common_hdr(struct trace_seq *s,
        if (trace_seq_printf(s, "hdr_maint_op_class:%u ", hdr->hdr_maint_op_class) <= 0)
                return -1;
 
+       if (tep_get_field_val(s,  event, "hdr_maint_op_sub_class", record, &val, 1) < 0)
+               return -1;
+       hdr->hdr_maint_op_sub_class = val;
+       if (trace_seq_printf(s, "hdr_maint_op_sub_class:%u ", hdr->hdr_maint_op_sub_class) <= 0)
+               return -1;
+
        return 0;
 }
 
index 3d95f973bc41e6f85a9328db0bd85169fc13cccd..f680ebeacea19e9e142ea4e03c1ceb136c316bad 100644 (file)
@@ -797,6 +797,7 @@ static int ras_store_cxl_common_hdr(sqlite3_stmt *stmt, struct ras_cxl_event_com
        sqlite3_bind_text(stmt, idx++, hdr->hdr_timestamp, -1, NULL);
        sqlite3_bind_int(stmt, idx++, hdr->hdr_length);
        sqlite3_bind_int(stmt, idx++, hdr->hdr_maint_op_class);
+       sqlite3_bind_int(stmt, idx++, hdr->hdr_maint_op_sub_class);
 
        return idx;
 }
@@ -818,6 +819,7 @@ static const struct db_fields cxl_generic_event_fields[] = {
        { .name = "hdr_ts",             .type = "TEXT" },
        { .name = "hdr_length",         .type = "INTEGER" },
        { .name = "hdr_maint_op_class", .type = "INTEGER" },
+       { .name = "hdr_maint_op_sub_class",     .type = "INTEGER" },
        { .name = "data",               .type = "BLOB" },
 };
 
@@ -874,6 +876,7 @@ static const struct db_fields cxl_general_media_event_fields[] = {
        { .name = "hdr_ts",             .type = "TEXT" },
        { .name = "hdr_length",         .type = "INTEGER" },
        { .name = "hdr_maint_op_class", .type = "INTEGER" },
+       { .name = "hdr_maint_op_sub_class",     .type = "INTEGER" },
        { .name = "dpa",                .type = "INTEGER" },
        { .name = "dpa_flags",          .type = "INTEGER" },
        { .name = "descriptor",         .type = "INTEGER" },
@@ -953,6 +956,7 @@ static const struct db_fields cxl_dram_event_fields[] = {
        { .name = "hdr_ts",             .type = "TEXT" },
        { .name = "hdr_length",         .type = "INTEGER" },
        { .name = "hdr_maint_op_class", .type = "INTEGER" },
+       { .name = "hdr_maint_op_sub_class",     .type = "INTEGER" },
        { .name = "dpa",                .type = "INTEGER" },
        { .name = "dpa_flags",          .type = "INTEGER" },
        { .name = "descriptor",         .type = "INTEGER" },
@@ -1039,6 +1043,7 @@ static const struct db_fields cxl_memory_module_event_fields[] = {
        { .name = "hdr_ts",             .type = "TEXT" },
        { .name = "hdr_length",         .type = "INTEGER" },
        { .name = "hdr_maint_op_class", .type = "INTEGER" },
+       { .name = "hdr_maint_op_sub_class",     .type = "INTEGER" },
        { .name = "event_type",         .type = "INTEGER" },
        { .name = "health_status",      .type = "INTEGER" },
        { .name = "media_status",       .type = "INTEGER" },
index cd549a1a28e7a820e165daa83e2bfea04ebf4380..2a0124ad0e92ce8e27ea83a60546de81484555c5 100644 (file)
@@ -179,6 +179,7 @@ struct ras_cxl_event_common_hdr {
        char hdr_timestamp[64];
        uint8_t hdr_length;
        uint8_t hdr_maint_op_class;
+       uint8_t hdr_maint_op_sub_class;
 };
 
 struct ras_cxl_generic_event {
index bc77d045885d4b98dc28822e43f2724bb726d52e..7e974b9538f0695b4faf90840e560eff60fa9208 100644 (file)
@@ -507,7 +507,8 @@ static int set_cxl_generic_event_backtrace(char *buf, struct ras_cxl_generic_eve
                "hdr_related_handle=0x%x\n"
                "hdr_timestamp=%s\n"
                "hdr_length=%u\n"
-               "hdr_maint_op_class=%u\n",
+               "hdr_maint_op_class=%u\n"
+               "hdr_maint_op_sub_class=%u\n",
                ev->hdr.timestamp,
                ev->hdr.memdev,
                ev->hdr.host,
@@ -519,7 +520,8 @@ static int set_cxl_generic_event_backtrace(char *buf, struct ras_cxl_generic_eve
                ev->hdr.hdr_related_handle,
                ev->hdr.hdr_timestamp,
                ev->hdr.hdr_length,
-               ev->hdr.hdr_maint_op_class);
+               ev->hdr.hdr_maint_op_class,
+               ev->hdr.hdr_maint_op_sub_class);
 
        return 0;
 }