CHERRY-PICK: drm/i915: Add wait_for in init_ring_common
[cascardo/linux.git] / drivers / gpu / drm / i915 / intel_ringbuffer.c
index 62892a8..60ff6f0 100644 (file)
@@ -290,9 +290,9 @@ static int init_ring_common(struct intel_ring_buffer *ring)
                        | RING_VALID);
 
        /* If the head is still not zero, the ring is dead */
-       if ((I915_READ_CTL(ring) & RING_VALID) == 0 ||
-           I915_READ_START(ring) != obj->gtt_offset ||
-           (I915_READ_HEAD(ring) & HEAD_ADDR) != 0) {
+       if (wait_for((I915_READ_CTL(ring) & RING_VALID) != 0 &&
+                    I915_READ_START(ring) == obj->gtt_offset &&
+                    (I915_READ_HEAD(ring) & HEAD_ADDR) == 0, 50)) {
                DRM_ERROR("%s initialization failed "
                                "ctl %08x head %08x tail %08x start %08x\n",
                                ring->name,