Introduce DRM_WEDGE_RECOVERY_COLD_RESET (BIT(4)) recovery method to handle
scenarios requiring device power cycle.

This method addresses cases where other recovery mechanisms
(driver reload, PCIe reset, etc.) are insufficient to restore device
functionality. When set, it indicates to userspace that only device power
cycle can recover the device from its current error state. The cold reset
method serves as a last resort when all other recovery options have been
exhausted.

Signed-off-by: Mallesh Koujalagi <[email protected]>
---
v3:
- Update any scenario that requires cold-reset. (Riana)

v4:
- Rename cold reset to power cyclce. (Raag)

v5:
- Make it consistent with consumer expectations. (Raag)
---
 drivers/gpu/drm/drm_drv.c | 2 ++
 include/drm/drm_device.h  | 1 +
 2 files changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 985c283cf59f..8c0236e2e6a6 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -535,6 +535,8 @@ static const char *drm_get_wedge_recovery(unsigned int opt)
                return "bus-reset";
        case DRM_WEDGE_RECOVERY_VENDOR:
                return "vendor-specific";
+       case DRM_WEDGE_RECOVERY_COLD_RESET:
+               return "cold-reset";
        default:
                return NULL;
        }
diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
index bc78fb77cc27..d41f26f4dd45 100644
--- a/include/drm/drm_device.h
+++ b/include/drm/drm_device.h
@@ -37,6 +37,7 @@ struct pci_controller;
 #define DRM_WEDGE_RECOVERY_REBIND      BIT(1)  /* unbind + bind driver */
 #define DRM_WEDGE_RECOVERY_BUS_RESET   BIT(2)  /* unbind + reset bus device + 
bind */
 #define DRM_WEDGE_RECOVERY_VENDOR      BIT(3)  /* vendor specific recovery 
method */
+#define DRM_WEDGE_RECOVERY_COLD_RESET  BIT(4)  /* remove device + slot power 
cycle + rescan */
 
 /**
  * struct drm_wedge_task_info - information about the guilty task of a wedge 
dev
-- 
2.34.1

Reply via email to