Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Nilawar, Badal" <badal.nilawar@intel.com>
To: Mallesh Koujalagi <mallesh.koujalagi@intel.com>,
	<intel-xe@lists.freedesktop.org>, <rodrigo.vivi@intel.com>,
	<matthew.brost@intel.com>
Cc: <anshuman.gupta@intel.com>, <vinay.belgaumkar@intel.com>,
	<riana.tauro@intel.com>, <karthik.poosa@intel.com>,
	<sk.anirban@intel.com>, <raag.jadav@intel.com>,
	<aravind.iddamsetty@linux.intel.com>,
	<jani.nikula@linux.intel.com>
Subject: Re: [PATCH v4 2/6] drm/xe/cper: Prepare CPER headers for software errors
Date: Tue, 17 Nov 2026 11:19:12 +0530	[thread overview]
Message-ID: <15eee851-2dc4-4ee4-8e7f-12eceb43f54e@intel.com> (raw)
In-Reply-To: <20261112134636.1860446-10-mallesh.koujalagi@intel.com>


On 12-11-2026 19:16, Mallesh Koujalagi wrote:
> Add software error classification support and reuse the
> common CPER header initialization path.
>
> Cc: Badal Nilawar <badal.nilawar@intel.com>
> Signed-off-by: Mallesh Koujalagi <mallesh.koujalagi@intel.com>
> ---
> v2:
> - Move union inside xe_cper_intel_hdr structure. (Badal)
>
> v3:
> - Introduce structure where it's used. (Badal)
> - Move error-class union inside cper_init_intel_hdr. (Badal)
>
> v4:
> - Update commit message. (Badal)
> - Use ktime_get_real_ns.
> - Add BUILD_BUG_ON. (Raag)
> ---
>   drivers/gpu/drm/xe/xe_cper.c       | 24 ++++++++++++++++++---
>   drivers/gpu/drm/xe/xe_cper_types.h | 34 ++++++++++++++++++++++++++++--
>   2 files changed, 53 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_cper.c b/drivers/gpu/drm/xe/xe_cper.c
> index dd6d4251dd1d..b23f8bc9f993 100644
> --- a/drivers/gpu/drm/xe/xe_cper.c
> +++ b/drivers/gpu/drm/xe/xe_cper.c
> @@ -14,6 +14,8 @@
>   #include <linux/time.h>
>   #include <linux/timekeeping.h>
>   
> +#include "abi/xe_log_abi.h"
> +
>   #include "xe_cper.h"
>   #include "xe_cper_types.h"
>   #include "xe_device.h"
> @@ -92,11 +94,14 @@ static u64 cper_timestamp_now(void)
>   	return ts;
>   }
>   
> -static void cper_init_intel_hdr(struct xe_device *xe, const struct xe_ras_error_class *counter,
> +static void cper_init_intel_hdr(struct xe_device *xe, const union xe_cper_error_class *error_class,
>   				u64 first_timestamp, u32 sig_id, u32 error_count,
>   				struct xe_cper_intel_hdr *ihdr)
>   {
> -	ihdr->counter = *counter;
> +	BUILD_BUG_ON(sizeof(struct xe_ras_error_class) !=
> +		     sizeof(struct xe_cper_driver_error_class));
> +
> +	ihdr->error_class = *error_class;
>   	ihdr->validation_bits |= XE_CPER_VALID_LOCATION;
>   	ihdr->sig_id = U32_MAX;
>   
> @@ -219,11 +224,12 @@ void xe_cper_emit_counter(struct xe_device *xe, int cper_sev, enum xe_sigid sigi
>   			  const struct xe_ras_error_class *counter,
>   			  const struct xe_ras_get_counter_response *response)
>   {
> +	union xe_cper_error_class error_class = { .counter = *counter };
>   	struct xe_cper_intel_hdr ihdr = {};
>   
>   	xe_assert(xe, is_hw_sigid(sigid));
>   
> -	cper_init_intel_hdr(xe, counter, response->timestamp,
> +	cper_init_intel_hdr(xe, &error_class, response->timestamp,
>   			    sigid, response->value, &ihdr);

This can go in single line.

>   	cper_record_emit(xe, cper_sev, &INTEL_CPER_NOTIFY_GPU_ERROR, &ihdr, NULL, 0);
>   }
> @@ -249,6 +255,18 @@ static void cper_emit_sw_err(struct xe_device *xe, int cper_sev, enum xe_sigid s
>   			     u32 component, u32 location, const void *data,
>   			     struct va_format *vaf)
>   {
> +	union xe_cper_error_class error_class = {};
> +	struct xe_cper_intel_hdr ihdr = {};
> +	struct xe_cper_driver_error_class *driver = &error_class.driver;
> +	u64 timestamp = ktime_get_real_ns();

Same as rev3: Initialize timestamp closer to its use. Please do the same 
for driver and maintain reverse Christmas tree ordering.

> +
> +	driver->error_type = cper_sev;
> +	driver->error_component = component;
> +	driver->tile = location;
> +	if (IS_ERR(data))
> +		driver->cause = -PTR_ERR(data);
> +
> +	cper_init_intel_hdr(xe, &error_class, timestamp, sigid, 1, &ihdr);
>   }
>   
>   /**
> diff --git a/drivers/gpu/drm/xe/xe_cper_types.h b/drivers/gpu/drm/xe/xe_cper_types.h
> index 68e30df0440e..8e90a3220919 100644
> --- a/drivers/gpu/drm/xe/xe_cper_types.h
> +++ b/drivers/gpu/drm/xe/xe_cper_types.h
> @@ -45,6 +45,29 @@
>   	GUID_INIT(0xea9d8f84, 0x4258, 0x5227, \
>   		  0x80, 0x28, 0xb9, 0xb1, 0x3e, 0x6d, 0x58, 0xb0)
>   
> +/**
> + * struct xe_cper_driver_error_class - Intel GPU CPER driver-detected error classification
> + */
> +struct xe_cper_driver_error_class {
> +	/** @error_type: CPER severity: CPER_SEV_* */
> +	u8  error_type;
> +	/** @reserved0: Reserved, must be zero */
> +	u8  reserved0;
> +	/** @error_component: Driver component id: CLASS[7:0].TYPE[15:8] */
> +	u16 error_component;
> +	/** @tile: Driver location id: TYPE[7:0].ID[15:8] ('tile' and 'GT' field region) */
> +	u16 tile;
> +	/** @reserved1: Reserved, must be zero */
> +	u16 reserved1;
> +	/** @cause: errno of the failing operation, or 0 if none */
> +	u32 cause;
> +};
> +
> +/* Same size as the counter-sourced error_class */
> +#define XE_CPER_ERROR_CLASS_SIZE	12
> +
> +static_assert(sizeof(struct xe_cper_driver_error_class) == XE_CPER_ERROR_CLASS_SIZE);
> +
>   /**
>    * struct xe_cper_intel_hdr - Intel-specific CPER header
>    *
> @@ -52,8 +75,15 @@
>    * All multi-byte fields are little-endian.
>    */
>   struct xe_cper_intel_hdr {
> -	/** @counter: Error class (severity, component, location, cause) */
> -	struct xe_ras_error_class counter;
> +	/** @error_class: Error classification */
> +	union xe_cper_error_class {
> +		/** @error_class.counter: Error class (severity, component,
> +		 * location, cause)
> +		 */

Keep this in single line.

Thanks,
Badal

> +		struct xe_ras_error_class counter;
> +		/** @error_class.driver: Driver-detected error classification */
> +		struct xe_cper_driver_error_class driver;
> +	} error_class;
>   	/** @first_timestamp: First occurrence of this error class, in ticks */
>   	u64 first_timestamp;
>   	/** @sig_id: Aggregated error class SIG ID; set to U32_MAX if unknown */

  reply	other threads:[~2026-11-17  5:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12 13:46 [PATCH v4 0/6] drm/xe/cper: Software (driver-detected) CPER error reporting Mallesh Koujalagi
2026-11-12 13:46 ` [PATCH v4 1/6] drm/xe/cper: Add software CPER emission entry point Mallesh Koujalagi
2026-11-17  7:30   ` Nilawar, Badal
2026-11-17  8:48     ` Mallesh, Koujalagi
2026-11-12 13:46 ` [PATCH v4 2/6] drm/xe/cper: Prepare CPER headers for software errors Mallesh Koujalagi
2026-11-17  5:49   ` Nilawar, Badal [this message]
2026-11-17  6:38     ` Mallesh, Koujalagi
2026-11-12 13:46 ` [PATCH v4 3/6] drm/xe/cper: Emit software CPER records Mallesh Koujalagi
2026-11-17  7:34   ` Nilawar, Badal
2026-11-17 12:38     ` Mallesh, Koujalagi
2026-11-12 13:46 ` [PATCH v4 4/6] drm/xe/cper: Make software CPER emission atomic-safe Mallesh Koujalagi
2026-11-12 13:46 ` [PATCH v4 5/6] drm/xe/log: Add software CPER information to KUnit output Mallesh Koujalagi
2026-11-18  7:33   ` Nilawar, Badal
2026-11-18  8:11     ` Mallesh, Koujalagi
2026-11-12 13:46 ` [PATCH v4 6/6] drm/xe/log: Test software CPER emission parameters Mallesh Koujalagi
2026-11-17 14:05   ` Nilawar, Badal
2026-11-12 14:21 ` ✓ CI.KUnit: success for drm/xe/cper: Software (driver-detected) CPER error reporting (rev4) Patchwork
2026-11-12 14:57 ` ✓ Xe.CI.BAT: " Patchwork
2026-11-12 23:17 ` ✓ Xe.CI.FULL: " Patchwork

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=15eee851-2dc4-4ee4-8e7f-12eceb43f54e@intel.com \
    --to=badal.nilawar@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=aravind.iddamsetty@linux.intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=karthik.poosa@intel.com \
    --cc=mallesh.koujalagi@intel.com \
    --cc=matthew.brost@intel.com \
    --cc=raag.jadav@intel.com \
    --cc=riana.tauro@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=sk.anirban@intel.com \
    --cc=vinay.belgaumkar@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