drm/i915: Add extra registers to GPU error dump
authorStuart Summers <stuart.summers@intel.com>
Wed, 1 Jun 2022 21:06:46 +0000 (14:06 -0700)
committerMatt Roper <matthew.d.roper@intel.com>
Thu, 2 Jun 2022 16:14:36 +0000 (09:14 -0700)
Our internal teams have identified a few additional engine registers
that are worth inspecting in error state dumps during development &
debug.  Let's capture and print them as part of our error dump.

For simplicity we'll just dump these registers on gen11 and beyond.
Most of these registers have existed since earlier platforms (e.g., gen6
or gen7) but were initially introduced only for a subset of the
platforms' engines; gen11 seems to be where they became available on all
engines.

Signed-off-by: Stuart Summers <stuart.summers@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220601210646.615946-1-matthew.d.roper@intel.com
drivers/gpu/drm/i915/gt/intel_engine_regs.h
drivers/gpu/drm/i915/i915_gpu_error.c
drivers/gpu/drm/i915/i915_gpu_error.h

index 44de10c..889f0df 100644 (file)
@@ -8,6 +8,7 @@
 
 #include "i915_reg_defs.h"
 
+#define RING_EXCC(base)                                _MMIO((base) + 0x28)
 #define RING_TAIL(base)                                _MMIO((base) + 0x30)
 #define   TAIL_ADDR                            0x001FFFF8
 #define RING_HEAD(base)                                _MMIO((base) + 0x34)
                (REG_FIELD_PREP(BLIT_CCTL_DST_MOCS_MASK, (dst) << 1) | \
                 REG_FIELD_PREP(BLIT_CCTL_SRC_MOCS_MASK, (src) << 1))
 
+#define RING_CSCMDOP(base)                     _MMIO((base) + 0x20c)
+
 /*
  * CMD_CCTL read/write fields take a MOCS value and _not_ a table index.
  * The lsb of each can be considered a separate enabling bit for encryption.
                 REG_FIELD_PREP(CMD_CCTL_READ_OVERRIDE_MASK, (read) << 1))
 
 #define RING_PREDICATE_RESULT(base)            _MMIO((base) + 0x3b8) /* gen12+ */
+
 #define MI_PREDICATE_RESULT_2(base)            _MMIO((base) + 0x3bc)
 #define   LOWER_SLICE_ENABLED                  (1 << 0)
 #define   LOWER_SLICE_DISABLED                 (0 << 0)
 #define          CTX_CTRL_ENGINE_CTX_SAVE_INHIBIT      REG_BIT(2)
 #define          CTX_CTRL_INHIBIT_SYN_CTX_SWITCH       REG_BIT(3)
 #define          GEN12_CTX_CTRL_OAR_CONTEXT_ENABLE     REG_BIT(8)
+#define RING_CTX_SR_CTL(base)                  _MMIO((base) + 0x244)
 #define RING_SEMA_WAIT_POLL(base)              _MMIO((base) + 0x24c)
 #define GEN8_RING_PDP_UDW(base, n)             _MMIO((base) + 0x270 + (n) * 8 + 4)
 #define GEN8_RING_PDP_LDW(base, n)             _MMIO((base) + 0x270 + (n) * 8)
index 0512c66..bff8a11 100644 (file)
@@ -581,6 +581,15 @@ static void error_print_engine(struct drm_i915_error_state_buf *m,
                err_printf(m, "  RC PSMI: 0x%08x\n", ee->rc_psmi);
                err_printf(m, "  FAULT_REG: 0x%08x\n", ee->fault_reg);
        }
+       if (GRAPHICS_VER(m->i915) >= 11) {
+               err_printf(m, "  NOPID: 0x%08x\n", ee->nopid);
+               err_printf(m, "  EXCC: 0x%08x\n", ee->excc);
+               err_printf(m, "  CMD_CCTL: 0x%08x\n", ee->cmd_cctl);
+               err_printf(m, "  CSCMDOP: 0x%08x\n", ee->cscmdop);
+               err_printf(m, "  CTX_SR_CTL: 0x%08x\n", ee->ctx_sr_ctl);
+               err_printf(m, "  DMA_FADDR_HI: 0x%08x\n", ee->dma_faddr_hi);
+               err_printf(m, "  DMA_FADDR_LO: 0x%08x\n", ee->dma_faddr_lo);
+       }
        if (HAS_PPGTT(m->i915)) {
                err_printf(m, "  GFX_MODE: 0x%08x\n", ee->vm_info.gfx_mode);
 
@@ -1224,6 +1233,16 @@ static void engine_record_registers(struct intel_engine_coredump *ee)
                ee->ipehr = ENGINE_READ(engine, IPEHR);
        }
 
+       if (GRAPHICS_VER(i915) >= 11) {
+               ee->cmd_cctl = ENGINE_READ(engine, RING_CMD_CCTL);
+               ee->cscmdop = ENGINE_READ(engine, RING_CSCMDOP);
+               ee->ctx_sr_ctl = ENGINE_READ(engine, RING_CTX_SR_CTL);
+               ee->dma_faddr_hi = ENGINE_READ(engine, RING_DMA_FADD_UDW);
+               ee->dma_faddr_lo = ENGINE_READ(engine, RING_DMA_FADD);
+               ee->nopid = ENGINE_READ(engine, RING_NOPID);
+               ee->excc = ENGINE_READ(engine, RING_EXCC);
+       }
+
        intel_engine_get_instdone(engine, &ee->instdone);
 
        ee->instpm = ENGINE_READ(engine, RING_INSTPM);
index a611aba..55a143b 100644 (file)
@@ -84,6 +84,13 @@ struct intel_engine_coredump {
        u32 fault_reg;
        u64 faddr;
        u32 rc_psmi; /* sleep state */
+       u32 nopid;
+       u32 excc;
+       u32 cmd_cctl;
+       u32 cscmdop;
+       u32 ctx_sr_ctl;
+       u32 dma_faddr_hi;
+       u32 dma_faddr_lo;
        struct intel_instdone instdone;
 
        /* GuC matched capture-lists info */