]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
cxl/events: Update Common Event Record to CXL spec rev 3.2
authorShiju Jose <shiju.jose@huawei.com>
Thu, 17 Jul 2025 10:18:14 +0000 (11:18 +0100)
committerDave Jiang <dave.jiang@intel.com>
Fri, 18 Jul 2025 15:19:56 +0000 (08:19 -0700)
CXL spec 3.2 section 8.2.10.2.1 Table 8-55, Common Event Record format
defined new fields LD-ID and Head ID.

LD-ID: ID of logical device from where the event originated, which is
valid only if LD-ID valid flag is set to 1.
CXL spec 3.2 Section 2.4 describes, a Type 3 Multi-Logical Device (MLD)
can partition its resources into up to 16 isolated Logical Devices.
Each Logical Device is identified by a Logical Device Identifier (LD-ID)
in CXL.mem and CXL.io protocols. LD-ID is a 16-bit Logical Device
identifier applicable for CXL.io and CXL.mem requests and responses.
CXL.mem supports only the lower 4 bits of LD-ID and therefore can support
up to 16 unique LD-ID values over the link. Requests and responses
forwarded over an MLD Port are tagged with LD-ID.

Head ID: ID of the device head, from where the event originated, which is
valid only if head valid flag is set to 1.

Add updates for the above spec changes in the CXL events record and CXL
common trace event implementation.

Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
Link: https://patch.msgid.link/20250717101817.2104-2-shiju.jose@huawei.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
drivers/cxl/core/trace.h
include/cxl/event.h

index 25ebfbc1616c4b171ba7786b23f5ac6c2e80c77f..a77487a257b33f62d3b0ddd9a719c076ea2a2ceb 100644 (file)
@@ -214,12 +214,16 @@ TRACE_EVENT(cxl_overflow,
 #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)
+#define CXL_EVENT_RECORD_FLAG_LD_ID_VALID      BIT(7)
+#define CXL_EVENT_RECORD_FLAG_HEAD_ID_VALID    BIT(8)
 #define show_hdr_flags(flags)  __print_flags(flags, " | ",                        \
        { CXL_EVENT_RECORD_FLAG_PERMANENT,      "PERMANENT_CONDITION"           }, \
        { CXL_EVENT_RECORD_FLAG_MAINT_NEEDED,   "MAINTENANCE_NEEDED"            }, \
        { CXL_EVENT_RECORD_FLAG_PERF_DEGRADED,  "PERFORMANCE_DEGRADED"          }, \
        { CXL_EVENT_RECORD_FLAG_HW_REPLACE,     "HARDWARE_REPLACEMENT_NEEDED"   },  \
-       { CXL_EVENT_RECORD_FLAG_MAINT_OP_SUB_CLASS_VALID,       "MAINT_OP_SUB_CLASS_VALID" }    \
+       { CXL_EVENT_RECORD_FLAG_MAINT_OP_SUB_CLASS_VALID,       "MAINT_OP_SUB_CLASS_VALID" }, \
+       { CXL_EVENT_RECORD_FLAG_LD_ID_VALID,    "LD_ID_VALID" }, \
+       { CXL_EVENT_RECORD_FLAG_HEAD_ID_VALID,  "HEAD_ID_VALID" } \
 )
 
 /*
@@ -247,7 +251,9 @@ TRACE_EVENT(cxl_overflow,
        __field(u64, hdr_timestamp)                             \
        __field(u8, hdr_length)                                 \
        __field(u8, hdr_maint_op_class)                         \
-       __field(u8, hdr_maint_op_sub_class)
+       __field(u8, hdr_maint_op_sub_class)                     \
+       __field(u16, hdr_ld_id)                                 \
+       __field(u8, hdr_head_id)
 
 #define CXL_EVT_TP_fast_assign(cxlmd, l, hdr)                                  \
        __assign_str(memdev);                           \
@@ -260,18 +266,22 @@ TRACE_EVENT(cxl_overflow,
        __entry->hdr_related_handle = le16_to_cpu((hdr).related_handle);        \
        __entry->hdr_timestamp = le64_to_cpu((hdr).timestamp);                  \
        __entry->hdr_maint_op_class = (hdr).maint_op_class;                     \
-       __entry->hdr_maint_op_sub_class = (hdr).maint_op_sub_class
+       __entry->hdr_maint_op_sub_class = (hdr).maint_op_sub_class;             \
+       __entry->hdr_ld_id = le16_to_cpu((hdr).ld_id);                          \
+       __entry->hdr_head_id = (hdr).head_id
 
 #define CXL_EVT_TP_printk(fmt, ...) \
        TP_printk("memdev=%s host=%s serial=%lld log=%s : time=%llu uuid=%pUb " \
                "len=%d flags='%s' handle=%x related_handle=%x "                \
-               "maint_op_class=%u maint_op_sub_class=%u : " fmt,               \
+               "maint_op_class=%u maint_op_sub_class=%u "                      \
+               "ld_id=%x head_id=%x : " fmt,                                   \
                __get_str(memdev), __get_str(host), __entry->serial,            \
                cxl_event_log_type_str(__entry->log),                           \
                __entry->hdr_timestamp, &__entry->hdr_uuid, __entry->hdr_length,\
                show_hdr_flags(__entry->hdr_flags), __entry->hdr_handle,        \
                __entry->hdr_related_handle, __entry->hdr_maint_op_class,       \
                __entry->hdr_maint_op_sub_class,        \
+               __entry->hdr_ld_id, __entry->hdr_head_id,                       \
                ##__VA_ARGS__)
 
 TRACE_EVENT(cxl_generic_event,
index f9ae1796da85fe544d71dc181b98431a0f19d601..f4cb8568566bd21b3235bd5c63c7ece505082428 100644 (file)
@@ -19,7 +19,9 @@ struct cxl_event_record_hdr {
        __le64 timestamp;
        u8 maint_op_class;
        u8 maint_op_sub_class;
-       u8 reserved[14];
+       __le16 ld_id;
+       u8 head_id;
+       u8 reserved[11];
 } __packed;
 
 struct cxl_event_media_hdr {