Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ghimiray, Himal Prasad" <himal.prasad.ghimiray@intel.com>
To: Riana Tauro <riana.tauro@intel.com>, <intel-xe@lists.freedesktop.org>
Cc: <anshuman.gupta@intel.com>, <rodrigo.vivi@intel.com>,
	<aravind.iddamsetty@linux.intel.com>, <badal.nilawar@intel.com>,
	<raag.jadav@intel.com>, <ravi.kishore.koppuravuri@intel.com>,
	<mallesh.koujalagi@intel.com>, <tejas.upadhyay@intel.com>
Subject: Re: [PATCH v3 3/6] drm/xe: Separate drm-ras netlink data from device and firmware RAS state
Date: Mon, 28 Sep 2026 14:29:55 +0530	[thread overview]
Message-ID: <b638e726-8768-497b-bdea-975b64c4ae43@intel.com> (raw)
In-Reply-To: <20260928061830.417395-11-riana.tauro@intel.com>



On 28-09-2026 11:48, Riana Tauro wrote:
> Keep the DRM RAS data used for netlink reporting separate from the
> device and firmware RAS state in xe_device.
> 
> Signed-off-by: Riana Tauro <riana.tauro@intel.com>
> ---
> v2: remove inline function (Himal)
> ---
>   drivers/gpu/drm/xe/xe_device_types.h  | 11 +++++++++--
>   drivers/gpu/drm/xe/xe_drm_ras.c       | 16 ++++++++--------
>   drivers/gpu/drm/xe/xe_drm_ras_types.h |  3 ---
>   drivers/gpu/drm/xe/xe_hw_error.c      |  6 +++---
>   drivers/gpu/drm/xe/xe_ras.c           | 26 ++++++++++++++++++--------
>   drivers/gpu/drm/xe/xe_ras.h           |  2 ++
>   drivers/gpu/drm/xe/xe_ras_types.h     | 10 ++++++++++
>   drivers/gpu/drm/xe/xe_ttm_vram_mgr.c  |  3 ++-
>   8 files changed, 52 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_device_types.h b/drivers/gpu/drm/xe/xe_device_types.h
> index bb4234f00453..c0b53af9bdd6 100644
> --- a/drivers/gpu/drm/xe/xe_device_types.h
> +++ b/drivers/gpu/drm/xe/xe_device_types.h
> @@ -21,6 +21,7 @@
>   #include "xe_platform_types.h"
>   #include "xe_pmu_types.h"
>   #include "xe_pt_types.h"
> +#include "xe_ras_types.h"
>   #include "xe_sriov_pf_types.h"
>   #include "xe_sriov_types.h"
>   #include "xe_sriov_vf_types.h"
> @@ -570,8 +571,14 @@ struct xe_device {
>   	/** @pmu: performance monitoring unit */
>   	struct xe_pmu pmu;
>   
> -	/** @ras: RAS structure for device */
> -	struct xe_drm_ras ras;
> +	/** @ras: RAS (Reliability, Availability, Serviceability) structures */
> +	struct {
> +		/** @ras.nl_data: drm-ras netlink data */
> +		struct xe_drm_ras nl_data;
> +
> +		/** @ras.state: RAS device and firmware state */
> +		struct xe_ras_state state;
> +	} ras;
>   
>   	/** @i2c: I2C host controller */
>   	struct xe_i2c *i2c;
> diff --git a/drivers/gpu/drm/xe/xe_drm_ras.c b/drivers/gpu/drm/xe/xe_drm_ras.c
> index 7f3695707611..38d77561facf 100644
> --- a/drivers/gpu/drm/xe/xe_drm_ras.c
> +++ b/drivers/gpu/drm/xe/xe_drm_ras.c
> @@ -20,7 +20,7 @@ static int query_error_counter(struct xe_device *xe,
>   			       enum drm_xe_ras_error_severity severity,
>   			       u32 error_id, const char **name, u32 *val)
>   {
> -	struct xe_drm_ras *ras = &xe->ras;
> +	struct xe_drm_ras *ras = &xe->ras.nl_data;
>   	struct xe_drm_ras_counter *info = ras->info[severity];
>   
>   	if (!info || !info[error_id].name)
> @@ -41,7 +41,7 @@ static int clear_error_counter(struct xe_device *xe,
>   			       enum drm_xe_ras_error_severity severity,
>   			       u32 error_id)
>   {
> -	struct xe_drm_ras *ras = &xe->ras;
> +	struct xe_drm_ras *ras = &xe->ras.nl_data;
>   	struct xe_drm_ras_counter *info = ras->info[severity];
>   
>   	if (!info || !info[error_id].name)
> @@ -90,7 +90,7 @@ static int query_correctable_error_threshold(struct drm_ras_node *ep, u32 error_
>   					     const char **name, u32 *threshold)
>   {
>   	struct xe_device *xe = ep->priv;
> -	struct xe_drm_ras *ras = &xe->ras;
> +	struct xe_drm_ras *ras = &xe->ras.nl_data;
>   	struct xe_drm_ras_counter *info = ras->info[DRM_XE_RAS_ERR_SEV_CORRECTABLE];
>   
>   	if (!info || !info[error_id].name)
> @@ -106,7 +106,7 @@ static int query_correctable_error_threshold(struct drm_ras_node *ep, u32 error_
>   static int set_correctable_error_threshold(struct drm_ras_node *ep, u32 error_id, u32 threshold)
>   {
>   	struct xe_device *xe = ep->priv;
> -	struct xe_drm_ras *ras = &xe->ras;
> +	struct xe_drm_ras *ras = &xe->ras.nl_data;
>   	struct xe_drm_ras_counter *info = ras->info[DRM_XE_RAS_ERR_SEV_CORRECTABLE];
>   
>   	if (!info || !info[error_id].name)
> @@ -142,7 +142,7 @@ static int assign_node_params(struct xe_device *xe, struct drm_ras_node *node,
>   			      const enum drm_xe_ras_error_severity severity)
>   {
>   	struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
> -	struct xe_drm_ras *ras = &xe->ras;
> +	struct xe_drm_ras *ras = &xe->ras.nl_data;
>   	const char *device_name;
>   
>   	device_name = kasprintf(GFP_KERNEL, "%04x:%02x:%02x.%d",
> @@ -190,7 +190,7 @@ static void cleanup_node(struct drm_device *drm, void *node)
>   
>   static int register_nodes(struct xe_device *xe)
>   {
> -	struct xe_drm_ras *ras = &xe->ras;
> +	struct xe_drm_ras *ras = &xe->ras.nl_data;
>   	struct drm_ras_node *node;
>   	int i, ret;
>   
> @@ -230,7 +230,7 @@ static int register_nodes(struct xe_device *xe)
>    */
>   void xe_drm_ras_event(struct xe_device *xe, u32 component, u32 severity, u32 value)
>   {
> -	struct xe_drm_ras *ras = &xe->ras;
> +	struct xe_drm_ras *ras = &xe->ras.nl_data;
>   	struct xe_drm_ras_counter *info = ras->info[severity];
>   	struct drm_ras_node *node;
>   	int ret;
> @@ -260,7 +260,7 @@ void xe_drm_ras_event(struct xe_device *xe, u32 component, u32 severity, u32 val
>    */
>   int xe_drm_ras_init(struct xe_device *xe)
>   {
> -	struct xe_drm_ras *ras = &xe->ras;
> +	struct xe_drm_ras *ras = &xe->ras.nl_data;
>   	struct drm_ras_node *node;
>   	int err;
>   
> diff --git a/drivers/gpu/drm/xe/xe_drm_ras_types.h b/drivers/gpu/drm/xe/xe_drm_ras_types.h
> index 0be218ba2db7..8d729ad6a264 100644
> --- a/drivers/gpu/drm/xe/xe_drm_ras_types.h
> +++ b/drivers/gpu/drm/xe/xe_drm_ras_types.h
> @@ -43,9 +43,6 @@ struct xe_drm_ras {
>   
>   	/** @info: info array for all types of errors */
>   	struct xe_drm_ras_counter *info[DRM_XE_RAS_ERR_SEV_MAX];
> -
> -	/** @disable_vram_page_offline: cached configfs policy, immutable after init */
> -	bool disable_vram_page_offline;
>   };
>   
>   #endif
> diff --git a/drivers/gpu/drm/xe/xe_hw_error.c b/drivers/gpu/drm/xe/xe_hw_error.c
> index 5f2abc9485ff..f53a6b3055de 100644
> --- a/drivers/gpu/drm/xe/xe_hw_error.c
> +++ b/drivers/gpu/drm/xe/xe_hw_error.c
> @@ -240,7 +240,7 @@ static void log_soc_error(struct xe_tile *tile, const char * const *reg_info,
>   {
>   	const char *severity_str = error_severity[severity];
>   	struct xe_device *xe = tile_to_xe(tile);
> -	struct xe_drm_ras *ras = &xe->ras;
> +	struct xe_drm_ras *ras = &xe->ras.nl_data;
>   	struct xe_drm_ras_counter *info = ras->info[severity];
>   	const char *name;
>   
> @@ -260,7 +260,7 @@ static void gt_hw_error_handler(struct xe_tile *tile, const enum hardware_error
>   {
>   	const enum drm_xe_ras_error_severity severity = hw_err_to_severity(hw_err);
>   	struct xe_device *xe = tile_to_xe(tile);
> -	struct xe_drm_ras *ras = &xe->ras;
> +	struct xe_drm_ras *ras = &xe->ras.nl_data;
>   	struct xe_drm_ras_counter *info = ras->info[severity];
>   	struct xe_mmio *mmio = &tile->mmio;
>   	unsigned long err_stat = 0;
> @@ -422,7 +422,7 @@ static void hw_error_source_handler(struct xe_tile *tile, const enum hardware_er
>   	const enum drm_xe_ras_error_severity severity = hw_err_to_severity(hw_err);
>   	const char *severity_str = error_severity[severity];
>   	struct xe_device *xe = tile_to_xe(tile);
> -	struct xe_drm_ras *ras = &xe->ras;
> +	struct xe_drm_ras *ras = &xe->ras.nl_data;
>   	struct xe_drm_ras_counter *info = ras->info[severity];
>   	unsigned long flags, err_src;
>   	u32 err_bit;
> diff --git a/drivers/gpu/drm/xe/xe_ras.c b/drivers/gpu/drm/xe/xe_ras.c
> index 752754f09314..9a1a8190578b 100644
> --- a/drivers/gpu/drm/xe/xe_ras.c
> +++ b/drivers/gpu/drm/xe/xe_ras.c
> @@ -1094,6 +1094,17 @@ static const struct attribute_group gpu_health_group = {
>   	.attrs = gpu_health_attrs,
>   };
>   
> +/**
> + * xe_ras_get_disable_page_offline - Get the page offline user policy
> + * @xe: xe device instance
> + *
> + * Return: true if the page offline policy is disabled, false otherwise.
> + */
> +bool xe_ras_get_disable_page_offline(struct xe_device *xe)
> +{
> +	return xe->ras.state.disable_page_offline;
> +}
> +
>   /**
>    * xe_ras_init - Initialize Xe RAS
>    * @xe: xe device instance
> @@ -1104,19 +1115,18 @@ void xe_ras_init(struct xe_device *xe)
>   {
>   	int ret;
>   
> -	/*
> -	 * TODO: Replace platform check with xe->info.has_disable_vram_page_offline
> -	 * once the feature flag is plumbed through device info.
> -	 */
> -	if (xe->info.platform == XE_CRESCENTISLAND)
> -		xe->ras.disable_vram_page_offline =
> -			xe_configfs_get_disable_vram_page_offline(to_pci_dev(xe->drm.dev));
> -
>   	xe_drm_ras_init(xe);
>   
>   	if (!xe->info.has_sysctrl)
>   		return;
>   
> +	/*
> +	 * TODO: Replace platform check with xe->info.has_disable_vram_page_offline
> +	 * once the feature flag is plumbed through device info.
> +	 */
> +	xe->ras.state.disable_page_offline =
> +		xe_configfs_get_disable_vram_page_offline(to_pci_dev(xe->drm.dev));
> +
>   	if (IS_ENABLED(CONFIG_PCIEAER))
>   		ras_usp_aer_init(xe);
>   
> diff --git a/drivers/gpu/drm/xe/xe_ras.h b/drivers/gpu/drm/xe/xe_ras.h
> index 0b8669f28d56..ac1253d6ead9 100644
> --- a/drivers/gpu/drm/xe/xe_ras.h
> +++ b/drivers/gpu/drm/xe/xe_ras.h
> @@ -7,6 +7,7 @@
>   #define _XE_RAS_H_
>   
>   #include <linux/types.h>
> +
>   #include "xe_ras_types.h"
>   
>   struct xe_device;
> @@ -20,5 +21,6 @@ int xe_ras_get_threshold(struct xe_device *xe, u8 severity, u8 component, u32 *t
>   int xe_ras_set_threshold(struct xe_device *xe, u8 severity, u8 component, u32 threshold);
>   void xe_ras_init(struct xe_device *xe);
>   enum xe_ras_recovery_action xe_ras_process_errors(struct xe_device *xe);
> +bool xe_ras_get_disable_page_offline(struct xe_device *xe);
>   
>   #endif
> diff --git a/drivers/gpu/drm/xe/xe_ras_types.h b/drivers/gpu/drm/xe/xe_ras_types.h
> index 021ffbd6d4e2..40224db38906 100644
> --- a/drivers/gpu/drm/xe/xe_ras_types.h
> +++ b/drivers/gpu/drm/xe/xe_ras_types.h
> @@ -406,4 +406,14 @@ struct xe_ras_set_health_response {
>   	/** @reserved1: Reserved for future use */
>   	u32 reserved1[2];
>   } __packed;
> +
> +/* Device structures */
> +
> +/**
> + * struct xe_ras_state - RAS device and firmware state
> + */
> +struct xe_ras_state {
> +	/** @disable_page_offline: cached configfs policy, immutable after init */
> +	bool disable_page_offline;
> +};
>   #endif
> diff --git a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c b/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c
> index 9a514d983e90..2c4722a956a0 100644
> --- a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c
> +++ b/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c
> @@ -24,6 +24,7 @@
>   #include "xe_mmio.h"
>   #include "xe_pm.h"
>   #include "xe_printk.h"
> +#include "xe_ras.h"
>   #include "xe_res_cursor.h"
>   #include "xe_ttm_stolen_mgr.h"
>   #include "xe_ttm_vram_mgr.h"
> @@ -933,7 +934,7 @@ int xe_ttm_vram_handle_addr_fault(struct xe_device *xe, u64 addr)
>   	vram_mgr = &vr->ttm;
>   	mm = &vram_mgr->mm;
>   
> -	if (xe->ras.disable_vram_page_offline) {
> +	if (xe_ras_get_disable_page_offline(xe)) {
>   		xe_err(xe, "0x%llx is reported as corrupted address by HW\n",
>   		       addr);

Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>

>   		return -EOPNOTSUPP;


  parent reply	other threads:[~2026-09-28  9:00 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-28  6:18 [PATCH v3 0/6] Add support to handle memory double-bit ecc errors Riana Tauro
2026-09-28  6:18 ` [PATCH v3 1/6] drm/xe/xe_ras: Handle page offline requests for device memory " Riana Tauro
2026-09-28  6:34   ` sashiko-bot
2026-09-28  8:55   ` Ghimiray, Himal Prasad
2026-10-01 10:50   ` Upadhyay, Tejas
2026-10-01 11:27     ` Tauro, Riana
2026-09-28  6:18 ` [PATCH v3 2/6] drm/xe/xe_ras: Add support to query page offline queue and list Riana Tauro
2026-09-28  6:35   ` sashiko-bot
2026-10-01 11:24   ` Upadhyay, Tejas
2026-10-01 11:37     ` Tauro, Riana
2026-10-01 12:11   ` Ghimiray, Himal Prasad
2026-09-28  6:18 ` [PATCH v3 3/6] drm/xe: Separate drm-ras netlink data from device and firmware RAS state Riana Tauro
2026-09-28  6:51   ` sashiko-bot
2026-09-28  8:59   ` Ghimiray, Himal Prasad [this message]
2026-09-28  6:18 ` [PATCH v3 4/6] drm/xe/xe_ras: Add function to get maximum pages firmware can store Riana Tauro
2026-09-28  6:43   ` sashiko-bot
2026-10-01 11:36   ` Upadhyay, Tejas
2026-10-01 11:40     ` Tauro, Riana
2026-09-28  6:18 ` [PATCH v3 5/6] drm/xe/xe_ttm_vram: Report max_pages reported by firmware to userspace Riana Tauro
2026-10-01 11:37   ` Upadhyay, Tejas
2026-09-28  6:18 ` [PATCH v3 6/6] drm/xe/xe_ras: Track offlined pages by firmware to avoid duplicates Riana Tauro
2026-09-28  7:07   ` sashiko-bot
2026-09-28  9:00   ` Ghimiray, Himal Prasad
2026-09-28  9:17     ` Ghimiray, Himal Prasad
2026-09-28  9:22       ` Tauro, Riana
2026-09-28 14:42 ` ✓ CI.KUnit: success for Add support to handle memory double-bit ecc errors (rev3) Patchwork
2026-09-28 15:27 ` ✓ Xe.CI.BAT: " Patchwork
2026-09-28 17:40 ` ✓ 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=b638e726-8768-497b-bdea-975b64c4ae43@intel.com \
    --to=himal.prasad.ghimiray@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=aravind.iddamsetty@linux.intel.com \
    --cc=badal.nilawar@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=mallesh.koujalagi@intel.com \
    --cc=raag.jadav@intel.com \
    --cc=ravi.kishore.koppuravuri@intel.com \
    --cc=riana.tauro@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=tejas.upadhyay@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