From: Badal Nilawar <badal.nilawar@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: anshuman.gupta@intel.com, rodrigo.vivi@intel.com,
daniele.ceraolospurio@intel.com, raag.jadav@intel.com,
riana.tauro@intel.com, mallesh.koujalagi@intel.com,
aravind.iddamsetty@intel.com
Subject: [RFC PATCH 7/7] drm/xe/cper: Log CPER record for correctable errors
Date: Thu, 2 Jul 2026 16:44:09 +0530 [thread overview]
Message-ID: <20260702111401.3680214-16-badal.nilawar@intel.com> (raw)
In-Reply-To: <20260702111401.3680214-9-badal.nilawar@intel.com>
In xe_ras_counter_threshold_crossed(), emit a CPER record for each
correctable error reported via the counter threshold crossed event.
Signed-off-by: Badal Nilawar <badal.nilawar@intel.com>
Assisted-by: Copilot:claude-sonnet-4.6
---
drivers/gpu/drm/xe/xe_ras.c | 75 +++++++++++++++++++++++++++++++++++++
1 file changed, 75 insertions(+)
diff --git a/drivers/gpu/drm/xe/xe_ras.c b/drivers/gpu/drm/xe/xe_ras.c
index 8579cde6a4bf..53f192a2e97f 100644
--- a/drivers/gpu/drm/xe/xe_ras.c
+++ b/drivers/gpu/drm/xe/xe_ras.c
@@ -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
--
2.54.0
prev parent reply other threads:[~2026-07-02 11:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-02 11:14 [RFC PATCH 0/7] Add CPER logging support for CRI Badal Nilawar
2026-07-02 11:14 ` [RFC PATCH 1/7] drm/xe: Add error Signature IDs for RAS logging Badal Nilawar
2026-07-02 11:14 ` [RFC PATCH 2/7] drm/xe/xe_ras: Add support to retrieve info queue data for CRI Badal Nilawar
2026-07-07 12:29 ` Mallesh, Koujalagi
2026-07-02 11:14 ` [RFC PATCH 3/7] drm/xe/xe_ras: Refactor get_counter() to return response structure Badal Nilawar
2026-07-03 7:41 ` Tauro, Riana
2026-07-07 12:53 ` Mallesh, Koujalagi
2026-07-02 11:14 ` [RFC PATCH 4/7] drm/xe/cper: Add CPER structures and trace event Badal Nilawar
2026-07-02 11:14 ` [RFC PATCH 5/7] drm/xe/cper: APIs to prepare and log CPER record Badal Nilawar
2026-07-02 11:14 ` [RFC PATCH 6/7] drm/xe/cper: Prepare Intel CPER error info from info queue Badal Nilawar
2026-07-02 11:14 ` Badal Nilawar [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260702111401.3680214-16-badal.nilawar@intel.com \
--to=badal.nilawar@intel.com \
--cc=anshuman.gupta@intel.com \
--cc=aravind.iddamsetty@intel.com \
--cc=daniele.ceraolospurio@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=mallesh.koujalagi@intel.com \
--cc=raag.jadav@intel.com \
--cc=riana.tauro@intel.com \
--cc=rodrigo.vivi@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox