Skip to contentSkip to conversation

drm: don't continue with anything after the GPU couldn't be woken up

RFC Superseded Karol Herbst 1 participant 1 message Nov 16, 2017

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

RFC 1/1 drm: don't continue with anything after the GPU couldn't be woken up

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.

---
 drm/nouveau/nouveau_drm.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drm/nouveau/nouveau_drm.c +7 -1
index 8d4a5be3..02892714 100644
@@ -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)
Signature · 6 lines
2.14.3

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau