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

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Fri Mar 21 13:19:28 CET 2014


On 03/21/2014 12:00 PM, Chris Wilson wrote:
> 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)

Yes, I was just uneasy with the loop. Also Ben's suggestion in case of 
wrap was I think:

WARN_ON(I915_READ(RING_ACTHD(ring->mmio_base) >= lower);

Or in other words, if we have observed the upper wrap, check that the 
lower matches with that observation. But I feel bad now that we are 
over-engineering this. Perhaps these WARNs are just silly.

Tvrtko



More information about the Intel-gfx mailing list