This should make systems more stable where resuming the GPU fails. This
can happen due to bad firmware or due to a bug within the kernel. The
last thing which should happen in either case is an unusable system.

Signed-off-by: Karol Herbst <kher...@redhat.com>
---
 drm/nouveau/nouveau_drm.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drm/nouveau/nouveau_drm.c b/drm/nouveau/nouveau_drm.c
index 8d4a5be3..02892714 100644
--- a/drm/nouveau/nouveau_drm.c
+++ b/drm/nouveau/nouveau_drm.c
@@ -871,7 +871,8 @@ nouveau_pmops_runtime_resume(struct device *dev)
 {
        struct pci_dev *pdev = to_pci_dev(dev);
        struct drm_device *drm_dev = pci_get_drvdata(pdev);
-       struct nvif_device *device = &nouveau_drm(drm_dev)->client.device;
+       struct nouveau_drm *drm = nouveau_drm(drm_dev);
+       struct nvif_device *device = &drm->client.device;
        int ret;
 
        if (!nouveau_pmops_runtime()) {
@@ -880,6 +881,11 @@ nouveau_pmops_runtime_resume(struct device *dev)
        }
 
        pci_set_power_state(pdev, PCI_D0);
+       /* abort if anything went wrong */
+       if (pdev->current_state != PCI_D0) {
+               NV_ERROR(drm, "couldn't wake up GPU!\n");
+               return -EBUSY;
+       }
        pci_restore_state(pdev);
        ret = pci_enable_device(pdev);
        if (ret)
-- 
2.14.3

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

Reply via email to