If we try to execute on a known ring, but it has failed to be
initialised correctly, report that the GPU is hung rather than the
command invalid. This leaves us reporting EINVAL only if the user
requests execution on a ring that is not supported by the device.

This should prevent UXA from getting stuck in a null render loop after a
failed resume.

Reported-by: Jiri Kosina <ji...@jikos.cz>
References: https://bugs.freedesktop.org/show_bug.cgi?id=76554
Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c 
b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 1b45163e19f3..22c650490f54 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -991,6 +991,18 @@ i915_reset_gen7_sol_offsets(struct drm_device *dev,
        return 0;
 }
 
+static bool
+intel_ring_valid(struct intel_ring_buffer *ring)
+{
+       switch (ring->id) {
+       case RCS: return true;
+       case VCS: return HAS_BSD(ring->dev);
+       case BCS: return HAS_BLT(ring->dev);
+       case VECS: return HAS_VEBOX(ring->dev);
+       default: return false;
+       }
+}
+
 static int
 i915_gem_do_execbuffer(struct drm_device *dev, void *data,
                       struct drm_file *file,
@@ -1041,7 +1053,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
        if (!intel_ring_initialized(ring)) {
                DRM_DEBUG("execbuf with invalid ring: %d\n",
                          (int)(args->flags & I915_EXEC_RING_MASK));
-               return -EINVAL;
+               return intel_ring_valid(ring) ? -EIO : -EINVAL;
        }
 
        mode = args->flags & I915_EXEC_CONSTANTS_MASK;
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to