public inbox for intel-xe@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Raag Jadav <raag.jadav@intel.com>
To: Mallesh Koujalagi <mallesh.koujalagi@intel.com>
Cc: intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	rodrigo.vivi@intel.com, andrealmeid@igalia.com,
	christian.koenig@amd.com, airlied@gmail.com,
	simona.vetter@ffwll.ch, mripard@kernel.org,
	anshuman.gupta@intel.com, badal.nilawar@intel.com,
	riana.tauro@intel.com, karthik.poosa@intel.com,
	sk.anirban@intel.com
Subject: Re: [PATCH v2 4/5] drm/xe: Add handler for power management unit errors which require cold-reset
Date: Thu, 2 Apr 2026 10:19:19 +0200	[thread overview]
Message-ID: <ac4mh_Izd06T0hUF@black.igk.intel.com> (raw)
In-Reply-To: <20260318064016.374656-11-mallesh.koujalagi@intel.com>

On Wed, Mar 18, 2026 at 12:10:21PM +0530, Mallesh Koujalagi wrote:
> This handler is designed to be called when power management unit errors are
> detected that affect device-level state persisting across warm resets. The
> cold reset recovery method signals to userspace that only a complete device
> power cycle can restore normal operation.
> 
> v2:
> - Add use case: Handling errors from power management unit,
>   which requires a complete power cycle (cold reset)
>   to recover. (Christian)
> 
> Signed-off-by: Mallesh Koujalagi <mallesh.koujalagi@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_hw_error.c | 27 +++++++++++++++++++++++++++
>  drivers/gpu/drm/xe/xe_hw_error.h |  1 +
>  drivers/gpu/drm/xe/xe_ras.c      |  3 ++-
>  3 files changed, 30 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_hw_error.c b/drivers/gpu/drm/xe/xe_hw_error.c
> index 2a31b430570e..ca965a2b092c 100644
> --- a/drivers/gpu/drm/xe/xe_hw_error.c
> +++ b/drivers/gpu/drm/xe/xe_hw_error.c
> @@ -5,6 +5,7 @@
>  
>  #include <linux/bitmap.h>
>  #include <linux/fault-inject.h>

Blank line to distinguish between linux and drm includes.

> +#include <drm/drm_drv.h>
>  
>  #include "regs/xe_gsc_regs.h"
>  #include "regs/xe_hw_error_regs.h"
> @@ -542,6 +543,32 @@ static void process_hw_errors(struct xe_device *xe)
>  	}
>  }
>  
> +/**
> + * xe_punit_error_handler - Handler for power management unit errors
> + * @xe: device instance
> + *
> + * Handles power management unit errors that affect the device and cannot
> + * be recovered through driver reload, PCIe reset, etc.
> + *
> + * Marks the device as wedged with DRM_WEDGE_RECOVERY_COLD_RESET method
> + * and notifies userspace that a complete device power cycle is required.
> + */
> +void xe_punit_error_handler(struct xe_device *xe)
> +{
> +	drm_err(&xe->drm, "CRITICAL: PMU error detected\n");
> +	drm_err(&xe->drm, "Recovery: Device cold reset required\n");

The caller is already printing these so we'd want to avoid dmesg spam.

> +	/* Set cold reset recovery method */

Comments are more useful for something that's not obvious from the code,
so we try to make the code as self documenting as possible.

> +	xe_device_set_wedged_method(xe, DRM_WEDGE_RECOVERY_COLD_RESET);
> +
> +	if (xe_device_wedged(xe)) {

We should not be at this point if the device is already wedged, so I
believe this needs to be handled somewhere upstream.

> +		drm_dev_wedged_event(&xe->drm, xe->wedged.method, NULL);
> +	} else {
> +		/* Declare device wedged - will trigger uevent with cold reset method */

Same as above.

Raag

> +		xe_device_declare_wedged(xe);
> +	}
> +}
> +
>  /**
>   * xe_hw_error_init - Initialize hw errors
>   * @xe: xe device instance
> diff --git a/drivers/gpu/drm/xe/xe_hw_error.h b/drivers/gpu/drm/xe/xe_hw_error.h
> index d86e28c5180c..f588320eb94d 100644
> --- a/drivers/gpu/drm/xe/xe_hw_error.h
> +++ b/drivers/gpu/drm/xe/xe_hw_error.h
> @@ -11,5 +11,6 @@ struct xe_tile;
>  struct xe_device;
>  
>  void xe_hw_error_irq_handler(struct xe_tile *tile, const u32 master_ctl);
> +void xe_punit_error_handler(struct xe_device *xe);
>  void xe_hw_error_init(struct xe_device *xe);
>  #endif
> diff --git a/drivers/gpu/drm/xe/xe_ras.c b/drivers/gpu/drm/xe/xe_ras.c
> index 777321021391..93257d0eaaa0 100644
> --- a/drivers/gpu/drm/xe/xe_ras.c
> +++ b/drivers/gpu/drm/xe/xe_ras.c
> @@ -10,6 +10,7 @@
>  #include "xe_survivability_mode.h"
>  #include "xe_sysctrl_mailbox.h"
>  #include "xe_sysctrl_mailbox_types.h"
> +#include "xe_hw_error.h"
>  
>  #define COMPUTE_ERROR_SEVERITY_MASK		GENMASK(26, 25)
>  #define GLOBAL_UNCORR_ERROR			2
> @@ -148,7 +149,7 @@ static enum xe_ras_recovery_action handle_soc_internal_errors(struct xe_device *
>  			xe_err(xe, "[RAS]: PUNIT %s error detected: 0x%x\n",
>  			       severity_to_str(xe, common_info.severity),
>  			       ieh_error->error_sources_ieh0.punit);
> -			/** TODO: Add PUNIT error handling */
> +			xe_punit_error_handler(xe);
>  			action = XE_RAS_RECOVERY_ACTION_DISCONNECT;
>  		}
>  	}
> -- 
> 2.34.1
> 

  parent reply	other threads:[~2026-04-02  8:19 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-18  6:40 [PATCH v2 0/5] Introduce cold reset recovery method Mallesh Koujalagi
2026-03-18  6:40 ` [PATCH v2 1/5] Introduce Xe Uncorrectable Error Handling Mallesh Koujalagi
2026-03-18 19:35   ` kernel test robot
2026-03-19 14:42   ` kernel test robot
2026-03-19 20:02   ` kernel test robot
2026-03-18  6:40 ` [PATCH v2 2/5] drm: Add DRM_WEDGE_RECOVERY_COLD_RESET for power management unit error Mallesh Koujalagi
2026-03-30  5:26   ` Tauro, Riana
2026-03-18  6:40 ` [PATCH v2 3/5] drm/doc: Document DRM_WEDGE_RECOVERY_COLD_RESET recovery method Mallesh Koujalagi
2026-03-30  5:00   ` Tauro, Riana
2026-03-30 14:02     ` Mallesh, Koujalagi
2026-04-02  8:16   ` Raag Jadav
2026-04-06 12:26     ` Mallesh, Koujalagi
2026-03-18  6:40 ` [PATCH v2 4/5] drm/xe: Add handler for power management unit errors which require cold-reset Mallesh Koujalagi
2026-03-30  4:54   ` Tauro, Riana
2026-03-30 13:50     ` Mallesh, Koujalagi
2026-04-02  8:19   ` Raag Jadav [this message]
2026-03-18  6:40 ` [PATCH v2 5/5] drm/xe/debugfs: Add interface to trigger power management unit error handler Mallesh Koujalagi
2026-03-30  4:55   ` Tauro, Riana
2026-03-30 13:40     ` Mallesh, Koujalagi
2026-04-02  8:31       ` Raag Jadav
2026-04-06 12:49         ` Mallesh, Koujalagi
2026-03-18  6:49 ` ✗ CI.checkpatch: warning for Introduce cold reset recovery method Patchwork
2026-03-18  6:50 ` ✓ CI.KUnit: success " Patchwork
2026-03-18  7:33 ` ✓ Xe.CI.BAT: " Patchwork
2026-03-19 20:20 ` ✓ 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=ac4mh_Izd06T0hUF@black.igk.intel.com \
    --to=raag.jadav@intel.com \
    --cc=airlied@gmail.com \
    --cc=andrealmeid@igalia.com \
    --cc=anshuman.gupta@intel.com \
    --cc=badal.nilawar@intel.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=karthik.poosa@intel.com \
    --cc=mallesh.koujalagi@intel.com \
    --cc=mripard@kernel.org \
    --cc=riana.tauro@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=simona.vetter@ffwll.ch \
    --cc=sk.anirban@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