From: Sean Paul Date: Fri, 16 Mar 2012 16:43:22 +0000 (-0400) Subject: CHERRY-PICK: drm/i915: Add wait_for in init_ring_common X-Git-Url: http://git.cascardo.eti.br/?a=commitdiff_plain;h=370aa737e3dc8cc788a15ef5da850739306b46c0;p=cascardo%2Flinux.git CHERRY-PICK: drm/i915: Add wait_for in init_ring_common I have seen a number of "blt ring initialization failed" messages where the ctl or start registers are not the correct value. Upon further inspection, if the code just waited a little bit, it would read the correct value. Adding the wait_for to these reads should eliminate the issue. Signed-off-by: Sean Paul Reviewed-by: Ben Widawsky Signed-off-by: Daniel Vetter (cherry picked from commit f01db988ef6f6c70a6cc36ee71e4a98a68901229) TEST=Tested on lumpy with 1000's of suspend/resume cycles BUG=chrome-os-partner:8366 Change-Id: I9544a5a65efb0775302ccf001d4dc1b43a429963 Reviewed-on: https://gerrit.chromium.org/gerrit/18459 Tested-by: Sean Paul Reviewed-by: Grant Grundler Reviewed-by: Stéphane Marchesin Commit-Ready: Sean Paul --- diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index 62892a826ede..60ff6f0a5389 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c @@ -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,