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
This commit is contained in:
Christoph Rudorff 2025-03-25 13:44:36 +01:00 committed by Lyude Paul
parent e486147c91
commit 4c4d9b7b6c

View File

@ -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);
}