From 3936eff7790c9882cd8cb6bdc6f6e3543e25767e Mon Sep 17 00:00:00 2001 From: Shiju Jose Date: Fri, 1 Nov 2024 16:38:26 +0000 Subject: [PATCH] rasdaemon: cxl: Fix logging of memory event type of DRAM trace event 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 Signed-off-by: Shiju Jose Signed-off-by: Mauro Carvalho Chehab --- ras-cxl-handler.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ras-cxl-handler.c b/ras-cxl-handler.c index bd6b4fa..4ba4491 100644 --- a/ras-cxl-handler.c +++ b/ras-cxl-handler.c @@ -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; -- 2.49.0