summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Rudorff <chris@rudorff.com>2025-03-25 13:44:36 +0100
committerLyude Paul <lyude@redhat.com>2025-03-28 18:05:53 -0400
commit4c4d9b7b6c6e676eca22585139aba5f03de74b90 (patch)
tree3464c87cc8501b0bb29142ec0565811c426a58b9
parente486147c912f653ef4b60a6c7dbd4168a4c56a9f (diff)
drm/nouveau: fix hibernate on disabled GPU
Hibernate bricks the machine if a discrete GPU was disabled via echo IGD > /sys/kernel/debug/vgaswitcheroo/switch The freeze and thaw handler lacks checking the GPU power state, as suspend and resume do. This patch add the checks and fix this issue. Signed-off-by: Christoph Rudorff <chris@rudorff.com> Signed-off-by: Lyude Paul <lyude@redhat.com> Link: https://lore.kernel.org/r/20250325-nouveau-fix-hibernate-v2-1-2bd5c13fb953@rudorff.com
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drm.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index e154d08857c55..c69139701056d 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -1079,6 +1079,10 @@ nouveau_pmops_freeze(struct device *dev)
{
struct nouveau_drm *drm = dev_get_drvdata(dev);
+ if (drm->dev->switch_power_state == DRM_SWITCH_POWER_OFF ||
+ drm->dev->switch_power_state == DRM_SWITCH_POWER_DYNAMIC_OFF)
+ return 0;
+
return nouveau_do_suspend(drm, false);
}
@@ -1087,6 +1091,10 @@ nouveau_pmops_thaw(struct device *dev)
{
struct nouveau_drm *drm = dev_get_drvdata(dev);
+ if (drm->dev->switch_power_state == DRM_SWITCH_POWER_OFF ||
+ drm->dev->switch_power_state == DRM_SWITCH_POWER_DYNAMIC_OFF)
+ return 0;
+
return nouveau_do_resume(drm, false);
}