Re: [PATCH v2 4/5] drm/xe: Add handler for power management unit errors which require cold-reset

Mallesh, Koujalagi
2026-03-30T13:50:18Z

Hi Riana,

On 30-03-2026 10:24 am, Tauro, Riana wrote:
>
> On 3/18/2026 12:10 PM, 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.
> Commit message should be clear.
>>   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)
> This is not an addition to the patch. Only add this in cover letter.
>>
>> 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>
>> +#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)
>
> You can move this to xe_ras
Sure, will move to xe_ras.c in v3.
>
>> +{
>> +    drm_err(&xe->drm, "CRITICAL: PMU error detected\n");
>
> PMU? also means Performance monitoring unit. Please use Punit instead
> Keep this consistent in both commit message, kernel-doc and code
>
Good catch, will replace "PMU" reference with "Punit" across commit
message, kernel-doc etc.
>> +    drm_err(&xe->drm, "Recovery: Device cold reset required\n");
> power-cycle/cold-reset. Use consistent wording

Sure, will use "cold reset " consistently in v3.

Thanks,

-/Mallesh

> Thanks
> Riana
>
>> +
>> +    /* Set cold reset recovery method */
>> +    xe_device_set_wedged_method(xe, DRM_WEDGE_RECOVERY_COLD_RESET);
>> +
>> +    if (xe_device_wedged(xe)) {
>> +        drm_dev_wedged_event(&xe->drm, xe->wedged.method, NULL);
>> +    } else {
>> +        /* Declare device wedged - will trigger uevent with cold
>> reset method */
>> +        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;
>>           }
>>       }