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, michal.wajdeczko@intel.com,
himal.prasad.ghimiray@intel.com, arvind.yadav@intel.com
Subject: [PATCH v2 06/11] drm/xe/cper: Log CPER records for aggregate counter retrival
Date: Tue, 25 Aug 2026 23:29:23 +0530 [thread overview]
Message-ID: <20260825175916.1103841-19-badal.nilawar@intel.com> (raw)
In-Reply-To: <20260825175916.1103841-13-badal.nilawar@intel.com>
Log CPER records for aggregate counter retrieval from userspace.
Signed-off-by: Badal Nilawar <badal.nilawar@intel.com>
---
drivers/gpu/drm/xe/xe_ras.c | 92 +++++++++++++++++++++++++++++++++++++
1 file changed, 92 insertions(+)
diff --git a/drivers/gpu/drm/xe/xe_ras.c b/drivers/gpu/drm/xe/xe_ras.c
index 27c78800b5d2..ff9d917b8e29 100644
--- a/drivers/gpu/drm/xe/xe_ras.c
+++ b/drivers/gpu/drm/xe/xe_ras.c
@@ -204,6 +204,34 @@ 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_SIGID_DEVICE_MEMORY;
+ case XE_RAS_COMP_CORE_COMPUTE:
+ return XE_SIGID_CORE_COMPUTE;
+ case XE_RAS_COMP_PCIE:
+ return XE_SIGID_PCIE;
+ case XE_RAS_COMP_FABRIC:
+ return XE_SIGID_FABRIC;
+ case XE_RAS_COMP_SOC_INTERNAL:
+ return XE_SIGID_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; /* 2 */
+ case XE_RAS_SEV_UNCORRECTABLE: return CPER_SEV_RECOVERABLE; /* 0 */
+ case XE_RAS_SEV_INFORMATIONAL: return CPER_SEV_INFORMATIONAL; /* 3 */
+ default: return CPER_SEV_RECOVERABLE;
+ }
+}
+
static bool ras_counter_is_valid(struct xe_device *xe, struct xe_ras_error_class *counter)
{
u8 severity = counter->common.severity;
@@ -749,6 +777,66 @@ prepare_cper_error_info(struct xe_device *xe,
return einfo_arr;
}
+static void emit_hw_error_cper(struct xe_device *xe,
+ struct xe_ras_error_class *error_class,
+ struct xe_ras_get_counter_response *resp,
+ u32 sig_id, u8 severity)
+{
+ struct xe_ras_get_counter_response local_resp = {};
+ struct xe_ras_get_counter_response *counter_response = resp;
+ struct xe_cper_sec_intel_err_hdr ihdr = {};
+ struct xe_cper_einfo_entry *einfo_arr = NULL;
+ u32 einfo_count = 0;
+ u32 i;
+
+ if (!counter_response) {
+ counter_response = &local_resp;
+ if (get_counter(xe, error_class, counter_response)) {
+ xe_err(xe, "[RAS]: CPER: failed to get counter, skipping record\n");
+ return;
+ }
+ }
+
+ if (counter_response->has_info_queue) {
+ einfo_arr = prepare_cper_error_info(xe, counter_response,
+ error_class, &einfo_count);
+ if (!einfo_arr)
+ xe_err(xe, "[RAS]: CPER: failed to build einfo from info queue\n");
+ }
+
+ if (einfo_count > 0) {
+ for (i = 0; i < einfo_count; i++) {
+ struct xe_cper_sec_intel_err_hdr entry_ihdr = {};
+
+ xe_cper_init_intel_err_hdr(xe,
+ (const u8 *)&einfo_arr[i].hdr.error_class,
+ einfo_arr[i].timestamp,
+ sig_id,
+ einfo_arr[i].hdr.counter,
+ &entry_ihdr);
+
+ xe_cper_record_emit(xe, severity, &INTEL_CPER_NOTIFY_GPU_ERROR,
+ &entry_ihdr, einfo_arr[i].einfo,
+ einfo_arr[i].einfo_size);
+ }
+ } else {
+ xe_cper_init_intel_err_hdr(xe,
+ (const u8 *)error_class,
+ counter_response->timestamp,
+ sig_id,
+ counter_response->value,
+ &ihdr);
+ xe_cper_record_emit(xe, severity, &INTEL_CPER_NOTIFY_GPU_ERROR,
+ &ihdr, NULL, 0);
+ }
+
+ if (einfo_arr) {
+ for (i = 0; i < einfo_count; i++)
+ kfree(einfo_arr[i].einfo);
+ kfree(einfo_arr);
+ }
+}
+
/**
* xe_ras_process_errors() - Process and contain hardware errors
* @xe: xe device instance
@@ -886,6 +974,10 @@ int xe_ras_get_counter(struct xe_device *xe, u8 severity, u8 component, u32 *val
return ret;
*value = response.value;
+
+ emit_hw_error_cper(xe, &counter, &response,
+ ras_comp_to_hw_sigid(counter.common.component),
+ ras_sev_to_cper_sev(counter.common.severity));
return 0;
}
--
2.54.0
next prev parent reply other threads:[~2026-08-25 17:42 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-25 17:59 [PATCH v2 00/11] Add CPER logging support for CRI Badal Nilawar
2026-08-25 17:59 ` [PATCH v2 01/11] drm/xe/xe_ras: Add support to retrieve info queue data " Badal Nilawar
2026-08-25 17:53 ` sashiko-bot
2026-08-26 0:54 ` Rodrigo Vivi
2026-08-25 20:48 ` Michal Wajdeczko
2026-08-25 17:59 ` [PATCH v2 02/11] drm/xe/xe_ras: Refactor get_counter() to return response structure Badal Nilawar
2026-08-25 17:59 ` [PATCH v2 03/11] drm/xe/cper: Add CPER structures and trace event Badal Nilawar
2026-08-25 17:51 ` sashiko-bot
2026-08-28 15:23 ` Rodrigo Vivi
2026-08-25 17:59 ` [PATCH v2 04/11] drm/xe/cper: APIs to prepare and log CPER record Badal Nilawar
2026-08-25 18:02 ` sashiko-bot
2026-08-26 0:59 ` Rodrigo Vivi
2026-08-25 17:59 ` [PATCH v2 05/11] drm/xe/cper: Prepare Intel CPER error info from info queue Badal Nilawar
2026-08-25 17:54 ` sashiko-bot
2026-08-25 17:59 ` Badal Nilawar [this message]
2026-08-25 17:55 ` [PATCH v2 06/11] drm/xe/cper: Log CPER records for aggregate counter retrival sashiko-bot
2026-08-26 1:01 ` Rodrigo Vivi
2026-08-25 17:59 ` [PATCH v2 07/11] drm/xe/cper: Allow hardware error CPER reporting from xe_log Badal Nilawar
2026-08-25 17:54 ` sashiko-bot
2026-08-27 21:27 ` Michal Wajdeczko
2026-08-25 17:59 ` [PATCH v2 08/11] drm/xe/ras: Report device memory errors using SIGID Badal Nilawar
2026-08-25 17:58 ` sashiko-bot
2026-08-27 20:25 ` Michal Wajdeczko
2026-08-25 17:59 ` [PATCH v2 09/11] drm/xe/ras: Report core compute " Badal Nilawar
2026-08-25 17:55 ` sashiko-bot
2026-08-25 17:59 ` [PATCH v2 10/11] drm/xe/ras: Report soc internal " Badal Nilawar
2026-08-28 15:20 ` Rodrigo Vivi
2026-08-25 17:59 ` [PATCH v2 11/11] drm/xe/ras: Report correctable " Badal Nilawar
2026-08-25 18:03 ` sashiko-bot
2026-08-25 18:29 ` ✗ CI.checkpatch: warning for Add CPER logging support for CRI (rev2) Patchwork
2026-08-25 18:31 ` ✓ CI.KUnit: success " Patchwork
2026-08-25 19:25 ` ✓ Xe.CI.BAT: " Patchwork
2026-08-25 22:06 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-08-26 19:50 ` [PATCH v2 00/11] Add CPER logging support for CRI Matt Roper
2026-08-27 20:12 ` Rodrigo Vivi
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=20260825175916.1103841-19-badal.nilawar@intel.com \
--to=badal.nilawar@intel.com \
--cc=anshuman.gupta@intel.com \
--cc=aravind.iddamsetty@intel.com \
--cc=arvind.yadav@intel.com \
--cc=daniele.ceraolospurio@intel.com \
--cc=himal.prasad.ghimiray@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=mallesh.koujalagi@intel.com \
--cc=michal.wajdeczko@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