[Intel-gfx] [PATCH] drm/i915: Broadwell expands ACTHD to 64bit

Chris Wilson chris at chris-wilson.co.uk
Fri Mar 21 13:00:54 CET 2014


On Fri, Mar 21, 2014 at 10:50:05AM +0000, Tvrtko Ursulin wrote:
> No, think you misunderstood me. I said "slightly more defensive"
> just in the sense that in case of weird hardware failures you have a
> potentially infinite loop now, where you don't really need a loop -
> probabilities strongly suggest you cannot get two upper dword wraps
> between the reads. So it is enough to read the upper dword twice,
> without the loop. Same effect, slightly more defensive in reality.

Yup, misunderstood what you wanted. If in doubt, C is much more
concise ;-)

diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 45d8011..8c82316 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -425,12 +425,14 @@ u64 intel_ring_get_active_head(struct intel_ring_buffer *ring)
        if (INTEL_INFO(ring->dev)->gen >= 8) {
                u32 upper, lower, tmp;
 
+               upper = I915_READ(RING_ACTHD_UDW(ring->mmio_base));
+               lower = I915_READ(RING_ACTHD(ring->mmio_base));
                tmp = I915_READ(RING_ACTHD_UDW(ring->mmio_base));
-               do {
+               if (upper != tmp) {
                        upper = tmp;
                        lower = I915_READ(RING_ACTHD(ring->mmio_base));
-                       tmp = I915_READ(RING_ACTHD_UDW(ring->mmio_base));
-               } while (upper != tmp);
+                       WARN_ON(I915_READ(RING_ACTHD_UDW(ring->mmio_base) != upper);
+               }
 
                acthd = (u64)upper << 32 | lower;
        } else if (INTEL_INFO(ring->dev)->gen >= 4)
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre



More information about the Intel-gfx mailing list