[Intel-gfx] [PATCH] drm/i915: Report failure to re-initialise hw after a GPU reset

Chris Wilson chris at chris-wilson.co.uk
Sun Jun 9 23:11:30 CEST 2013


In case this happens in the wild, and it does, be diligent in checking
for re-initilisation errors and report them back promptly. By catching
the errors early, we mark the device as wedged, and so should reduce the
likelihood of trying to use the inconsistent state.

References: https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/1189230
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_drv.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index b23cd63..091b6b3 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -932,13 +932,15 @@ int i915_reset(struct drm_device *dev)
 
 		i915_gem_init_swizzling(dev);
 
-		for_each_ring(ring, dev_priv, i)
-			ring->init(ring);
+		for_each_ring(ring, dev_priv, i) {
+			ret = ring->init(ring);
+			if (ret)
+				goto unlock;
+		}
 
 		i915_gem_context_init(dev);
 		if (dev_priv->mm.aliasing_ppgtt) {
-			ret = dev_priv->mm.aliasing_ppgtt->enable(dev);
-			if (ret)
+			if (dev_priv->mm.aliasing_ppgtt->enable(dev))
 				i915_gem_cleanup_aliasing_ppgtt(dev);
 		}
 
@@ -948,6 +950,7 @@ int i915_reset(struct drm_device *dev)
 		 * some unknown reason, this blows up my ilk, so don't.
 		 */
 
+unlock:
 		mutex_unlock(&dev->struct_mutex);
 
 		drm_irq_uninstall(dev);
@@ -957,7 +960,7 @@ int i915_reset(struct drm_device *dev)
 		mutex_unlock(&dev->struct_mutex);
 	}
 
-	return 0;
+	return ret;
 }
 
 static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
-- 
1.7.10.4




More information about the Intel-gfx mailing list