Add CPER logging support for CRI
Subsystems (2)
cover Add CPER logging support for CRI
This patch series adds CPER (Common Platform Error Record) logging support for Correctable errors reported by Intel Xe GPUs. CPER logging is done through trace event.
In subsequent patches will add CPER logging support for Un-correctable errors.
Do not review patch "drm/xe: Add error Signature IDs for RAS logging" as it is part of https://patchwork.freedesktop.org/series/168333/
Badal Nilawar (6):
drm/xe/xe_ras: Add support to retrieve info queue data for CRI drm/xe/xe_ras: Refactor get_counter() to return response structure drm/xe/cper: Add CPER structures and trace event drm/xe/cper: APIs to prepare and log CPER record drm/xe/cper: Prepare Intel CPER error info from info queue drm/xe/cper: Log CPER record for correctable errors
Mallesh Koujalagi (1):
drm/xe: Add error Signature IDs for RAS logging
drivers/gpu/drm/xe/Makefile | 2 + drivers/gpu/drm/xe/xe_cper.c | 215 ++++++++++++++ drivers/gpu/drm/xe/xe_cper.h | 30 ++ drivers/gpu/drm/xe/xe_cper_types.h | 186 ++++++++++++ drivers/gpu/drm/xe/xe_ras.c | 272 +++++++++++++++++- drivers/gpu/drm/xe/xe_ras_types.h | 122 +++++++- drivers/gpu/drm/xe/xe_sig_ids.h | 29 ++ drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h | 2 + drivers/gpu/drm/xe/xe_trace_cper.c | 9 + drivers/gpu/drm/xe/xe_trace_cper.h | 65 +++++ 10 files changed, 921 insertions(+), 11 deletions(-) create mode 100644 drivers/gpu/drm/xe/xe_cper.c create mode 100644 drivers/gpu/drm/xe/xe_cper.h create mode 100644 drivers/gpu/drm/xe/xe_cper_types.h create mode 100644 drivers/gpu/drm/xe/xe_sig_ids.h create mode 100644 drivers/gpu/drm/xe/xe_trace_cper.c create mode 100644 drivers/gpu/drm/xe/xe_trace_cper.h
Signature · 1 line
2.54.0
RFC PATCH 1/7 drm/xe: Add error Signature IDs for RAS logging
From: Mallesh Koujalagi <[email protected]>
Every GPU fault needs a stable numeric label so monitoring tools can identify what went wrong without parsing log text. Add xe_sig_ids.h which defines those labels, called SIG_IDs.
--- drivers/gpu/drm/xe/xe_sig_ids.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 drivers/gpu/drm/xe/xe_sig_ids.h
drivers/gpu/drm/xe/xe_sig_ids.h new file +29 -0
@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2026 Intel Corporation +*/ + +#ifndef _XE_SIG_IDS_H_ +#define _XE_SIG_IDS_H_ + +/* +* Driver SIG_IDs +*/ +#define XE_SIG_PROBE 1/* FATAL: probe failed */ +#define XE_SIG_WEDGED 2/* FATAL: device wedged */ +#define XE_SIG_SURVIVABILITY 3/* FATAL: survivability mode */ +#define XE_SIG_FW 4/* RECOVERABLE: GuC/HuC/UC/GSC/CSC/PCODE */ +#define XE_SIG_GT_TDR 5/* RECOVERABLE: engine hang / reset */ +#define XE_SIG_MEM_FAULT 6/* RECOVERABLE: VM bind, page fault, GTT */ +#define XE_SIG_IO_BUS 7/* RECOVERABLE: runtime PCIe/IOMMU/MMIO */ + +/* +* HW SIG_IDs +*/ +#define XE_SIG_HW_DEVICE_MEMORY 8/* Device memory errors (e.g. ECC) */ +#define XE_SIG_HW_CORE_COMPUTE 9/* Compute/shader core errors */ +#define XE_SIG_HW_PCIE 10/* PCIe interface errors */ +#define XE_SIG_HW_FABRIC 11/* On-package fabric errors */ +#define XE_SIG_HW_SOC_INTERNAL 12/* SoC-internal errors */ + +#endif /* _XE_SIG_IDS_H_ */
Signature · 1 line
2.54.0
RFC PATCH 2/7 drm/xe/xe_ras: Add support to retrieve info queue data for CRI
In reply to Badal NilawarAdd support to retrieve info queue data. It can be retrieved when has_info_queue=1 and RAS_INFO_QUEUE_FLAG_MORE_DATA is set in response of XE_SYSCTRL_CMD_GET_COUNTER.
--- drivers/gpu/drm/xe/xe_ras.c | 34 ++++++ drivers/gpu/drm/xe/xe_ras_types.h | 112 +++++++++++++++++- drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h | 2 + 3 files changed, 147 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_ras.c +34 -0
@@ -270,6 +270,40 @@ int xe_ras_clear_counter(struct xe_device *xe, u8 severity, u8 component)return 0 ; } +static int get_info_queue_data (struct xe_device *xe, +const struct xe_ras_get_info_queue_data_request *req, +struct xe_ras_get_info_queue_data_response *out) +{ +struct xe_ras_get_info_queue_data_response response = {0 }; +struct xe_sysctrl_mailbox_command command = {0 }; +size_t rlen; +int ret; + +xe_sysctrl_create_command (&command,XE_SYSCTRL_GROUP_GFSP , +XE_SYSCTRL_CMD_GET_INFO_QUEUE_DATA , + (void *)req,sizeof (*req), &response,sizeof (response)); + + ret =xe_sysctrl_send_command (&xe->sc, &command, &rlen); +if (ret) { +xe_err (xe,"sysctrl: failed to get info queue data %d\n" , ret); +return ret; + } + +if (rlen !=sizeof (response)) { +xe_err (xe,"sysctrl: unexpected get info queue data response length %zu (expected %zu)\n" , + rlen,sizeof (response)); +return -EIO ; + } + +xe_dbg (xe,"[RAS]: info queue data: status=%u chunk_size=%u flags=0x%x\n" , + response.operation_status, + response.queue_response.queue_header.chunk_size, + response.queue_response.queue_header.flags); + + *out = response; +return 0 ; +} +/** * xe_ras_init - Initialize Xe RAS * @xe: xe device instance
drivers/gpu/drm/xe/xe_ras_types.h +111 -1
128 lines not on this page · raw message
drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h +2 -0
@@ -25,11 +25,13 @@ enum xe_sysctrl_group {* @XE_SYSCTRL_CMD_GET_COUNTER: Get error counter value * @XE_SYSCTRL_CMD_CLEAR_COUNTER: Clear error counter value * @XE_SYSCTRL_CMD_GET_PENDING_EVENT: Retrieve pending event +* @XE_SYSCTRL_CMD_GET_INFO_QUEUE_DATA: Retrieve a chunk of info queue data */ enum xe_sysctrl_gfsp_cmd {XE_SYSCTRL_CMD_GET_COUNTER =0x03 ,XE_SYSCTRL_CMD_CLEAR_COUNTER =0x04 ,XE_SYSCTRL_CMD_GET_PENDING_EVENT =0x07 , +XE_SYSCTRL_CMD_GET_INFO_QUEUE_DATA =0x0D , };/**
Signature · 1 line
2.54.0
Re: [RFC PATCH 2/7] drm/xe/xe_ras: Add support to retrieve info queue data for CRI
Quoted 4 lines · Badal Nilawar
Add support to retrieve info queue data. It can be retrieved when has_info_queue=1 and
RAS_INFO_QUEUE_FLAG_MORE_DATAis set in response ofXE_SYSCTRL_CMD_GET_COUNTER.
nit: Please change commit message, we haven't checked has_info_queue=1
Quoted 14 lines
Signed-off-by Badal Nilawar<[email protected]>Assisted-by Copilot:claude-sonnet-4.6--- drivers/gpu/drm/xe/xe_ras.c | 34 ++++++ drivers/gpu/drm/xe/xe_ras_types.h | 112 +++++++++++++++++- drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h | 2 + 3 files changed, 147 insertions(+), 1 deletion(-)drivers/gpu/drm/xe/xe_ras.c +0
-0
drivers/gpu/drm/xe/xe_ras.c int xe_ras_clear_counter(struct xe_device *xe, u8 severity, u8 component) · line 276
Quoted 7 lines
drivers/gpu/drm/xe/xe_ras.c +4
-0@@ -270,6 +270,40 @@ int xe_ras_clear_counter(struct xe_device *xe, u8 severity, u8 component)return 0 ; } +static int get_info_queue_data (struct xe_device *xe, +const struct xe_ras_get_info_queue_data_request *req, +struct xe_ras_get_info_queue_data_response *out) +{
Why we need info queue data? When we are going to use info queue data?
Quoted 16 lines
drivers/gpu/drm/xe/xe_ras.c +16
-0+struct xe_ras_get_info_queue_data_response response = {0 }; +struct xe_sysctrl_mailbox_command command = {0 }; +size_t rlen; +int ret; + +xe_sysctrl_create_command (&command,XE_SYSCTRL_GROUP_GFSP , +XE_SYSCTRL_CMD_GET_INFO_QUEUE_DATA , + (void *)req,sizeof (*req), &response,sizeof (response)); + + ret =xe_sysctrl_send_command (&xe->sc, &command, &rlen); +if (ret) { +xe_err (xe,"sysctrl: failed to get info queue data %d\n" , ret); +return ret; + } + +if (rlen !=sizeof (response)) {
drivers/gpu/drm/xe/xe_ras.c int xe_ras_clear_counter(struct xe_device *xe, u8 severity, u8 component) · line 302
Quoted 10 lines
drivers/gpu/drm/xe/xe_ras.c +10
-0+xe_err (xe,"sysctrl: unexpected get info queue data response length %zu (expected %zu)\n" , + rlen,sizeof (response)); +return -EIO ; + } + +xe_dbg (xe,"[RAS]: info queue data: status=%u chunk_size=%u flags=0x%x\n" , + response.operation_status, + response.queue_response.queue_header.chunk_size, + response.queue_response.queue_header.flags); +
What happen when system control send corrupt data?
Quoted 12 lines
drivers/gpu/drm/xe/xe_ras.c +4
-0+ *out = response; +return 0 ; +} +/** * xe_ras_init - Initialize Xe RAS * @xe: xe device instance drivers/gpu/drm/xe/xe_ras_types.h +0
-0
drivers/gpu/drm/xe/xe_ras_types.h line 18
Quoted 10 lines
drivers/gpu/drm/xe/xe_ras_types.h +6
-0@@ -9,6 +9,12 @@#include <linux/types.h> #define XE_RAS_NUM_COUNTERS 16 +#define XE_RAS_INFO_QUEUE_MAX_CHUNK_SIZE 200 +#define XE_RAS_INFO_QUEUE_MAX_TOTAL_SIZE 5120 +#define XE_RAS_INFO_QUEUE_FLAG_AVAILABLE 0x01 +#define XE_RAS_INFO_QUEUE_FLAG_MORE_DATA 0x02 +#define XE_RAS_INFO_QUEUE_FLAG_OVERFLOW 0x04 +#define XE_RAS_INFO_QUEUE_FLAG_COMPRESSED 0x08
What is use of XE_RAS_INFO_QUEUE_FLAG_COMPRESSED? When we are using it?
Thanks,
-/Mallesh
Quoted 138 lines
drivers/gpu/drm/xe/xe_ras_types.h +105
-1/** * struct xe_ras_error_common - Error fields that are common across all products @@ -71,7 +77,64 @@ struct xe_ras_threshold_crossed { } __packed;/** -* struct xe_ras_get_counter_request - Request structure for get counter +* struct xe_ras_info_queue_header - Metadata for large info queue data transfers +* +* Provides chunk metadata for commands that support extended info queue +* functionality. Used when the total data exceeds a single mailbox response. +*/ +struct xe_ras_info_queue_header { +/** @total_size: Total size of the complete info queue data in bytes */ +u32 total_size; +/** @chunk_offset: Offset of this chunk within the total data in bytes */ +u32 chunk_offset; +/** @chunk_size: Size of the data in this chunk in bytes */ +u32 chunk_size; +/** @sequence_number: Sequence number for this chunk, starts at 0 */ +u32 sequence_number; +/** @flags: Info queue control flags (RAS_INFO_QUEUE_FLAG_*) */ +u32 flags:8 ; +/** @compression_type: Compression algorithm used; 0 = none */ +u32 compression_type:4 ; +/** @num_headers: Number of detailed counter headers at start of queue_data */ +u32 num_headers:5 ; +/** @reserved: Reserved for future use */ +u32 reserved:15 ; +/** @checksum: CRC32 checksum of this chunk data */ +u32 checksum; +} __packed; + +/** +* struct xe_ras_info_queue_request - Request for a specific chunk of info queue data +* +* Allows the driver to request continuation of large info queue transfers +* by specifying an offset and size within the full data set. +*/ +struct xe_ras_info_queue_request { +/** @requested_offset: Byte offset of the requested data chunk */ +u32 requested_offset; +/** @requested_size: Maximum size of the requested chunk in bytes */ +u32 requested_size; +/** @session_id: Session ID to correlate multi-chunk transfers */ +struct xe_ras_error_class session_id; +/** @reserved: Reserved for future use */ +u32 reserved; +} __packed; + +/** +* struct xe_ras_info_queue_response - Generic response for commands with info queues +* +* Standard response format for any command that returns an info queue +* payload. May be embedded in a command-specific response structure. +*/ +struct xe_ras_info_queue_response { +/** @queue_header: Info queue metadata for this chunk */ +struct xe_ras_info_queue_header queue_header; +/** @queue_data: Info queue data for this chunk */ +u8 queue_data[XE_RAS_INFO_QUEUE_MAX_CHUNK_SIZE ]; +} __packed; + +/** +* struct xe_ras_get_counter_request - Request for get error counter */ struct xe_ras_get_counter_request {/** @counter: Error counter to be queried */ @@ -121,4 +184,51 @@ struct xe_ras_clear_counter_response {/** @reserved1: Reserved for future use */ u32 reserved1[3]; } __packed; + +/** +* struct xe_ras_info_queue_dynamic_counter_hdr - Aggregate counter header entry +* +* When a session requests aggregate counter data, one header per matching +* dynamic counter class is prepended to the queue data. The @counter field +* indicates how many subsequent error log entries belong to this class. +*/ +struct xe_ras_info_queue_dynamic_counter_hdr { +/** @error_class: Error class associated with this counter group */ +struct xe_ras_error_class error_class; +/** @counter: Number of error log entries that follow for this class */ +u32 counter; +} __packed; + +/** +* struct xe_ras_error_log - Single error log entry following dynamic counter headers +*/ +struct xe_ras_error_log { +/** @timestamp: Timestamp when the error was recorded */ +u64 timestamp; +/** @error_details: Error-specific details */ +u32 error_details[16 ]; +} __packed; + +/** +* struct xe_ras_get_info_queue_data_request - Request for RAS_CMD_GET_INFO_QUEUE_DATA +*/ +struct xe_ras_get_info_queue_data_request { +/** @queue_request: Info queue request parameters */ +struct xe_ras_info_queue_request queue_request; +/** @source_command: Original command that generated the info queue */ +u32 source_command; +/** @source_context: Context from original command, if applicable */ +struct xe_ras_error_class source_context; +} __packed; + +/** +* struct xe_ras_get_info_queue_data_response - Response for RAS_CMD_GET_INFO_QUEUE_DATA +*/ +struct xe_ras_get_info_queue_data_response { +/** @operation_status: Status of the retrieval operation */ +u32 operation_status; +/** @queue_response: Info queue data chunk */ +struct xe_ras_info_queue_response queue_response; +} __packed; +#endif drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h +2
-0@@ -25,11 +25,13 @@ enum xe_sysctrl_group {* @XE_SYSCTRL_CMD_GET_COUNTER: Get error counter value * @XE_SYSCTRL_CMD_CLEAR_COUNTER: Clear error counter value * @XE_SYSCTRL_CMD_GET_PENDING_EVENT: Retrieve pending event +* @XE_SYSCTRL_CMD_GET_INFO_QUEUE_DATA: Retrieve a chunk of info queue data */ enum xe_sysctrl_gfsp_cmd {XE_SYSCTRL_CMD_GET_COUNTER =0x03 ,XE_SYSCTRL_CMD_CLEAR_COUNTER =0x04 ,XE_SYSCTRL_CMD_GET_PENDING_EVENT =0x07 , +XE_SYSCTRL_CMD_GET_INFO_QUEUE_DATA =0x0D , };/**
Re: [RFC PATCH 2/7] drm/xe/xe_ras: Add support to retrieve info queue data for CRI
Quoted 8 lines · Koujalagi
Quoted 4 lines · Badal Nilawar
Add support to retrieve info queue data. It can be retrieved when has_info_queue=1 and
RAS_INFO_QUEUE_FLAG_MORE_DATAis set in response ofXE_SYSCTRL_CMD_GET_COUNTER.nit: Please change commit message, we haven't checked has_info_queue=1
Tried explaining when info queue will be retrieved. will rephrase the commit message.
Quoted 17 lines
Quoted 17 lines
Signed-off-by Badal Nilawar<[email protected]>Assisted-by Copilot:claude-sonnet-4.6--- drivers/gpu/drm/xe/xe_ras.c | 34 ++++++ drivers/gpu/drm/xe/xe_ras_types.h | 112 +++++++++++++++++- drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h | 2 + 3 files changed, 147 insertions(+), 1 deletion(-)drivers/gpu/drm/xe/xe_ras.c +0
-0@@ -270,6 +270,40 @@ int xe_ras_clear_counter(struct xe_device *xe, u8 severity, u8 component)return 0 ; }
Quoted 5 lines
drivers/gpu/drm/xe/xe_ras.c int xe_ras_clear_counter(struct xe_device *xe, u8 severity, u8 component) · line 276
Quoted 4 lines
drivers/gpu/drm/xe/xe_ras.c +4
-0+static int get_info_queue_data (struct xe_device *xe, +const struct xe_ras_get_info_queue_data_request *req, +struct xe_ras_get_info_queue_data_response *out) +{Why we need info queue data? When we are going to use info queue data?
Info queue data contains the meta data for ras error counter. Info queue will be retrieved while building CPER record ras error counters. It is used in patch 6 to prepare CPER error info.
Quoted 19 lines
Quoted 19 lines
drivers/gpu/drm/xe/xe_ras.c +19
-0+struct xe_ras_get_info_queue_data_response response = {0 }; +struct xe_sysctrl_mailbox_command command = {0 }; +size_t rlen; +int ret; + +xe_sysctrl_create_command (&command,XE_SYSCTRL_GROUP_GFSP , +XE_SYSCTRL_CMD_GET_INFO_QUEUE_DATA , + (void *)req,sizeof (*req), &response,sizeof (response)); + + ret =xe_sysctrl_send_command (&xe->sc, &command, &rlen); +if (ret) { +xe_err (xe,"sysctrl: failed to get info queue data %d\n" , ret); +return ret; + } + +if (rlen !=sizeof (response)) { +xe_err (xe,"sysctrl: unexpected get info queue data response length %zu (expected %zu)\n" , + rlen,sizeof (response)); +return -EIO ;
Quoted 8 lines
drivers/gpu/drm/xe/xe_ras.c int xe_ras_clear_counter(struct xe_device *xe, u8 severity, u8 component) · line 302
Quoted 7 lines
drivers/gpu/drm/xe/xe_ras.c +7
-0+ } + +xe_dbg (xe,"[RAS]: info queue data: status=%u chunk_size=%u flags=0x%x\n" , + response.operation_status, + response.queue_response.queue_header.chunk_size, + response.queue_response.queue_header.flags); +What happen when system control send corrupt data?
If headers are corrupted then it will not be processed, but if headers are intact and data is corrupted then it will go to cper record. Validating info queue data is not in xe kmds scope.
Quoted 14 lines
Quoted 14 lines
drivers/gpu/drm/xe/xe_ras.c +4
-0+ *out = response; +return 0 ; +} +/** * xe_ras_init - Initialize Xe RAS * @xe: xe device instance drivers/gpu/drm/xe/xe_ras_types.h +0
-0@@ -9,6 +9,12 @@#include <linux/types.h>
Quoted 11 lines
drivers/gpu/drm/xe/xe_ras_types.h line 18
Quoted 8 lines
drivers/gpu/drm/xe/xe_ras_types.h +6
-0#define XE_RAS_NUM_COUNTERS 16 +#define XE_RAS_INFO_QUEUE_MAX_CHUNK_SIZE 200 +#define XE_RAS_INFO_QUEUE_MAX_TOTAL_SIZE 5120 +#define XE_RAS_INFO_QUEUE_FLAG_AVAILABLE 0x01 +#define XE_RAS_INFO_QUEUE_FLAG_MORE_DATA 0x02 +#define XE_RAS_INFO_QUEUE_FLAG_OVERFLOW 0x04 +#define XE_RAS_INFO_QUEUE_FLAG_COMPRESSED 0x08What is use of
XE_RAS_INFO_QUEUE_FLAG_COMPRESSED? When we are using it?
I will drop this and other unused flags.
Thanks,
Badal
Quoted 142 lines
Thanks,
-/Mallesh
Quoted 138 lines
drivers/gpu/drm/xe/xe_ras_types.h +105
-1/** * struct xe_ras_error_common - Error fields that are common across all products @@ -71,7 +77,64 @@ struct xe_ras_threshold_crossed { } __packed;/** -* struct xe_ras_get_counter_request - Request structure for get counter +* struct xe_ras_info_queue_header - Metadata for large info queue data transfers +* +* Provides chunk metadata for commands that support extended info queue +* functionality. Used when the total data exceeds a single mailbox response. +*/ +struct xe_ras_info_queue_header { +/** @total_size: Total size of the complete info queue data in bytes */ +u32 total_size; +/** @chunk_offset: Offset of this chunk within the total data in bytes */ +u32 chunk_offset; +/** @chunk_size: Size of the data in this chunk in bytes */ +u32 chunk_size; +/** @sequence_number: Sequence number for this chunk, starts at 0 */ +u32 sequence_number; +/** @flags: Info queue control flags (RAS_INFO_QUEUE_FLAG_*) */ +u32 flags:8 ; +/** @compression_type: Compression algorithm used; 0 = none */ +u32 compression_type:4 ; +/** @num_headers: Number of detailed counter headers at start of queue_data */ +u32 num_headers:5 ; +/** @reserved: Reserved for future use */ +u32 reserved:15 ; +/** @checksum: CRC32 checksum of this chunk data */ +u32 checksum; +} __packed; + +/** +* struct xe_ras_info_queue_request - Request for a specific chunk of info queue data +* +* Allows the driver to request continuation of large info queue transfers +* by specifying an offset and size within the full data set. +*/ +struct xe_ras_info_queue_request { +/** @requested_offset: Byte offset of the requested data chunk */ +u32 requested_offset; +/** @requested_size: Maximum size of the requested chunk in bytes */ +u32 requested_size; +/** @session_id: Session ID to correlate multi-chunk transfers */ +struct xe_ras_error_class session_id; +/** @reserved: Reserved for future use */ +u32 reserved; +} __packed; + +/** +* struct xe_ras_info_queue_response - Generic response for commands with info queues +* +* Standard response format for any command that returns an info queue +* payload. May be embedded in a command-specific response structure. +*/ +struct xe_ras_info_queue_response { +/** @queue_header: Info queue metadata for this chunk */ +struct xe_ras_info_queue_header queue_header; +/** @queue_data: Info queue data for this chunk */ +u8 queue_data[XE_RAS_INFO_QUEUE_MAX_CHUNK_SIZE ]; +} __packed; + +/** +* struct xe_ras_get_counter_request - Request for get error counter */ struct xe_ras_get_counter_request {/** @counter: Error counter to be queried */ @@ -121,4 +184,51 @@ struct xe_ras_clear_counter_response {/** @reserved1: Reserved for future use */ u32 reserved1[3]; } __packed; + +/** +* struct xe_ras_info_queue_dynamic_counter_hdr - Aggregate counter header entry +* +* When a session requests aggregate counter data, one header per matching +* dynamic counter class is prepended to the queue data. The @counter field +* indicates how many subsequent error log entries belong to this class. +*/ +struct xe_ras_info_queue_dynamic_counter_hdr { +/** @error_class: Error class associated with this counter group */ +struct xe_ras_error_class error_class; +/** @counter: Number of error log entries that follow for this class */ +u32 counter; +} __packed; + +/** +* struct xe_ras_error_log - Single error log entry following dynamic counter headers +*/ +struct xe_ras_error_log { +/** @timestamp: Timestamp when the error was recorded */ +u64 timestamp; +/** @error_details: Error-specific details */ +u32 error_details[16 ]; +} __packed; + +/** +* struct xe_ras_get_info_queue_data_request - Request for RAS_CMD_GET_INFO_QUEUE_DATA +*/ +struct xe_ras_get_info_queue_data_request { +/** @queue_request: Info queue request parameters */ +struct xe_ras_info_queue_request queue_request; +/** @source_command: Original command that generated the info queue */ +u32 source_command; +/** @source_context: Context from original command, if applicable */ +struct xe_ras_error_class source_context; +} __packed; + +/** +* struct xe_ras_get_info_queue_data_response - Response for RAS_CMD_GET_INFO_QUEUE_DATA +*/ +struct xe_ras_get_info_queue_data_response { +/** @operation_status: Status of the retrieval operation */ +u32 operation_status; +/** @queue_response: Info queue data chunk */ +struct xe_ras_info_queue_response queue_response; +} __packed; +#endif drivers/gpu/drm/xe/xe_sysctrl_mailbox_types.h +2
-0@@ -25,11 +25,13 @@ enum xe_sysctrl_group {* @XE_SYSCTRL_CMD_GET_COUNTER: Get error counter value * @XE_SYSCTRL_CMD_CLEAR_COUNTER: Clear error counter value * @XE_SYSCTRL_CMD_GET_PENDING_EVENT: Retrieve pending event +* @XE_SYSCTRL_CMD_GET_INFO_QUEUE_DATA: Retrieve a chunk of info queue data */ enum xe_sysctrl_gfsp_cmd {XE_SYSCTRL_CMD_GET_COUNTER =0x03 ,XE_SYSCTRL_CMD_CLEAR_COUNTER =0x04 ,XE_SYSCTRL_CMD_GET_PENDING_EVENT =0x07 , +XE_SYSCTRL_CMD_GET_INFO_QUEUE_DATA =0x0D , };/**
RFC PATCH 3/7 drm/xe/xe_ras: Refactor get_counter() to return response structure
In reply to Badal NilawarReturn the complete response structure from get_counter() instead of only the counter value. This allows callers to access additional response fields, such as has_info_queue for CPER record building.
--- drivers/gpu/drm/xe/xe_ras.c | 23 +++++++++++++++-------- drivers/gpu/drm/xe/xe_ras_types.h | 10 ++++++++-- 2 files changed, 23 insertions(+), 10 deletions(-)
drivers/gpu/drm/xe/xe_ras.c +15 -8
@@ -157,12 +157,12 @@ void xe_ras_counter_threshold_crossed(struct xe_device *xe, } } -static int get_counter (struct xe_device *xe,struct xe_ras_error_class *counter,u32 *value) +static int get_counter (struct xe_device *xe,const struct xe_ras_error_class *counter, +struct xe_ras_get_counter_response *out) {struct xe_ras_get_counter_response response = {0 };struct xe_ras_get_counter_request request = {0 };struct xe_sysctrl_mailbox_command command = {0 }; -struct xe_ras_error_common *common;size_t rlen;int ret;
@@ -183,12 +183,11 @@ static int get_counter(struct xe_device *xe, struct xe_ras_error_class *counter,return -EIO ; } - common = &response.counter.common; - *value = response.value; - -xe_dbg (xe,"[RAS]: get counter %u for %s %s\n" , *value,comp_to_str (common->component), -sev_to_str (common->severity)); +xe_dbg (xe,"[RAS]: get counter value %u for %s %s\n" , response.value, +comp_to_str (response.counter.common.component), +sev_to_str (response.counter.common.severity)); + *out = response;return 0 ; }
@@ -207,12 +206,20 @@ static int get_counter(struct xe_device *xe, struct xe_ras_error_class *counter,int xe_ras_get_counter (struct xe_device *xe,u8 severity,u8 component,u32 *value) {struct xe_ras_error_class counter = {0 }; +struct xe_ras_get_counter_response response; +int ret; counter.common.severity =drm_to_xe_ras_severity (severity); counter.common.component =drm_to_xe_ras_component (component);guard (xe_pm_runtime)(xe); -return get_counter (xe, &counter, value); + + ret =get_counter (xe, &counter, &response); +if (ret) +return ret; + + *value = response.counter_value; +return 0 ; }/**
drivers/gpu/drm/xe/xe_ras_types.h +8 -2
@@ -155,8 +155,14 @@ struct xe_ras_get_counter_response {u64 timestamp;/** @threshold: Threshold value for the counter */ u32 threshold; -/** @reserved: Reserved */ -u32 reserved[57 ]; +/** @reserved: Reserved for future use */ + u32 reserved:9; +/** @has_info_queue: Set if info queue is available */ + u32 has_info_queue:1; +/** @reserved1: Reserved for future use */ + u32 reserved1:22; +/** @info_queue: Initial info queue data (first chunk) if available */ +struct xe_ras_info_queue_response info_queue; } __packed;/**
Signature · 1 line
2.54.0
Re: [RFC PATCH 3/7] drm/xe/xe_ras: Refactor get_counter() to return response structure
Quoted 32 lines · Badal Nilawar
Return the complete response structure from
get_counter()instead of only the counter value. This allows callers to access additional response fields, such ashas_info_queuefor CPER record building.Signed-off-by Badal Nilawar <[email protected]>Assisted-by Copilot:claude-sonnet-4.6--- drivers/gpu/drm/xe/xe_ras.c | 23 +++++++++++++++-------- drivers/gpu/drm/xe/xe_ras_types.h | 10 ++++++++-- 2 files changed, 23 insertions(+), 10 deletions(-)drivers/gpu/drm/xe/xe_ras.c +2
-2@@ -157,12 +157,12 @@ void xe_ras_counter_threshold_crossed(struct xe_device *xe, } } -static int get_counter (struct xe_device *xe,struct xe_ras_error_class *counter,u32 *value) +static int get_counter (struct xe_device *xe,const struct xe_ras_error_class *counter, +struct xe_ras_get_counter_response *out) {struct xe_ras_get_counter_response response = {0 };struct xe_ras_get_counter_request request = {0 };struct xe_sysctrl_mailbox_command command = {0 }; -struct xe_ras_error_common *common;size_t rlen;int ret;@@ -183,12 +183,11 @@ static int get_counter(struct xe_device *xe, struct xe_ras_error_class *counter,return -EIO ;
drivers/gpu/drm/xe/xe_ras.c static int get_counter(struct xe_device *xe, struct xe_ras_error_class *counter, · line 188
Quoted 10 lines
drivers/gpu/drm/xe/xe_ras.c +3
-5} - common = &response.counter.common; - *value = response.value; - -xe_dbg (xe,"[RAS]: get counter %u for %s %s\n" , *value,comp_to_str (common->component), -sev_to_str (common->severity)); +xe_dbg (xe,"[RAS]: get counter value %u for %s %s\n" , response.value, +comp_to_str (response.counter.common.component), +sev_to_str (response.counter.common.severity));
Why the unnecessary change?
Quoted 13 lines
drivers/gpu/drm/xe/xe_ras.c +3
-0+ *out = response;return 0 ; }@@ -207,12 +206,20 @@ static int get_counter(struct xe_device *xe, struct xe_ras_error_class *counter,int xe_ras_get_counter (struct xe_device *xe,u8 severity,u8 component,u32 *value) {struct xe_ras_error_class counter = {0 }; +struct xe_ras_get_counter_response response; +int ret; counter.common.severity =drm_to_xe_ras_severity (severity);
drivers/gpu/drm/xe/xe_ras.c static int get_counter(struct xe_device *xe, struct xe_ras_error_class *counter, · line 221
Quoted 10 lines
drivers/gpu/drm/xe/xe_ras.c +6
-1counter.common.component =drm_to_xe_ras_component (component);guard (xe_pm_runtime)(xe); -return get_counter (xe, &counter, value); + + ret =get_counter (xe, &counter, &response); +if (ret) +return ret; + + *value = response.counter_value;
Does this compile? I don't see a counter_value in response
Thanks
Riana
Quoted 25 lines
drivers/gpu/drm/xe/xe_ras.c +1
-0+return 0 ; }/** drivers/gpu/drm/xe/xe_ras_types.h +8
-2@@ -155,8 +155,14 @@ struct xe_ras_get_counter_response {u64 timestamp;/** @threshold: Threshold value for the counter */ u32 threshold; -/** @reserved: Reserved */ -u32 reserved[57 ]; +/** @reserved: Reserved for future use */ + u32 reserved:9; +/** @has_info_queue: Set if info queue is available */ + u32 has_info_queue:1; +/** @reserved1: Reserved for future use */ + u32 reserved1:22; +/** @info_queue: Initial info queue data (first chunk) if available */ +struct xe_ras_info_queue_response info_queue; } __packed;/**
Re: [RFC PATCH 3/7] drm/xe/xe_ras: Refactor get_counter() to return response structure
In reply to Badal NilawarQuoted 16 lines · Badal Nilawar
Return the complete response structure from
get_counter()instead of only the counter value. This allows callers to access additional response fields, such ashas_info_queuefor CPER record building.Signed-off-by Badal Nilawar <[email protected]>Assisted-by Copilot:claude-sonnet-4.6--- drivers/gpu/drm/xe/xe_ras.c | 23 +++++++++++++++-------- drivers/gpu/drm/xe/xe_ras_types.h | 10 ++++++++-- 2 files changed, 23 insertions(+), 10 deletions(-)drivers/gpu/drm/xe/xe_ras.c +0
-0
drivers/gpu/drm/xe/xe_ras.c void xe_ras_counter_threshold_crossed(struct xe_device *xe, · line 163
Quoted 8 lines
drivers/gpu/drm/xe/xe_ras.c +2
-1@@ -157,12 +157,12 @@ void xe_ras_counter_threshold_crossed(struct xe_device *xe, } } -static int get_counter (struct xe_device *xe,struct xe_ras_error_class *counter,u32 *value) +static int get_counter (struct xe_device *xe,const struct xe_ras_error_class *counter, +struct xe_ras_get_counter_response *out) {struct xe_ras_get_counter_response response = {0 };
response is not required, we can directly use "out".
Quoted 24 lines
drivers/gpu/drm/xe/xe_ras.c +4
-6struct xe_ras_get_counter_request request = {0 };struct xe_sysctrl_mailbox_command command = {0 }; -struct xe_ras_error_common *common;size_t rlen;int ret;@@ -183,12 +183,11 @@ static int get_counter(struct xe_device *xe, struct xe_ras_error_class *counter,return -EIO ; } - common = &response.counter.common; - *value = response.value; - -xe_dbg (xe,"[RAS]: get counter %u for %s %s\n" , *value,comp_to_str (common->component), -sev_to_str (common->severity)); +xe_dbg (xe,"[RAS]: get counter value %u for %s %s\n" , response.value, +comp_to_str (response.counter.common.component), +sev_to_str (response.counter.common.severity)); + *out = response;return 0 ; }
drivers/gpu/drm/xe/xe_ras.c static int get_counter(struct xe_device *xe, struct xe_ras_error_class *counter, · line 209
Quoted 4 lines
drivers/gpu/drm/xe/xe_ras.c +1
-0@@ -207,12 +206,20 @@ static int get_counter(struct xe_device *xe, struct xe_ras_error_class *counter,int xe_ras_get_counter (struct xe_device *xe,u8 severity,u8 component,u32 *value) {struct xe_ras_error_class counter = {0 }; +struct xe_ras_get_counter_response response;
Safe to initialized response = {0}.
drivers/gpu/drm/xe/xe_ras.c static int get_counter(struct xe_device *xe, struct xe_ras_error_class *counter, · line 221
Quoted 13 lines
drivers/gpu/drm/xe/xe_ras.c +7
-1+int ret; counter.common.severity =drm_to_xe_ras_severity (severity); counter.common.component =drm_to_xe_ras_component (component);guard (xe_pm_runtime)(xe); -return get_counter (xe, &counter, value); + + ret =get_counter (xe, &counter, &response); +if (ret) +return ret; + + *value = response.counter_value;
counter_value is not member of response. should get compilation error.
Thanks,
-/Mallesh
Quoted 25 lines
drivers/gpu/drm/xe/xe_ras.c +1
-0+return 0 ; }/** drivers/gpu/drm/xe/xe_ras_types.h +8
-2@@ -155,8 +155,14 @@ struct xe_ras_get_counter_response {u64 timestamp;/** @threshold: Threshold value for the counter */ u32 threshold; -/** @reserved: Reserved */ -u32 reserved[57 ]; +/** @reserved: Reserved for future use */ + u32 reserved:9; +/** @has_info_queue: Set if info queue is available */ + u32 has_info_queue:1; +/** @reserved1: Reserved for future use */ + u32 reserved1:22; +/** @info_queue: Initial info queue data (first chunk) if available */ +struct xe_ras_info_queue_response info_queue; } __packed;/**
RFC PATCH 4/7 drm/xe/cper: Add CPER structures and trace event
In reply to Badal NilawarDefine packed data structures and Intel-specific GUID macros needed to build Intel GPU CPER (Common Platform Error Record) non-standard records.
Add xe_error_cper trace event to log the assembled CPER record bytes.
--- drivers/gpu/drm/xe/Makefile | 1 + drivers/gpu/drm/xe/xe_cper_types.h | 186 +++++++++++++++++++++++++++++ drivers/gpu/drm/xe/xe_trace_cper.c | 9 ++ drivers/gpu/drm/xe/xe_trace_cper.h | 65 ++++++++++ 4 files changed, 261 insertions(+) create mode 100644 drivers/gpu/drm/xe/xe_cper_types.h create mode 100644 drivers/gpu/drm/xe/xe_trace_cper.c create mode 100644 drivers/gpu/drm/xe/xe_trace_cper.h
drivers/gpu/drm/xe/Makefile +1 -0
@@ -134,6 +134,7 @@ xe-y += xe_bb.o \ xe_tlb_inval_job.o \ xe_trace.o \ xe_trace_bo.o \ + xe_trace_cper.o \ xe_trace_guc.o \ xe_trace_lrc.o \ xe_ttm_stolen_mgr.o \
drivers/gpu/drm/xe/xe_cper_types.h new file +186 -0
186 lines not on this page · raw message
drivers/gpu/drm/xe/xe_trace_cper.c new file +9 -0
@@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright © 2026 Intel Corporation +*/ + +#ifndef __CHECKER__ +#define CREATE_TRACE_POINTS +#include "xe_trace_cper.h" +#endif
drivers/gpu/drm/xe/xe_trace_cper.h new file +65 -0
65 lines not on this page · raw message
Signature · 1 line
2.54.0
RFC PATCH 5/7 drm/xe/cper: APIs to prepare and log CPER record
In reply to Badal NilawarAdd APIs to initialize Intel-specific CPER metadata, build a non-standard CPER record, and emit it via the xe_error_cper tracepoint.
--- drivers/gpu/drm/xe/Makefile | 1 + drivers/gpu/drm/xe/xe_cper.c | 215 +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/xe/xe_cper.h | 30 +++++ 3 files changed, 246 insertions(+) create mode 100644 drivers/gpu/drm/xe/xe_cper.c create mode 100644 drivers/gpu/drm/xe/xe_cper.h
drivers/gpu/drm/xe/Makefile +1 -0
@@ -35,6 +35,7 @@ $(obj)/generated/%_device_wa_oob.c $(obj)/generated/%_device_wa_oob.h: $(obj)/xe xe-y += xe_bb.o \ xe_bo.o \ xe_bo_evict.o \ + xe_cper.o \ xe_dep_scheduler.o \ xe_devcoredump.o \ xe_device.o \
drivers/gpu/drm/xe/xe_cper.c new file +215 -0
215 lines not on this page · raw message
drivers/gpu/drm/xe/xe_cper.h new file +30 -0
@@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2026 Intel Corporation +*/ + +#ifndef _XE_CPER_H_ +#define _XE_CPER_H_ + +#include <linux/types.h> +#include <linux/uuid.h> + +struct xe_cper_sec_intel_err_hdr ; +struct xe_device ; + +void xe_cper_record_emit (struct xe_device *xe, +const guid_t *fru_id, +u8 severity, +guid_t notification_type, +struct xe_cper_sec_intel_err_hdr *ihdr, +const void *einfo, +u32 einfo_size); + +void xe_cper_init_intel_err_hdr (struct xe_device *xe, +const u8 location[12 ], +u64 first_timestamp, +u32 sig_id, +u64 error_count, +struct xe_cper_sec_intel_err_hdr *ihdr); + +#endif /* _XE_CPER_H_ */
Signature · 1 line
2.54.0
RFC PATCH 6/7 drm/xe/cper: Prepare Intel CPER error info from info queue
In reply to Badal NilawarAdd prepare_cper_error_info() to xe_ras.c which assembles the raw info queue data embedded in a GET_COUNTER response (and any subsequent chunks fetched via GET_INFO_QUEUE_DATA) into a xe_cper_sec_intel_error_info that can be passed directly to cper logging function.
--- drivers/gpu/drm/xe/xe_ras.c | 142 +++++++++++++++++++++++++++++++++++- 1 file changed, 141 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_ras.c +141 -1
@@ -3,6 +3,8 @@* Copyright © 2026 Intel Corporation */ +#include "xe_cper.h" +#include "xe_cper_types.h" #include "xe_device.h" #include "xe_drm_ras.h" #include "xe_pm.h"
@@ -218,7 +220,7 @@ int xe_ras_get_counter(struct xe_device *xe, u8 severity, u8 component, u32 *valif (ret)return ret; - *value = response.counter_value; + *value = response.value;return 0 ; }
@@ -311,6 +313,144 @@ static int get_info_queue_data(struct xe_device *xe,return 0 ; } +/** +* prepare_cper_error_info - Assemble info queue chunks and convert to CPER einfo +* @xe: xe device instance +* @counter_resp: counter response containing the first embedded chunk +* @error_class: RAS error class used to populate the einfo error_class fields +* @einfo_size_out: output size of the allocated einfo buffer +* +* Assembles the complete raw info queue data from the first chunk already +* embedded in @counter_resp and any additional chunks fetched via +* GET_INFO_QUEUE_DATA. The raw data layout is: +* +* [xe_ras_info_queue_dynamic_counter_hdr * num_headers] +* [xe_ras_error_log * N] +* +* Each xe_ras_error_log is translated into an xe_intel_priv_event_entry and +* appended to the returned xe_cper_sec_intel_error_info.event_queue[]. +* +* Returns: allocated einfo on success (caller must kfree()), NULL on failure. +*/ +static struct xe_cper_sec_intel_error_info * +prepare_cper_error_info (struct xe_device *xe, +const struct xe_ras_get_counter_response *counter_resp, +const struct xe_ras_error_class *error_class, +u32 *einfo_size_out) +{ +const struct xe_ras_info_queue_header *first_qhdr = + &counter_resp->info_queue.queue_header; +struct xe_ras_get_info_queue_data_request iq_req = {0 }; +struct xe_ras_get_info_queue_data_response iq_response = {0 }; +struct xe_cper_sec_intel_error_info *einfo; +struct xe_intel_priv_event_entry *entry; +const struct xe_ras_error_log *logs; +u32 entry_size, einfo_size; +u32 num_logs; +u32 raw_total, iq_offset =0 ; +u8 *raw_buf; +u32 i; + + raw_buf =kzalloc (XE_RAS_INFO_QUEUE_MAX_TOTAL_SIZE ,GFP_KERNEL ); +if (!raw_buf) +return NULL ; + +/* Copy first chunk already embedded in the counter response */ +if (first_qhdr->chunk_size && + first_qhdr->chunk_offset + first_qhdr->chunk_size <= +XE_RAS_INFO_QUEUE_MAX_TOTAL_SIZE ) { +memcpy (raw_buf + first_qhdr->chunk_offset, + counter_resp->info_queue.queue_data, + first_qhdr->chunk_size); + iq_offset = first_qhdr->chunk_size; + } + +/* Fetch any remaining chunks */ +if (first_qhdr->flags &XE_RAS_INFO_QUEUE_FLAG_MORE_DATA ) { + iq_req.source_command =XE_SYSCTRL_CMD_GET_COUNTER ; + iq_req.source_context = counter_resp->counter; + iq_req.queue_request.requested_size =XE_RAS_INFO_QUEUE_MAX_CHUNK_SIZE ; + iq_req.queue_request.session_id = counter_resp->counter; + +do { +struct xe_ras_info_queue_header *qhdr; +u32 end; + + iq_req.queue_request.requested_offset = iq_offset; + +if (get_info_queue_data (xe, &iq_req, &iq_response)) +break ; + + qhdr = &iq_response.queue_response.queue_header; + end = qhdr->chunk_offset + qhdr->chunk_size; + +if (end >XE_RAS_INFO_QUEUE_MAX_TOTAL_SIZE ) { +xe_warn (xe,"[RAS]: CPER: info queue chunk out of bounds (offset=%u size=%u)\n" , + qhdr->chunk_offset, qhdr->chunk_size); +break ; + } + +memcpy (raw_buf + qhdr->chunk_offset, + iq_response.queue_response.queue_data, + qhdr->chunk_size); + +if (!qhdr->chunk_size) +break ; + + iq_offset += qhdr->chunk_size; + }while (iq_response.queue_response.queue_header.flags & +XE_RAS_INFO_QUEUE_FLAG_MORE_DATA ); + } + + raw_total = first_qhdr->total_size + ?min (first_qhdr->total_size,XE_RAS_INFO_QUEUE_MAX_TOTAL_SIZE ) + : iq_offset; + + num_logs = raw_total /sizeof (struct xe_ras_error_log ); +if (!num_logs) { +kfree (raw_buf); +return NULL ; + } + +/* +* Each xe_intel_priv_event_entry holds: +* entry_length (u32) + timestamp (u64) + metadata[] (error_details) +*/ + entry_size = offsetof(struct xe_intel_priv_event_entry , metadata) + + sizeof_field(struct xe_ras_error_log, error_details); + einfo_size =sizeof (*einfo) + num_logs * entry_size; + + einfo =kzalloc (einfo_size,GFP_KERNEL ); +if (!einfo) { +kfree (raw_buf); +return NULL ; + } + + einfo->error_count = counter_resp->value; + einfo->event_queue_length = num_logs * entry_size; + einfo->event_queue_count = num_logs; + einfo->error_class.error_type = error_class->common.severity; + einfo->error_class.error_component = error_class->common.component; + einfo->error_class.tile = error_class->product.unit.tile; + einfo->error_class.instance = error_class->product.unit.instance; + einfo->error_class.cause = error_class->product.cause.cause; + + logs = (const struct xe_ras_error_log *)raw_buf; + entry = (struct xe_intel_priv_event_entry *)einfo->event_queue; + +for (i =0 ; i < num_logs; i++) { + entry->entry_length = sizeof_field(struct xe_ras_error_log, error_details); + entry->timestamp = logs[i].timestamp; +memcpy (entry->metadata, logs[i].error_details, +sizeof (logs[i].error_details)); + entry = (struct xe_intel_priv_event_entry *)((u8 *)entry + entry_size); + } + +kfree (raw_buf); + *einfo_size_out = einfo_size; +return einfo; +} +/** * xe_ras_init - Initialize Xe RAS * @xe: xe device instance
Signature · 1 line
2.54.0
RFC PATCH 7/7 drm/xe/cper: Log CPER record for correctable errors
In reply to Badal NilawarIn xe_ras_counter_threshold_crossed(), emit a CPER record for each correctable error reported via the counter threshold crossed event.
--- drivers/gpu/drm/xe/xe_ras.c | 75 +++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+)
drivers/gpu/drm/xe/xe_ras.c +75 -0
@@ -11,6 +11,7 @@#include "xe_printk.h" #include "xe_ras.h" #include "xe_ras_types.h" +#include "xe_sig_ids.h" #include "xe_sysctrl.h" #include "xe_sysctrl_event_types.h" #include "xe_sysctrl_mailbox.h"
@@ -67,6 +68,10 @@ static const char *const xe_ras_components[] = { };static_assert (ARRAY_SIZE (xe_ras_components) ==XE_RAS_COMP_MAX ); +static void emit_hw_error_cper (struct xe_device *xe, +const struct xe_ras_error_class *error_class, +u64 timestamp,u32 sig_id,u8 severity); +static u8 drm_to_xe_ras_severity (u8 severity) {switch (severity) {
@@ -133,6 +138,38 @@ static inline const char *comp_to_str(u8 component)return xe_ras_components[component]; } +static u32 ras_comp_to_hw_sigid (u8 component) +{ +switch (component) { +case XE_RAS_COMP_DEVICE_MEMORY : +return XE_SIG_HW_DEVICE_MEMORY ; +case XE_RAS_COMP_CORE_COMPUTE : +return XE_SIG_HW_CORE_COMPUTE ; +case XE_RAS_COMP_PCIE : +return XE_SIG_HW_PCIE ; +case XE_RAS_COMP_FABRIC : +return XE_SIG_HW_FABRIC ; +case XE_RAS_COMP_SOC_INTERNAL : +return XE_SIG_HW_SOC_INTERNAL ; +default : +return U32_MAX ; + } +} + +static u8 ras_sev_to_cper_sev (u8 ras_sev) +{ +switch (ras_sev) { +case XE_RAS_SEV_CORRECTABLE : +return CPER_SEV_CORRECTED ; +case XE_RAS_SEV_UNCORRECTABLE : +return CPER_SEV_RECOVERABLE ; +case XE_RAS_SEV_INFORMATIONAL : +return CPER_SEV_INFORMATIONAL ; +default : +return CPER_SEV_RECOVERABLE ; + } +} +void xe_ras_counter_threshold_crossed (struct xe_device *xe,struct xe_sysctrl_event_response *response) {
@@ -154,6 +191,9 @@ void xe_ras_counter_threshold_crossed(struct xe_device *xe, severity = errors[id].common.severity; component = errors[id].common.component; +/* Emit a CPER record for this error */ +emit_hw_error_cper (xe, &errors[id],0 ,ras_comp_to_hw_sigid (component), severity); +xe_warn (xe,"[RAS]: %s %s detected\n" ,comp_to_str (component),sev_to_str (severity)); }
@@ -451,6 +491,41 @@ prepare_cper_error_info(struct xe_device *xe,return einfo; } +static void emit_hw_error_cper (struct xe_device *xe, +const struct xe_ras_error_class *error_class, +u64 timestamp,u32 sig_id,u8 severity) +{ +struct xe_ras_get_counter_response counter_response = {}; +struct xe_cper_sec_intel_err_hdr ihdr = {}; +struct xe_cper_sec_intel_error_info *einfo =NULL ; +u32 einfo_size =0 ; + +if (get_counter (xe, error_class, &counter_response)) { +xe_err (xe,"[RAS]: CPER: failed to get counter, skipping record\n" ); +return ; + } + +xe_cper_init_intel_err_hdr (xe, + (const u8 *)error_class, + timestamp, + sig_id, + counter_response.value, + &ihdr); + +if (counter_response.has_info_queue) { + einfo =prepare_cper_error_info (xe, &counter_response, + error_class, &einfo_size); +if (!einfo) +xe_err (xe,"[RAS]: CPER: failed to build einfo from info queue\n" ); + } + +xe_cper_record_emit (xe, &guid_null, +ras_sev_to_cper_sev (severity), +INTEL_CPER_NOTIFY_GPU_ERROR , + &ihdr, einfo, einfo_size); +kfree (einfo); +} +/** * xe_ras_init - Initialize Xe RAS * @xe: xe device instance
Signature · 1 line
2.54.0
Quoted 3 lines · Badal Nilawar
This patch series adds CPER (Common Platform Error Record) logging support for Correctable errors reported by Intel Xe GPUs. CPER logging is done through trace event.
I had a rough glance and I think this needs to be structured a bit.
1. Introduce a bare minimum emit_cper() which hooks to both correctable and uncorrectable error cases.
2. Refactor get_counter() to have a response as its argument and hook it up to emit_cper().
3. Introduce Intel CPER structs and all that jazz.
4. Introduce info queue (which is optional, right?) and hook it up to emit_cper().
5. Finally introduce trace event for the end user.
Split the patches cleanly if the diff starts to get out of hand and don't add functions, structs or defines that are not used in that specific patch.
Raag