[Intel-gfx] [PATCH 3/3] drm/i915: Use new INSTDONE registers
Using the extracted INSTDONE reading, and our new register definitions, update our hangcheck and error collection to use it. Signed-off-by: Ben Widawsky --- drivers/gpu/drm/i915/i915_debugfs.c | 8 --- drivers/gpu/drm/i915/i915_drv.h | 5 ++-- drivers/gpu/drm/i915/i915_irq.c | 47 +++-- 3 files changed, 37 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 0e8f14d..c1474fb 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -645,10 +645,9 @@ static void i915_ring_error_state(struct seq_file *m, seq_printf(m, " IPEIR: 0x%08x\n", error->ipeir[ring]); seq_printf(m, " IPEHR: 0x%08x\n", error->ipehr[ring]); seq_printf(m, " INSTDONE: 0x%08x\n", error->instdone[ring]); - if (ring == RCS && INTEL_INFO(dev)->gen >= 4) { - seq_printf(m, " INSTDONE1: 0x%08x\n", error->instdone1); + if (ring == RCS && INTEL_INFO(dev)->gen >= 4) seq_printf(m, " BBADDR: 0x%08llx\n", error->bbaddr); - } + if (INTEL_INFO(dev)->gen >= 4) seq_printf(m, " INSTPS: 0x%08x\n", error->instps[ring]); seq_printf(m, " INSTPM: 0x%08x\n", error->instpm[ring]); @@ -697,6 +696,9 @@ static int i915_error_state(struct seq_file *m, void *unused) for (i = 0; i < dev_priv->num_fence_regs; i++) seq_printf(m, " fence[%d] = %08llx\n", i, error->fence[i]); + for (i = 0; i < I915_NUM_INSTDONE_REG; i++) + seq_printf(m, " INSTDONE_%d: 0x%08x\n", i, error->extra_instdone[i]); + if (INTEL_INFO(dev)->gen >= 6) { seq_printf(m, "ERROR: 0x%08x\n", error->error); seq_printf(m, "DONE_REG: 0x%08x\n", error->done_reg); diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 9b69be6..cd2ee29 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -198,7 +198,7 @@ struct drm_i915_error_state { u32 error; /* gen6+ */ u32 instpm[I915_NUM_RINGS]; u32 instps[I915_NUM_RINGS]; - u32 instdone1; + u32 extra_instdone[I915_NUM_INSTDONE_REG]; u32 seqno[I915_NUM_RINGS]; u64 bbaddr; u32 fault_reg[I915_NUM_RINGS]; @@ -460,8 +460,7 @@ typedef struct drm_i915_private { struct timer_list hangcheck_timer; int hangcheck_count; uint32_t last_acthd[I915_NUM_RINGS]; - uint32_t last_instdone; - uint32_t last_instdone1; + uint32_t prev_instdone[I915_NUM_INSTDONE_REG]; unsigned int stop_rings; diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 0bf2f92..668bc70 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c @@ -1075,12 +1075,26 @@ static void i915_get_extra_instdone(struct drm_device *dev, uint32_t instdone[I915_NUM_INSTDONE_REG]) { struct drm_i915_private *dev_priv = dev->dev_private; - if (INTEL_INFO(dev)->gen < 4) { + + switch(INTEL_INFO(dev)->gen) { + case 2: + case 3: instdone[0] = I915_READ(INSTDONE); - instdone[1] = 0; - } else { + break; + case 4: + case 5: + case 6: instdone[0] = I915_READ(INSTDONE_I965); instdone[1] = I915_READ(INSTDONE1); + break; + default: + WARN_ONCE(1, "Unsupported platform\n"); + case 7: + instdone[0] = I915_READ(GEN7_INSTDONE_1); + instdone[1] = I915_READ(GEN7_SC_INSTDONE); + instdone[2] = I915_READ(GEN7_SAMPLER_INSTDONE); + instdone[3] = I915_READ(GEN7_ROW_INSTDONE); + break; } } @@ -1106,10 +1120,8 @@ static void i915_record_ring_state(struct drm_device *dev, error->ipehr[ring->id] = I915_READ(RING_IPEHR(ring->mmio_base)); error->instdone[ring->id] = I915_READ(RING_INSTDONE(ring->mmio_base)); error->instps[ring->id] = I915_READ(RING_INSTPS(ring->mmio_base)); - if (ring->id == RCS) { - error->instdone1 = I915_READ(INSTDONE1); + if (ring->id == RCS) error->bbaddr = I915_READ64(BB_ADDR); - } } else { error->faddr[ring->id] = I915_READ(DMA_FADD_I8XX); error->ipeir[ring->id] = I915_READ(IPEIR); @@ -1184,6 +1196,7 @@ static void i915_capture_error_state(struct drm_device *dev) struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_gem_object *obj; struct drm_i915_error_state *error; + uint32_t instdone[I915_NUM_INSTDONE_REG]; unsigned long flags; int i, pipe; @@ -1225,6 +1238,10 @@ static void i915_capture_error_state(struct drm_device *dev)
Re: [Intel-gfx] [PATCH 3/3] drm/i915: Use new INSTDONE registers
On Thu, 16 Aug 2012, Ben Widawsky wrote: > Using the extracted INSTDONE reading, and our new register definitions, > update our hangcheck and error collection to use it. Hi Ben, please find some nitpicks below... BR, Jani. > > Signed-off-by: Ben Widawsky > --- > drivers/gpu/drm/i915/i915_debugfs.c | 8 --- > drivers/gpu/drm/i915/i915_drv.h | 5 ++-- > drivers/gpu/drm/i915/i915_irq.c | 47 > +++-- > 3 files changed, 37 insertions(+), 23 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_debugfs.c > b/drivers/gpu/drm/i915/i915_debugfs.c > index 0e8f14d..c1474fb 100644 > --- a/drivers/gpu/drm/i915/i915_debugfs.c > +++ b/drivers/gpu/drm/i915/i915_debugfs.c > @@ -645,10 +645,9 @@ static void i915_ring_error_state(struct seq_file *m, > seq_printf(m, " IPEIR: 0x%08x\n", error->ipeir[ring]); > seq_printf(m, " IPEHR: 0x%08x\n", error->ipehr[ring]); > seq_printf(m, " INSTDONE: 0x%08x\n", error->instdone[ring]); > - if (ring == RCS && INTEL_INFO(dev)->gen >= 4) { > - seq_printf(m, " INSTDONE1: 0x%08x\n", error->instdone1); > + if (ring == RCS && INTEL_INFO(dev)->gen >= 4) > seq_printf(m, " BBADDR: 0x%08llx\n", error->bbaddr); > - } > + > if (INTEL_INFO(dev)->gen >= 4) > seq_printf(m, " INSTPS: 0x%08x\n", error->instps[ring]); > seq_printf(m, " INSTPM: 0x%08x\n", error->instpm[ring]); > @@ -697,6 +696,9 @@ static int i915_error_state(struct seq_file *m, void > *unused) > for (i = 0; i < dev_priv->num_fence_regs; i++) > seq_printf(m, " fence[%d] = %08llx\n", i, error->fence[i]); > > + for (i = 0; i < I915_NUM_INSTDONE_REG; i++) ARRAY_SIZE(error->extra_instdone)? > + seq_printf(m, " INSTDONE_%d: 0x%08x\n", i, > error->extra_instdone[i]); > + > if (INTEL_INFO(dev)->gen >= 6) { > seq_printf(m, "ERROR: 0x%08x\n", error->error); > seq_printf(m, "DONE_REG: 0x%08x\n", error->done_reg); > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h > index 9b69be6..cd2ee29 100644 > --- a/drivers/gpu/drm/i915/i915_drv.h > +++ b/drivers/gpu/drm/i915/i915_drv.h > @@ -198,7 +198,7 @@ struct drm_i915_error_state { > u32 error; /* gen6+ */ > u32 instpm[I915_NUM_RINGS]; > u32 instps[I915_NUM_RINGS]; > - u32 instdone1; > + u32 extra_instdone[I915_NUM_INSTDONE_REG]; > u32 seqno[I915_NUM_RINGS]; > u64 bbaddr; > u32 fault_reg[I915_NUM_RINGS]; > @@ -460,8 +460,7 @@ typedef struct drm_i915_private { > struct timer_list hangcheck_timer; > int hangcheck_count; > uint32_t last_acthd[I915_NUM_RINGS]; > - uint32_t last_instdone; > - uint32_t last_instdone1; > + uint32_t prev_instdone[I915_NUM_INSTDONE_REG]; > > unsigned int stop_rings; > > diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c > index 0bf2f92..668bc70 100644 > --- a/drivers/gpu/drm/i915/i915_irq.c > +++ b/drivers/gpu/drm/i915/i915_irq.c > @@ -1075,12 +1075,26 @@ static void i915_get_extra_instdone(struct drm_device > *dev, > uint32_t instdone[I915_NUM_INSTDONE_REG]) > { > struct drm_i915_private *dev_priv = dev->dev_private; > - if (INTEL_INFO(dev)->gen < 4) { > + > + switch(INTEL_INFO(dev)->gen) { > + case 2: > + case 3: > instdone[0] = I915_READ(INSTDONE); > - instdone[1] = 0; > - } else { > + break; > + case 4: > + case 5: > + case 6: > instdone[0] = I915_READ(INSTDONE_I965); > instdone[1] = I915_READ(INSTDONE1); > + break; > + default: > + WARN_ONCE(1, "Unsupported platform\n"); > + case 7: > + instdone[0] = I915_READ(GEN7_INSTDONE_1); > + instdone[1] = I915_READ(GEN7_SC_INSTDONE); > + instdone[2] = I915_READ(GEN7_SAMPLER_INSTDONE); > + instdone[3] = I915_READ(GEN7_ROW_INSTDONE); > + break; > } > } > > @@ -1106,10 +1120,8 @@ static void i915_record_ring_state(struct drm_device > *dev, > error->ipehr[ring->id] = I915_READ(RING_IPEHR(ring->mmio_base)); > error->instdone[ring->id] = > I915_READ(RING_INSTDONE(ring->mmio_base)); > error->instps[ring->id] = > I915_READ(RING_INSTPS(ring->mmio_base)); > - if (ring->id == RCS) { > - error->instdone1 = I915_READ(INSTDONE1); > + if (ring->id == RCS) > error->bbaddr = I915_READ64(BB_ADDR); > - } > } else { > error->faddr[ring->id] = I915_READ(DMA_FADD_I8XX); > error->ipeir[ring->id] = I915_READ(IPEIR); > @@ -1184,6 +1196,7 @@ static void i915_capture_error_state(struct drm_device > *dev) > struct drm_i915_private *dev_priv = dev->dev_private; > struct drm_i915_gem_object *obj; > st
Re: [Intel-gfx] [PATCH 3/3] drm/i915: Use new INSTDONE registers
On Thu, 16 Aug 2012 09:31:51 +0300 Jani Nikula wrote: > On Thu, 16 Aug 2012, Ben Widawsky wrote: > > Using the extracted INSTDONE reading, and our new register definitions, > > update our hangcheck and error collection to use it. > > Hi Ben, please find some nitpicks below... > > BR, > Jani. > > > > > Signed-off-by: Ben Widawsky > > --- > > drivers/gpu/drm/i915/i915_debugfs.c | 8 --- > > drivers/gpu/drm/i915/i915_drv.h | 5 ++-- > > drivers/gpu/drm/i915/i915_irq.c | 47 > > +++-- > > 3 files changed, 37 insertions(+), 23 deletions(-) > > > > diff --git a/drivers/gpu/drm/i915/i915_debugfs.c > > b/drivers/gpu/drm/i915/i915_debugfs.c > > index 0e8f14d..c1474fb 100644 > > --- a/drivers/gpu/drm/i915/i915_debugfs.c > > +++ b/drivers/gpu/drm/i915/i915_debugfs.c > > @@ -645,10 +645,9 @@ static void i915_ring_error_state(struct seq_file *m, > > seq_printf(m, " IPEIR: 0x%08x\n", error->ipeir[ring]); > > seq_printf(m, " IPEHR: 0x%08x\n", error->ipehr[ring]); > > seq_printf(m, " INSTDONE: 0x%08x\n", error->instdone[ring]); > > - if (ring == RCS && INTEL_INFO(dev)->gen >= 4) { > > - seq_printf(m, " INSTDONE1: 0x%08x\n", error->instdone1); > > + if (ring == RCS && INTEL_INFO(dev)->gen >= 4) > > seq_printf(m, " BBADDR: 0x%08llx\n", error->bbaddr); > > - } > > + > > if (INTEL_INFO(dev)->gen >= 4) > > seq_printf(m, " INSTPS: 0x%08x\n", error->instps[ring]); > > seq_printf(m, " INSTPM: 0x%08x\n", error->instpm[ring]); > > @@ -697,6 +696,9 @@ static int i915_error_state(struct seq_file *m, void > > *unused) > > for (i = 0; i < dev_priv->num_fence_regs; i++) > > seq_printf(m, " fence[%d] = %08llx\n", i, error->fence[i]); > > > > + for (i = 0; i < I915_NUM_INSTDONE_REG; i++) > > ARRAY_SIZE(error->extra_instdone)? > Agree. > > + seq_printf(m, " INSTDONE_%d: 0x%08x\n", i, > > error->extra_instdone[i]); > > + > > if (INTEL_INFO(dev)->gen >= 6) { > > seq_printf(m, "ERROR: 0x%08x\n", error->error); > > seq_printf(m, "DONE_REG: 0x%08x\n", error->done_reg); > > diff --git a/drivers/gpu/drm/i915/i915_drv.h > > b/drivers/gpu/drm/i915/i915_drv.h > > index 9b69be6..cd2ee29 100644 > > --- a/drivers/gpu/drm/i915/i915_drv.h > > +++ b/drivers/gpu/drm/i915/i915_drv.h > > @@ -198,7 +198,7 @@ struct drm_i915_error_state { > > u32 error; /* gen6+ */ > > u32 instpm[I915_NUM_RINGS]; > > u32 instps[I915_NUM_RINGS]; > > - u32 instdone1; > > + u32 extra_instdone[I915_NUM_INSTDONE_REG]; > > u32 seqno[I915_NUM_RINGS]; > > u64 bbaddr; > > u32 fault_reg[I915_NUM_RINGS]; > > @@ -460,8 +460,7 @@ typedef struct drm_i915_private { > > struct timer_list hangcheck_timer; > > int hangcheck_count; > > uint32_t last_acthd[I915_NUM_RINGS]; > > - uint32_t last_instdone; > > - uint32_t last_instdone1; > > + uint32_t prev_instdone[I915_NUM_INSTDONE_REG]; > > > > unsigned int stop_rings; > > > > diff --git a/drivers/gpu/drm/i915/i915_irq.c > > b/drivers/gpu/drm/i915/i915_irq.c > > index 0bf2f92..668bc70 100644 > > --- a/drivers/gpu/drm/i915/i915_irq.c > > +++ b/drivers/gpu/drm/i915/i915_irq.c > > @@ -1075,12 +1075,26 @@ static void i915_get_extra_instdone(struct > > drm_device *dev, > > uint32_t instdone[I915_NUM_INSTDONE_REG]) > > { > > struct drm_i915_private *dev_priv = dev->dev_private; > > - if (INTEL_INFO(dev)->gen < 4) { > > + > > + switch(INTEL_INFO(dev)->gen) { > > + case 2: > > + case 3: > > instdone[0] = I915_READ(INSTDONE); > > - instdone[1] = 0; > > - } else { > > + break; > > + case 4: > > + case 5: > > + case 6: > > instdone[0] = I915_READ(INSTDONE_I965); > > instdone[1] = I915_READ(INSTDONE1); > > + break; > > + default: > > + WARN_ONCE(1, "Unsupported platform\n"); > > + case 7: > > + instdone[0] = I915_READ(GEN7_INSTDONE_1); > > + instdone[1] = I915_READ(GEN7_SC_INSTDONE); > > + instdone[2] = I915_READ(GEN7_SAMPLER_INSTDONE); > > + instdone[3] = I915_READ(GEN7_ROW_INSTDONE); > > + break; > > } > > } > > > > @@ -1106,10 +1120,8 @@ static void i915_record_ring_state(struct drm_device > > *dev, > > error->ipehr[ring->id] = I915_READ(RING_IPEHR(ring->mmio_base)); > > error->instdone[ring->id] = > > I915_READ(RING_INSTDONE(ring->mmio_base)); > > error->instps[ring->id] = > > I915_READ(RING_INSTPS(ring->mmio_base)); > > - if (ring->id == RCS) { > > - error->instdone1 = I915_READ(INSTDONE1); > > + if (ring->id == RCS) > > error->bbaddr = I915_READ64(BB_ADDR); > > - } > > } else { > > error->faddr[ring->id] = I915_READ(DMA_FADD_I8XX); > > error->ipeir[ring->id] = I915_READ(IPEIR); > > @@ -1184,6 +