]> www.infradead.org Git - users/mchehab/rasdaemon.git/commitdiff
rasdaemon: cxl: Fix logging of memory event type of DRAM trace event
authorShiju Jose <shiju.jose@huawei.com>
Fri, 1 Nov 2024 16:38:26 +0000 (16:38 +0000)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mon, 10 Mar 2025 10:22:42 +0000 (11:22 +0100)
CXL spec rev 3.0 section 8.2.9.2.1.2 defines the DRAM Event Record.

Fix logging of memory event type field of DRAM trace event.
For e.g. if value is 0x1 it will be reported as an Invalid Address
(General Media Event Record - Memory Event Type) instead of Scrub Media
ECC Error (DRAM Event Record - Memory Event Type) and so on.

Fixes: 9a2f6186db26 ("rasdaemon: Add support for the CXL dram events")
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

index bd6b4fa7f09fceeed6a4074b4ea75718b00a6b44..4ba4491702d3f40378ce634b8b95148481c96d0a 100644 (file)
@@ -899,6 +899,13 @@ int ras_cxl_general_media_event_handler(struct trace_seq *s,
 #define CXL_DER_VALID_COLUMN                   BIT(6)
 #define CXL_DER_VALID_CORRECTION_MASK          BIT(7)
 
+static const char * const cxl_der_mem_event_type[] = {
+       "Media ECC Error",
+       "Scrub Media ECC Error",
+       "Invalid Address",
+       "Data Path Error",
+};
+
 int ras_cxl_dram_event_handler(struct trace_seq *s,
                               struct tep_record *record,
                               struct tep_event *event, void *context)
@@ -945,9 +952,9 @@ int ras_cxl_dram_event_handler(struct trace_seq *s,
        if (tep_get_field_val(s,  event, "type", record, &val, 1) < 0)
                return -1;
        ev.type = val;
-       if (trace_seq_printf(s, "type:%s ",
-                            get_cxl_type_str(cxl_gmer_mem_event_type,
-                                             ARRAY_SIZE(cxl_gmer_mem_event_type),
+       if (trace_seq_printf(s, "memory_event_type:%s ",
+                            get_cxl_type_str(cxl_der_mem_event_type,
+                                             ARRAY_SIZE(cxl_der_mem_event_type),
                                              ev.type)) <= 0)
                return -1;