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

Chris Wilson chris at chris-wilson.co.uk
Thu Mar 20 22:41:13 CET 2014


On Thu, Mar 20, 2014 at 04:56:57PM +0000, Tvrtko Ursulin wrote:
> 
> On 03/19/2014 09:54 PM, Chris Wilson wrote:
> >diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
> >index 7a01911c16f8..a6ceb2c6f36d 100644
> >--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
> >+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
> >@@ -417,13 +417,19 @@ static void ring_write_tail(struct intel_ring_buffer *ring,
> >  	I915_WRITE_TAIL(ring, value);
> >  }
> >
> >-u32 intel_ring_get_active_head(struct intel_ring_buffer *ring)
> >+u64 intel_ring_get_active_head(struct intel_ring_buffer *ring)
> >  {
> >  	drm_i915_private_t *dev_priv = ring->dev->dev_private;
> >-	u32 acthd_reg = INTEL_INFO(ring->dev)->gen >= 4 ?
> >-			RING_ACTHD(ring->mmio_base) : ACTHD;
> >
> >-	return I915_READ(acthd_reg);
> >+	u32 reg = (INTEL_INFO(ring->dev)->gen >= 4 ?
> >+		   RING_ACTHD(ring->mmio_base) : ACTHD);
> >+	u64 acthd;
> >+
> >+	acthd = I915_READ(reg);
> >+	if (INTEL_INFO(ring->dev)->gen >= 8)
> >+		acthd |= (u64)I915_READ(RING_ACTHD_UDW(ring->mmio_base)) << 32;
> >+
> >+	return acthd;
> >  }
> 
> Can it happen, and does anyone care, for a low dword to wrap so
> instead of say, 0x00010000, this function falsely returns 0x0001ffff
> ?

Yeah, it could happen. This is used in error capture where the other rings
may still be running, and for hangcheck where it would not matter as it
would still differ on the next pass. And only when multiple passes
stalled would the hangcheck fire.

Anyway, it is probably better to handle this correctly in case we do use
in a sensitive check later.

Thanks,
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre



More information about the Intel-gfx mailing list