Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Raag Jadav <raag.jadav@intel.com>
To: Badal Nilawar <badal.nilawar@intel.com>
Cc: intel-xe@lists.freedesktop.org, anshuman.gupta@intel.com,
	rodrigo.vivi@intel.com, daniele.ceraolospurio@intel.com,
	riana.tauro@intel.com, mallesh.koujalagi@intel.com,
	aravind.iddamsetty@intel.com, himal.prasad.ghimiray@intel.com,
	arvind.yadav@intel.com, syed.abdul.muqthyar.ahmed@intel.com,
	nitin.r.gote@intel.com, pravalika.gurram@intel.com
Subject: Re: [PATCH v4 03/12] drm/xe/cper: Initialize Intel-specific error section header
Date: Wed, 14 Oct 2026 09:27:06 +0200	[thread overview]
Message-ID: <as8uythXLgwkWbrN@black.igk.intel.com> (raw)
In-Reply-To: <20261009104602.1075405-17-badal.nilawar@intel.com>

On Fri, Oct 09, 2026 at 04:16:06PM +0530, Badal Nilawar wrote:
> Define the Intel-specific CPER error section header and initialize it

Nit: redundant 'error'.

> from the error counter record for Intel GPU hardware errors.
> 
> Assisted-by: Copilot:Claude-Opus-5.5
> Signed-off-by: Badal Nilawar <badal.nilawar@intel.com>
> ---
> v4:
>  - Split from "drm/xe/cper: Prepare CPER record" (Raag)
>  - Add dedicated struct xe_cper_error_class (Michal)
>  - Drop empty fill_fw_id() stub, leave a TODO instead
> v2:
>  - Guard against NULL THIS_MODULE->srcversion (sashiko)
> ---
>  drivers/gpu/drm/xe/xe_cper.c       | 43 ++++++++++++++++++
>  drivers/gpu/drm/xe/xe_cper_types.h | 72 ++++++++++++++++++++++++++++++
>  2 files changed, 115 insertions(+)
>  create mode 100644 drivers/gpu/drm/xe/xe_cper_types.h
> 
> diff --git a/drivers/gpu/drm/xe/xe_cper.c b/drivers/gpu/drm/xe/xe_cper.c
> index 4f0ed5096aac..e7cae449b349 100644
> --- a/drivers/gpu/drm/xe/xe_cper.c
> +++ b/drivers/gpu/drm/xe/xe_cper.c
> @@ -6,8 +6,10 @@
>  #include <linux/err.h>
>  #include <linux/kernel.h>
>  #include <linux/minmax.h>
> +#include <linux/pci.h>
>  
>  #include "xe_cper.h"
> +#include "xe_cper_types.h"
>  #include "xe_device.h"
>  #include "xe_printk.h"
>  #include "xe_ras.h"
> @@ -18,9 +20,47 @@ static bool is_hw_sigid(enum xe_sigid sigid)
>  	return in_range(sigid, INTEL_SIGID_GPU_XE_HARDWARE_START, INTEL_SIGID_BATCH);
>  }
>  
> +static void xe_cper_init_intel_err_hdr(struct xe_device *xe,

'err' is redundant. Let's not invent unnecessarily long names that warrant
ugly wrapping.

> +				       const struct xe_ras_error_class *error_class,

Ditto, 'counter'.

> +				       u64 first_timestamp, u32 sig_id, u32 error_count,
> +				       struct xe_cper_sec_intel_err_hdr *ihdr)
> +{
> +	ihdr->error_class.error_type = error_class->common.severity;
> +	ihdr->error_class.error_component = error_class->common.component;
> +	ihdr->error_class.tile = error_class->product.unit.tile;
> +	ihdr->error_class.instance = error_class->product.unit.instance;
> +	ihdr->error_class.cause = error_class->product.cause.cause;
> +	ihdr->validation_bits |= XE_CPER_VALID_LOCATION;
> +
> +	if (first_timestamp) {
> +		ihdr->first_timestamp = first_timestamp;
> +		ihdr->validation_bits |= XE_CPER_VALID_FIRST_TIMESTAMP;
> +	}
> +
> +	if (sig_id != U32_MAX) {

Shouldn't this be is_sigid_valid() or something?

> +		ihdr->sig_id = sig_id;
> +		ihdr->validation_bits |= XE_CPER_VALID_SIG_ID;
> +	}
> +
> +	ihdr->error_count = error_count;
> +
> +	strscpy(ihdr->pci_bdf, pci_name(to_pci_dev(xe->drm.dev)), sizeof(ihdr->pci_bdf));
> +	ihdr->validation_bits |= XE_CPER_VALID_PCI_BDF;
> +
> +#ifdef MODULE
> +	if (THIS_MODULE->srcversion) {
> +		strscpy(ihdr->drv_version, THIS_MODULE->srcversion, sizeof(ihdr->drv_version));
> +		ihdr->validation_bits |= XE_CPER_VALID_DRV_VERSION;
> +	}
> +#endif
> +
> +	/* TODO: fill fw_id and set XE_CPER_VALID_FW_ID */
> +}
> +
>  static void xe_cper_emit_hw_err(struct xe_device *xe, int cper_sev, enum xe_sigid sigid,
>  				const struct xe_ras_error_class *error_class)
>  {
> +	struct xe_cper_sec_intel_err_hdr ihdr = {};
>  	struct xe_ras_get_counter_response local_resp;
>  
>  	/* Fetching the counter sends a sysctrl command */
> @@ -31,6 +71,9 @@ static void xe_cper_emit_hw_err(struct xe_device *xe, int cper_sev, enum xe_sigi
>  		xe_err(xe, "CPER: failed to get counter, skipping record\n");
>  		return;
>  	}
> +
> +	xe_cper_init_intel_err_hdr(xe, error_class, local_resp.timestamp,
> +				   sigid, local_resp.value, &ihdr);
>  }
>  
>  /**
> diff --git a/drivers/gpu/drm/xe/xe_cper_types.h b/drivers/gpu/drm/xe/xe_cper_types.h
> new file mode 100644
> index 000000000000..74307e7f78a2
> --- /dev/null
> +++ b/drivers/gpu/drm/xe/xe_cper_types.h
> @@ -0,0 +1,72 @@
> +/* SPDX-License-Identifier: MIT */
> +/*
> + * Copyright © 2026 Intel Corporation
> + */
> +
> +#ifndef _XE_CPER_TYPES_H_
> +#define _XE_CPER_TYPES_H_
> +
> +#include <linux/types.h>
> +
> +/*
> + * Validation bits definition for validation_bits in struct
> + * xe_cper_sec_intel_err_hdr. When set, corresponding fields in header
> + * contains valid data
> + */
> +#define XE_CPER_VALID_LOCATION		0x0001
> +#define XE_CPER_VALID_FIRST_TIMESTAMP	0x0002
> +#define XE_CPER_VALID_SIG_ID		0x0004
> +#define XE_CPER_VALID_PCI_BDF		0x0008
> +#define XE_CPER_VALID_DRV_VERSION	0x0010
> +#define XE_CPER_VALID_FW_ID		0x0020

Introduce in the patch you actually use it.

> +#pragma pack(push, 1)

I'd rather use __packed for individual structs, so I know it's an ABI
without fumbling through the header without my coffee :)

Although the long term plan is to move all of them inside xe/abi directory,
but only when they become stable.

> +/**
> + * struct xe_cper_error_class - Intel GPU CPER error classification
> + */
> +struct xe_cper_error_class {
> +	/** @error_type: RAS error severity */
> +	u8  error_type;
> +	/** @error_component: IP block that raised the error */
> +	u8  error_component;
> +	/** @tile: Tile number */
> +	u8  tile;
> +	/** @instance: Instance within the tile */
> +	u32 instance;
> +	/** @cause: Error cause code */
> +	u32 cause;
> +	/** @reserved: Reserved, must be zero */
> +	u8  reserved;
> +};
> +
> +/**
> + * struct xe_cper_sec_intel_err_hdr - Intel-specific CPER error section header
> + *
> + * Fixed-size header for the Intel GPU error section of a CPER record.
> + * All multi-byte fields are little-endian; the structure is packed.
> + */
> +struct xe_cper_sec_intel_err_hdr {

Same as above, drop the 'err'.

> +	/** @error_class: Error classification (type, component, location, cause) */
> +	struct xe_cper_error_class error_class;

Why not just reuse struct xe_ras_error_class?

Raag

> +	/** @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 */
> +	u32 sig_id;
> +	/** @error_count: Number of times this error has been observed */
> +	u32 error_count;
> +	/** @validation_bits: Raw u16 view of all valid bits */
> +	u16 validation_bits;
> +	/** @pci_bdf: PCI location string, format "DDDD:bb:dd.f" */
> +	char pci_bdf[16];
> +	/** @drv_version: Driver source version string (THIS_MODULE->srcversion) */
> +	char drv_version[25];
> +	/** @fw_id: Firmware version string (GFSP+PCODE+CSC+GUC or MNG+NUC+RAS+GUC) */
> +	char fw_id[256];
> +	/** @reserved: Reserved for future use, must be zero */
> +	u8 reserved[5];
> +};
> +
> +#pragma pack(pop)
> +
> +#endif
> -- 
> 2.54.0
> 

  reply	other threads:[~2026-10-14  7:27 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-09 10:46 [PATCH v4 00/12] Add CPER logging support for CRI Badal Nilawar
2026-10-09 10:46 ` [PATCH v4 01/12] drm/xe/cper: Add CPER reporting entry point for xe_log Badal Nilawar
2026-10-09 10:43   ` sashiko-bot
2026-10-09 12:17     ` Nilawar, Badal
2026-10-12  6:18   ` Raag Jadav
2026-10-09 10:46 ` [PATCH v4 02/12] drm/xe/cper: Retrieve the error counter record for CPER reporting Badal Nilawar
2026-10-09 10:46   ` sashiko-bot
2026-10-09 12:27     ` Nilawar, Badal
2026-10-12  9:07   ` Raag Jadav
2026-10-09 10:46 ` [PATCH v4 03/12] drm/xe/cper: Initialize Intel-specific error section header Badal Nilawar
2026-10-14  7:27   ` Raag Jadav [this message]
2026-10-09 10:46 ` [PATCH v4 04/12] drm/xe/cper: Construct CPER record for hardware errors Badal Nilawar
2026-10-14 10:30   ` Raag Jadav
2026-10-09 10:46 ` [PATCH v4 05/12] drm/xe/xe_ras: Add support to retrieve info queue data for CRI Badal Nilawar
2026-10-09 10:40   ` sashiko-bot
2026-10-09 12:45     ` Nilawar, Badal
2026-10-09 10:46 ` [PATCH v4 06/12] drm/xe/cper: Prepare Intel CPER error info records Badal Nilawar
2026-10-09 10:41   ` sashiko-bot
2026-10-09 13:07     ` Nilawar, Badal
2026-10-09 10:46 ` [PATCH v4 07/12] drm/xe/cper: Log CPER records for aggregate counter retrieval Badal Nilawar
2026-10-09 10:46 ` [PATCH v4 08/12] drm/xe/cper: Emit cper record to trace buf Badal Nilawar
2026-10-09 10:38   ` sashiko-bot
2026-10-09 10:46 ` [PATCH v4 09/12] drm/xe/xe_ras: Report device memory errors using SIGID Badal Nilawar
2026-10-14  9:05   ` Mallesh, Koujalagi
2026-10-09 10:46 ` [PATCH v4 10/12] drm/xe/xe_ras: Report core compute " Badal Nilawar
2026-10-14  9:28   ` Mallesh, Koujalagi
2026-10-14  9:30     ` Tauro, Riana
2026-10-09 10:46 ` [PATCH v4 11/12] drm/xe/xe_ras: Report soc internal " Badal Nilawar
2026-10-14  9:31   ` Mallesh, Koujalagi
2026-10-09 10:46 ` [PATCH v4 12/12] drm/xe/xe_ras: Report correctable " Badal Nilawar
2026-10-09 10:50   ` sashiko-bot
2026-10-09 10:54 ` ✗ CI.checkpatch: warning for Add CPER logging support for CRI (rev4) Patchwork
2026-10-09 10:56 ` ✓ CI.KUnit: success " Patchwork
2026-10-09 12:03 ` ✗ Xe.CI.BAT: failure " Patchwork
2026-10-09 15:13 ` ✓ Xe.CI.FULL: success " Patchwork
2026-10-12  6:14 ` [PATCH v4 00/12] Add CPER logging support for CRI Raag Jadav

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=as8uythXLgwkWbrN@black.igk.intel.com \
    --to=raag.jadav@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=aravind.iddamsetty@intel.com \
    --cc=arvind.yadav@intel.com \
    --cc=badal.nilawar@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=nitin.r.gote@intel.com \
    --cc=pravalika.gurram@intel.com \
    --cc=riana.tauro@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=syed.abdul.muqthyar.ahmed@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