drm/i915: per slice/subslice INSTDONE capturing
Subsystems (2)
cover drm/i915: per slice/subslice INSTDONE capturing
This patchset from Ben helps debugging GPU hangs on new platforms. While going through it I noticed that our existing INSTDONE register definitions are somewhat unclear, so I tried to clean those up.
Ben sent me these patches way back on the BXT power-on event, apologies for delaying it until now.
Smoke tested on BXT,CHV.
Ben Widawsky (2):
drm/i915: Cleanup instdone collection
drm/i915: Try to print INSTDONE bits for all slice/subslice
Imre Deak (3):
drm/i915: remove duplicate names for the render ring INSTDONE register drm/i915: rename INSTDONE to GEN2_INSTDONE
drm/i915: rename INSTDONE1 to GEN4_INSTDONE1
drivers/gpu/drm/i915/i915_drv.h | 12 ++++- drivers/gpu/drm/i915/i915_gpu_error.c | 97 ++++++++++++++++++++++++++++------- drivers/gpu/drm/i915/i915_irq.c | 25 ++++++--- drivers/gpu/drm/i915/i915_reg.h | 17 ++++-- 4 files changed, 118 insertions(+), 33 deletions(-)
Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/5 drm/i915: remove duplicate names for the render ring INSTDONE register
We use 3 different names to refer to the same render ring INSTDONE register. This can be confusing when comparing two parts of the code accessing the register via different names. Although the GEN4 version's layout is different, we treat it the same way as the GEN7+ version, in that we simply read it out during error capture. So remove the duplicates and leave a comment about the GEN4 difference.
Note that there is also a GEN2 version of this register, but that's on a different address so not handled in this patch.
--- drivers/gpu/drm/i915/i915_gpu_error.c | 4 ++-- drivers/gpu/drm/i915/i915_reg.h | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/i915_gpu_error.c +2 -2
@@ -1390,10 +1390,10 @@ void i915_get_extra_instdone(struct drm_device *dev, uint32_t *instdone)if (IS_GEN2 (dev) ||IS_GEN3 (dev)) instdone[0 ] =I915_READ (INSTDONE );else if (IS_GEN4 (dev) ||IS_GEN5 (dev) ||IS_GEN6 (dev)) { - instdone[0 ] =I915_READ (INSTDONE_I965 ); + instdone[0 ] =I915_READ (RING_INSTDONE (RENDER_RING_BASE )); instdone[1 ] =I915_READ (INSTDONE1 ); }else if (INTEL_INFO (dev)->gen >=7 ) { - instdone[0 ] =I915_READ (GEN7_INSTDONE_1 ); + instdone[0 ] =I915_READ (RING_INSTDONE (RENDER_RING_BASE )); instdone[1 ] =I915_READ (GEN7_SC_INSTDONE ); instdone[2 ] =I915_READ (GEN7_SAMPLER_INSTDONE ); instdone[3 ] =I915_READ (GEN7_ROW_INSTDONE );
drivers/gpu/drm/i915/i915_reg.h +4 -2
@@ -1593,14 +1593,16 @@ enum skl_disp_power_wells {#endif #define IPEIR_I965 0x02064#define IPEHR_I965 0x02068 -#define INSTDONE_I965 0x0206c -#define GEN7_INSTDONE_1 0x0206c#define GEN7_SC_INSTDONE 0x07100#define GEN7_SAMPLER_INSTDONE 0x0e160#define GEN7_ROW_INSTDONE 0x0e164#define I915_NUM_INSTDONE_REG 4#define RING_IPEIR (base) ((base)+0x64)#define RING_IPEHR (base) ((base)+0x68) +/* +* On GEN4, only the render ring INSTDONE exists and has a different +* layout than the GEN7+ version. +*/ #define RING_INSTDONE (base) ((base)+0x6c)#define RING_INSTPS (base) ((base)+0x70)#define RING_DMA_FADD (base) ((base)+0x78)
Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/5 drm/i915: rename INSTDONE to GEN2_INSTDONE
In reply to Imre DeakWe have a bunch of INSTDONE registers for different platforms and purposes and it's not immediately clear which instance they are just by looking at the register name. This one was added on GEN2, where it was the only INSTDONE register, so mark it as such.
--- drivers/gpu/drm/i915/i915_gpu_error.c | 4 ++-- drivers/gpu/drm/i915/i915_reg.h | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_gpu_error.c +2 -2
@@ -886,7 +886,7 @@ static void i915_record_ring_state(struct drm_device *dev, ering->faddr =I915_READ (DMA_FADD_I8XX ); ering->ipeir =I915_READ (IPEIR ); ering->ipehr =I915_READ (IPEHR ); - ering->instdone =I915_READ (INSTDONE ); + ering->instdone =I915_READ (GEN2_INSTDONE ); } ering->waiting =waitqueue_active (&ring->irq_queue);
@@ -1388,7 +1388,7 @@ void i915_get_extra_instdone(struct drm_device *dev, uint32_t *instdone)memset (instdone,0 ,sizeof (*instdone) *I915_NUM_INSTDONE_REG );if (IS_GEN2 (dev) ||IS_GEN3 (dev)) - instdone[0 ] =I915_READ (INSTDONE ); + instdone[0 ] =I915_READ (GEN2_INSTDONE );else if (IS_GEN4 (dev) ||IS_GEN5 (dev) ||IS_GEN6 (dev)) { instdone[0 ] =I915_READ (RING_INSTDONE (RENDER_RING_BASE )); instdone[1 ] =I915_READ (INSTDONE1 );
drivers/gpu/drm/i915/i915_reg.h +2 -1
@@ -1602,6 +1602,7 @@ enum skl_disp_power_wells {/* * On GEN4, only the render ring INSTDONE exists and has a different * layout than the GEN7+ version. +* The GEN2 counterpart of this register is GEN2_INSTDONE. */ #define RING_INSTDONE (base) ((base)+0x6c)#define RING_INSTPS (base) ((base)+0x70)
@@ -1619,7 +1620,7 @@ enum skl_disp_power_wells {#define PWRCTX_EN (1<<0)#define IPEIR 0x02088#define IPEHR 0x0208c -#define INSTDONE 0x02090 +#define GEN2_INSTDONE 0x02090#define NOPID 0x02094#define HWSTAM 0x02098#define DMA_FADD_I8XX 0x020d0
Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/5 drm/i915: rename INSTDONE1 to GEN4_INSTDONE1
In reply to Imre DeakThis register was added on GEN4, by the name INSTDONE_1 whereas the GEN6 specification calls it INSTDONE_2. Keep the original name with a platform prefix to make it clearer which INSTDONE register instance this is. Also add a comment about the SNB alternative name.
--- drivers/gpu/drm/i915/i915_gpu_error.c | 2 +- drivers/gpu/drm/i915/i915_reg.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gpu_error.c +1 -1
@@ -1391,7 +1391,7 @@ void i915_get_extra_instdone(struct drm_device *dev, uint32_t *instdone) instdone[0 ] =I915_READ (GEN2_INSTDONE ); else if (IS_GEN4(dev) || IS_GEN5(dev) || IS_GEN6(dev)) { instdone[0 ] =I915_READ (RING_INSTDONE (RENDER_RING_BASE )); - instdone[1 ] =I915_READ (INSTDONE1 ); + instdone[1 ] =I915_READ (GEN4_INSTDONE1 ); } else if (INTEL_INFO(dev)->gen >= 7) { instdone[0 ] =I915_READ (RING_INSTDONE (RENDER_RING_BASE )); instdone[1 ] =I915_READ (GEN7_SC_INSTDONE );
drivers/gpu/drm/i915/i915_reg.h +1 -1
@@ -1611,7 +1611,7 @@ enum skl_disp_power_wells {#define RING_INSTPM (base) ((base)+0xc0)#define RING_MI_MODE (base) ((base)+0x9c)#define INSTPS 0x02070/* 965+ only */ -#define INSTDONE1 0x0207c/* 965+ only */ +#define GEN4_INSTDONE1 0x0207c/* 965+ only, aka INSTDONE_2 on SNB */ #define ACTHD_I965 0x02074#define HWS_PGA 0x02080#define HWS_ADDRESS_MASK 0xfffff000
Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 3/5] drm/i915: rename INSTDONE1 to GEN4_INSTDONE1
Quoted 29 lines · Imre Deak
This register was added on GEN4, by the name
INSTDONE_1whereas the GEN6 specification calls itINSTDONE_2. Keep the original name with a platform prefix to make it clearer which INSTDONE register instance this is. Also add a comment about the SNB alternative name.Signed-off-by Imre Deak <[email protected]>--- drivers/gpu/drm/i915/i915_gpu_error.c | 2 +- drivers/gpu/drm/i915/i915_reg.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/i915_gpu_error.c +1
-1@@ -1391,7 +1391,7 @@ void i915_get_extra_instdone(struct drm_device *dev, uint32_t *instdone) instdone[0 ] =I915_READ (GEN2_INSTDONE ); else if (IS_GEN4(dev) || IS_GEN5(dev) || IS_GEN6(dev)) { instdone[0 ] =I915_READ (RING_INSTDONE (RENDER_RING_BASE )); - instdone[1 ] =I915_READ (INSTDONE1 ); + instdone[1 ] =I915_READ (GEN4_INSTDONE1 ); } else if (INTEL_INFO(dev)->gen >= 7) { instdone[0 ] =I915_READ (RING_INSTDONE (RENDER_RING_BASE )); instdone[1 ] =I915_READ (GEN7_SC_INSTDONE );drivers/gpu/drm/i915/i915_reg.h +0
-0
drivers/gpu/drm/i915/i915_reg.h enum skl_disp_power_wells { · line 1617
Quoted 8 lines
drivers/gpu/drm/i915/i915_reg.h +1
-1@@ -1611,7 +1611,7 @@ enum skl_disp_power_wells {#define RING_INSTPM (base) ((base)+0xc0)#define RING_MI_MODE (base) ((base)+0x9c)#define INSTPS 0x02070/* 965+ only */ -#define INSTDONE1 0x0207c/* 965+ only */ +#define GEN4_INSTDONE1 0x0207c/* 965+ only, aka INSTDONE_2 on SNB */ #define ACTHD_I965 0x02074#define HWS_PGA 0x02080#define HWS_ADDRESS_MASK 0xfffff000
1-3 are:
I'll look over 4, and 5, but since I originally authored them, I probably won't make a good reviewer.
Signature · 5 lines
Ben Widawsky, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/5 drm/i915: Cleanup instdone collection
In reply to Imre DeakFrom: Ben Widawsky <[email protected]>
Consolidate the instdone logic so we can get a bit fancier. This patch also removes the duplicated print of INSTDONE[0].
---
Changes: (Imre)
- keep capturing GEN4_INSTDONE1 too
- don't save GEN7 registers on GEN4-6
--- drivers/gpu/drm/i915/i915_drv.h | 10 ++++++-- drivers/gpu/drm/i915/i915_gpu_error.c | 43 ++++++++++++++++++++++------------- drivers/gpu/drm/i915/i915_irq.c | 25 ++++++++++++++------ drivers/gpu/drm/i915/i915_reg.h | 1 - 4 files changed, 53 insertions(+), 26 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +8 -2
@@ -513,7 +513,12 @@ struct drm_i915_error_state {u32 gam_ecochk;u32 gab_ctl;u32 gfx_mode; -u32 extra_instdone[I915_NUM_INSTDONE_REG ]; +struct extra_instdone { +u32 slice_common; +u32 sampler; +u32 row; + } extra_instdone; +u64 fence[I915_MAX_NUM_FENCES ];struct intel_overlay_error_state *overlay;struct intel_display_error_state *display;
@@ -3259,7 +3264,8 @@ void i915_error_state_get(struct drm_device *dev,void i915_error_state_put (struct i915_error_state_file_priv *error_priv);void i915_destroy_error_state (struct drm_device *dev); -void i915_get_extra_instdone (struct drm_device *dev,uint32_t *instdone); +void i915_get_extra_instdone (struct drm_device *dev, +struct extra_instdone *extra);const char *i915_cache_level_str (struct drm_i915_private *i915,int type);/* i915_cmd_parser.c */
drivers/gpu/drm/i915/i915_gpu_error.c +27 -16
63 lines not on this page · raw message
drivers/gpu/drm/i915/i915_irq.c +18 -7
@@ -2473,19 +2473,32 @@ static void i915_reset_and_wakeup(struct drm_device *dev) } } +static inline void +i915_err_print_instdone (uint32_t render,struct extra_instdone *extra) +{ +pr_err (" INSTDONE (render): 0x%08x\n" , render); +pr_err (" INSTDONE (common): 0x%08x\n" , extra->slice_common); +pr_err (" INSTDONE (sampler): 0x%08x\n" , extra->sampler); +pr_err (" INSTDONE (row): 0x%08x\n" , extra->row); +} +static void i915_report_and_clear_eir (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private; -uint32_t instdone[I915_NUM_INSTDONE_REG ]; +u32 render_instdone; +struct extra_instdone extra = {0 };u32 eir =I915_READ (EIR ); -int pipe, i; +int pipe;if (!eir)return ;pr_err ("render error detected, EIR: 0x%08x\n" , eir); -i915_get_extra_instdone (dev, instdone); + render_instdone =I915_READ (INTEL_INFO (dev)->gen <4 ? +GEN2_INSTDONE : +RING_INSTDONE (RENDER_RING_BASE )); +i915_get_extra_instdone (dev, &extra);if (IS_G4X (dev)) {if (eir & (GM45_ERROR_MEM_PRIV |GM45_ERROR_CP_PRIV )) {
@@ -2493,8 +2506,7 @@ static void i915_report_and_clear_eir(struct drm_device *dev)pr_err (" IPEIR: 0x%08x\n" ,I915_READ (IPEIR_I965 ));pr_err (" IPEHR: 0x%08x\n" ,I915_READ (IPEHR_I965 )); -for (i =0 ; i <ARRAY_SIZE (instdone); i++) -pr_err (" INSTDONE_%d: 0x%08x\n" , i, instdone[i]); +i915_err_print_instdone (render_instdone, &extra);pr_err (" INSTPS: 0x%08x\n" ,I915_READ (INSTPS ));pr_err (" ACTHD: 0x%08x\n" ,I915_READ (ACTHD_I965 ));I915_WRITE (IPEIR_I965 , ipeir);
@@ -2529,8 +2541,7 @@ static void i915_report_and_clear_eir(struct drm_device *dev)if (eir &I915_ERROR_INSTRUCTION ) {pr_err ("instruction error\n" );pr_err (" INSTPM: 0x%08x\n" ,I915_READ (INSTPM )); -for (i =0 ; i <ARRAY_SIZE (instdone); i++) -pr_err (" INSTDONE_%d: 0x%08x\n" , i, instdone[i]); +i915_err_print_instdone (render_instdone, &extra);if (INTEL_INFO (dev)->gen <4 ) {u32 ipeir =I915_READ (IPEIR );
drivers/gpu/drm/i915/i915_reg.h +0 -1
@@ -1596,7 +1596,6 @@ enum skl_disp_power_wells {#define GEN7_SC_INSTDONE 0x07100#define GEN7_SAMPLER_INSTDONE 0x0e160#define GEN7_ROW_INSTDONE 0x0e164 -#define I915_NUM_INSTDONE_REG 4#define RING_IPEIR (base) ((base)+0x64)#define RING_IPEHR (base) ((base)+0x68)/*
Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/5 drm/i915: Try to print INSTDONE bits for all slice/subslice
In reply to Imre DeakFrom: Ben Widawsky <[email protected]>
---
Changes (Imre):
- use the new INSTDONE capturing by default on new GENs (On Ben's request)
- keep printing the render ring INSTDONE to dmesg
- don't hard code the extra_instdone array sizes
- fix typo in GEN8_MCR_SLICE/GEN8_MCR_SUBSLICE
- fix typo when capturing to extra->row
- warn if the MCR selectors are non-zero
--- drivers/gpu/drm/i915/i915_drv.h | 6 ++-- drivers/gpu/drm/i915/i915_gpu_error.c | 62 +++++++++++++++++++++++++++++++---- drivers/gpu/drm/i915/i915_irq.c | 4 +-- drivers/gpu/drm/i915/i915_reg.h | 5 +++ 4 files changed, 66 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +4 -2
@@ -513,10 +513,12 @@ struct drm_i915_error_state {u32 gam_ecochk;u32 gab_ctl;u32 gfx_mode; +#define INSTDONE_SLICE_NUM 3 +#define INSTDONE_SUBSLICE_NUM 3struct extra_instdone {u32 slice_common; -u32 sampler; -u32 row; +u32 sampler[INSTDONE_SLICE_NUM ][INSTDONE_SUBSLICE_NUM ]; +u32 row[INSTDONE_SLICE_NUM ][INSTDONE_SUBSLICE_NUM ]; } extra_instdone;u64 fence[I915_MAX_NUM_FENCES ];
drivers/gpu/drm/i915/i915_gpu_error.c +55 -7
90 lines not on this page · raw message
drivers/gpu/drm/i915/i915_irq.c +2 -2
@@ -2478,8 +2478,8 @@ i915_err_print_instdone(uint32_t render, struct extra_instdone *extra) {pr_err (" INSTDONE (render): 0x%08x\n" , render);pr_err (" INSTDONE (common): 0x%08x\n" , extra->slice_common); -pr_err (" INSTDONE (sampler): 0x%08x\n" , extra->sampler); -pr_err (" INSTDONE (row): 0x%08x\n" , extra->row); +pr_err (" INSTDONE (sampler): 0x%08x\n" , extra->sampler[0 ][0 ]); +pr_err (" INSTDONE (row): 0x%08x\n" , extra->row[0 ][0 ]); }static void i915_report_and_clear_eir (struct drm_device *dev)
drivers/gpu/drm/i915/i915_reg.h +5 -0
@@ -1596,6 +1596,11 @@ enum skl_disp_power_wells {#define GEN7_SC_INSTDONE 0x07100#define GEN7_SAMPLER_INSTDONE 0x0e160#define GEN7_ROW_INSTDONE 0x0e164 +#define GEN8_MCR_SELECTOR 0xfdc +#define GEN8_MCR_SLICE (slice) (((slice) & 3) << 26) +#define GEN8_MCR_SLICE_MASK (GEN8_MCR_SLICE(3)) +#define GEN8_MCR_SUBSLICE (slice) (((slice) & 3) << 24) +#define GEN8_MCR_SUBSLICE_MASK (GEN8_MCR_SUBSLICE(3))#define RING_IPEIR (base) ((base)+0x64)#define RING_IPEHR (base) ((base)+0x68)/*
Signature · 6 lines
2.1.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 5/5] drm/i915: Try to print INSTDONE bits for all slice/subslice
Quoted 52 lines · Imre Deak
From: Ben Widawsky <[email protected]>
Signed-off-by Ben Widawsky <[email protected]>---
Changes (Imre):
- use the new INSTDONE capturing by default on new GENs (On Ben's request)
- keep printing the render ring INSTDONE to dmesg
- don't hard code theextra_instdonearray sizes
- fix typo in GEN8_MCR_SLICE/GEN8_MCR_SUBSLICE
- fix typo when capturing toextra->row
- warn if the MCR selectors are non-zero--- drivers/gpu/drm/i915/i915_drv.h | 6 ++-- drivers/gpu/drm/i915/i915_gpu_error.c | 62 +++++++++++++++++++++++++++++++---- drivers/gpu/drm/i915/i915_irq.c | 4 +-- drivers/gpu/drm/i915/i915_reg.h | 5 +++ 4 files changed, 66 insertions(+), 11 deletions(-)drivers/gpu/drm/i915/i915_drv.h +4
-2@@ -513,10 +513,12 @@ struct drm_i915_error_state {u32 gam_ecochk;u32 gab_ctl;u32 gfx_mode; +#define INSTDONE_SLICE_NUM 3 +#define INSTDONE_SUBSLICE_NUM 3struct extra_instdone {u32 slice_common; -u32 sampler; -u32 row; +u32 sampler[INSTDONE_SLICE_NUM ][INSTDONE_SUBSLICE_NUM ]; +u32 row[INSTDONE_SLICE_NUM ][INSTDONE_SUBSLICE_NUM ]; } extra_instdone;u64 fence[I915_MAX_NUM_FENCES ];drivers/gpu/drm/i915/i915_gpu_error.c +1
-1@@ -336,7 +336,7 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,struct drm_i915_private *dev_priv = dev->dev_private;struct drm_i915_error_state *error = error_priv->error;struct drm_i915_error_object *obj; -int i, j, offset, elt; +int i, j, slice, subslice, offset, elt;int max_hangcheck_score;if (!error) {
drivers/gpu/drm/i915/i915_gpu_error.c int i915_error_state_to_str(struct drm_i915_error_state_buf *m, · line 388
Quoted 7 lines
drivers/gpu/drm/i915/i915_gpu_error.c +1
-3@@ -385,9 +385,17 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,err_printf (m," SC_INSTDONE (slice common): 0x%08x\n" , error->extra_instdone.slice_common); -err_printf (m," SAMPLER_INTSDONE: 0x%08x\n" , - error->extra_instdone.sampler); -err_printf (m," ROW_INSTDONE: 0x%08x\n" , error->extra_instdone.row); +for (slice =0 ; slice <INSTDONE_SLICE_NUM ; slice++) {
Ideally we should only be doing this for the active slices. I was hoping you'd have a chance to look into that. Do we know if this works on SKUs with fewer slices?
Quoted 111 lines
drivers/gpu/drm/i915/i915_gpu_error.c +53
-3+for (subslice =0 ; subslice <INSTDONE_SUBSLICE_NUM ; + subslice++) { +struct extra_instdone *extra = &error->extra_instdone; + +err_printf (m," SAMPLER_INTSDONE: 0x%08x\n" , + extra->sampler[slice][subslice]); +err_printf (m," ROW_INSTDONE: 0x%08x\n" , + extra->row[slice][subslice]); + } + }if (INTEL_INFO (dev)->gen >=6 ) {err_printf (m,"ERROR: 0x%08x\n" , error->error);@@ -1383,11 +1391,35 @@ const char *i915_cache_level_str(struct drm_i915_private *i915, int type) } } -/* NB: please notice the memset */ +static inline uint32_t instdone_read (struct drm_i915_private *dev_priv,int + slice,int subslice,uint32_t offset) { +/* +* XXX: The MCR register should be locked, but since we are only using +* it for debug/error state, it's not terribly important to +* synchronize it properly. +*/ +uint32_t tmp =I915_READ (GEN8_MCR_SELECTOR ); +uint32_t ret; + +/* +* The HW expects the slice and sublice selectors to be reset to 0 +* after reading out the registers. +*/ +WARN_ON_ONCE (tmp & (GEN8_MCR_SLICE_MASK |GEN8_MCR_SUBSLICE_MASK )); + +I915_WRITE (GEN8_MCR_SELECTOR , tmp |GEN8_MCR_SLICE (slice) | +GEN8_MCR_SUBSLICE (subslice)); + ret =I915_READ (offset); +I915_WRITE (GEN8_MCR_SELECTOR , tmp); + +return ret; +} +void i915_get_extra_instdone (struct drm_device *dev,struct extra_instdone *extra) {struct drm_i915_private *dev_priv = dev->dev_private; +int slice, subslice;/* * The render INSTDONE register (GEN2_INSTDONE, RING_INSTDONE) is read @@ -1396,8 +1428,24 @@ void i915_get_extra_instdone(struct drm_device *dev,switch (INTEL_INFO (dev)->gen) {default : extra->slice_common =I915_READ (GEN7_SC_INSTDONE ); - extra->sampler =I915_READ (GEN7_SAMPLER_INSTDONE ); - extra->row =I915_READ (GEN7_ROW_INSTDONE ); +for (slice =0 ; slice <INSTDONE_SLICE_NUM ; slice++) { +for (subslice =0 ; subslice <INSTDONE_SUBSLICE_NUM ; + subslice++) { + extra->sampler[slice][subslice] = +instdone_read (dev_priv, + slice, subslice, +GEN7_SAMPLER_INSTDONE ); + extra->row[slice][subslice] = +instdone_read (dev_priv, + slice, subslice, +GEN7_ROW_INSTDONE ); + } + } +break ; +case 7 : + extra->slice_common =I915_READ (GEN7_SC_INSTDONE ); + extra->sampler[0 ][0 ] =I915_READ (GEN7_SAMPLER_INSTDONE ); + extra->row[0 ][0 ] =I915_READ (GEN7_ROW_INSTDONE );break ;case 6 :case 5 :drivers/gpu/drm/i915/i915_irq.c +2
-2@@ -2478,8 +2478,8 @@ i915_err_print_instdone(uint32_t render, struct extra_instdone *extra) {pr_err (" INSTDONE (render): 0x%08x\n" , render);pr_err (" INSTDONE (common): 0x%08x\n" , extra->slice_common); -pr_err (" INSTDONE (sampler): 0x%08x\n" , extra->sampler); -pr_err (" INSTDONE (row): 0x%08x\n" , extra->row); +pr_err (" INSTDONE (sampler): 0x%08x\n" , extra->sampler[0 ][0 ]); +pr_err (" INSTDONE (row): 0x%08x\n" , extra->row[0 ][0 ]); }static void i915_report_and_clear_eir (struct drm_device *dev)drivers/gpu/drm/i915/i915_reg.h +5
-0@@ -1596,6 +1596,11 @@ enum skl_disp_power_wells {#define GEN7_SC_INSTDONE 0x07100#define GEN7_SAMPLER_INSTDONE 0x0e160#define GEN7_ROW_INSTDONE 0x0e164 +#define GEN8_MCR_SELECTOR 0xfdc +#define GEN8_MCR_SLICE (slice) (((slice) & 3) << 26) +#define GEN8_MCR_SLICE_MASK (GEN8_MCR_SLICE(3)) +#define GEN8_MCR_SUBSLICE (slice) (((slice) & 3) << 24) +#define GEN8_MCR_SUBSLICE_MASK (GEN8_MCR_SUBSLICE(3))#define RING_IPEIR (base) ((base)+0x64)#define RING_IPEHR (base) ((base)+0x68)/* Signature · 1 line
2.1.4
Signature · 5 lines
Ben Widawsky, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 5/5] drm/i915: Try to print INSTDONE bits for all slice/subslice
Quoted 54 lines · Ben Widawsky
Quoted 53 lines · Imre Deak
From: Ben Widawsky <[email protected]>
Signed-off-by Ben Widawsky <[email protected]>---
Changes (Imre):
- use the new INSTDONE capturing by default on new GENs (On Ben's request)
- keep printing the render ring INSTDONE to dmesg
- don't hard code theextra_instdonearray sizes
- fix typo in GEN8_MCR_SLICE/GEN8_MCR_SUBSLICE
- fix typo when capturing toextra->row
- warn if the MCR selectors are non-zero--- drivers/gpu/drm/i915/i915_drv.h | 6 ++-- drivers/gpu/drm/i915/i915_gpu_error.c | 62 +++++++++++++++++++++++++++++++---- drivers/gpu/drm/i915/i915_irq.c | 4 +-- drivers/gpu/drm/i915/i915_reg.h | 5 +++ 4 files changed, 66 insertions(+), 11 deletions(-)drivers/gpu/drm/i915/i915_drv.h +4
-2@@ -513,10 +513,12 @@ struct drm_i915_error_state {u32 gam_ecochk;u32 gab_ctl;u32 gfx_mode; +#define INSTDONE_SLICE_NUM 3 +#define INSTDONE_SUBSLICE_NUM 3struct extra_instdone {u32 slice_common; -u32 sampler; -u32 row; +u32 sampler[INSTDONE_SLICE_NUM ][INSTDONE_SUBSLICE_NUM ]; +u32 row[INSTDONE_SLICE_NUM ][INSTDONE_SUBSLICE_NUM ]; } extra_instdone;u64 fence[I915_MAX_NUM_FENCES ];drivers/gpu/drm/i915/i915_gpu_error.c +1
-1@@ -336,7 +336,7 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,struct drm_i915_private *dev_priv = dev->dev_private;struct drm_i915_error_state *error = error_priv->error;struct drm_i915_error_object *obj; -int i, j, offset, elt; +int i, j, slice, subslice, offset, elt;int max_hangcheck_score;if (!error) {@@ -385,9 +385,17 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
Quoted 8 lines
drivers/gpu/drm/i915/i915_gpu_error.c int i915_error_state_to_str(struct drm_i915_error_state_buf *m, · line 388
Quoted 6 lines
drivers/gpu/drm/i915/i915_gpu_error.c +1
-3err_printf (m," SC_INSTDONE (slice common): 0x%08x\n" , error->extra_instdone.slice_common); -err_printf (m," SAMPLER_INTSDONE: 0x%08x\n" , - error->extra_instdone.sampler); -err_printf (m," ROW_INSTDONE: 0x%08x\n" , error->extra_instdone.row); +for (slice =0 ; slice <INSTDONE_SLICE_NUM ; slice++) {Ideally we should only be doing this for the active slices.
Looking at it now the spec is not too clear to me:
"""
When slice 0 is disabled (when fuse reflection MMADR 0x9120[25] = 0), this field must be set to a valid slice (slice 1 or slice 2) before issuing a read to a register in a slice unit.
"""
Why is slice 0 special? I would understand the above if it just said "the field must be set to a valid slice", without mentioning specific slices.
But yes, I think it would be safer to access only active slices. I would also limit the readout to active subslices, although there is no similar note about it in bspec.
Quoted 1 line
I was hoping you'd have a chance to look into that.
Ok, I'll resend this patch with the above changed.
Quoted 1 line
Do we know if this works on SKUs with fewer slices?
It worked on CHV and BXT.
Quoted 103 lines
Quoted 103 lines
drivers/gpu/drm/i915/i915_gpu_error.c +53
-3+for (subslice =0 ; subslice <INSTDONE_SUBSLICE_NUM ; + subslice++) { +struct extra_instdone *extra = &error->extra_instdone; + +err_printf (m," SAMPLER_INTSDONE: 0x%08x\n" , + extra->sampler[slice][subslice]); +err_printf (m," ROW_INSTDONE: 0x%08x\n" , + extra->row[slice][subslice]); + } + }if (INTEL_INFO (dev)->gen >=6 ) {err_printf (m,"ERROR: 0x%08x\n" , error->error);@@ -1383,11 +1391,35 @@ const char *i915_cache_level_str(struct drm_i915_private *i915, int type) } } -/* NB: please notice the memset */ +static inline uint32_t instdone_read (struct drm_i915_private *dev_priv,int + slice,int subslice,uint32_t offset) { +/* +* XXX: The MCR register should be locked, but since we are only using +* it for debug/error state, it's not terribly important to +* synchronize it properly. +*/ +uint32_t tmp =I915_READ (GEN8_MCR_SELECTOR ); +uint32_t ret; + +/* +* The HW expects the slice and sublice selectors to be reset to 0 +* after reading out the registers. +*/ +WARN_ON_ONCE (tmp & (GEN8_MCR_SLICE_MASK |GEN8_MCR_SUBSLICE_MASK )); + +I915_WRITE (GEN8_MCR_SELECTOR , tmp |GEN8_MCR_SLICE (slice) | +GEN8_MCR_SUBSLICE (subslice)); + ret =I915_READ (offset); +I915_WRITE (GEN8_MCR_SELECTOR , tmp); + +return ret; +} +void i915_get_extra_instdone (struct drm_device *dev,struct extra_instdone *extra) {struct drm_i915_private *dev_priv = dev->dev_private; +int slice, subslice;/* * The render INSTDONE register (GEN2_INSTDONE, RING_INSTDONE) is read @@ -1396,8 +1428,24 @@ void i915_get_extra_instdone(struct drm_device *dev,switch (INTEL_INFO (dev)->gen) {default : extra->slice_common =I915_READ (GEN7_SC_INSTDONE ); - extra->sampler =I915_READ (GEN7_SAMPLER_INSTDONE ); - extra->row =I915_READ (GEN7_ROW_INSTDONE ); +for (slice =0 ; slice <INSTDONE_SLICE_NUM ; slice++) { +for (subslice =0 ; subslice <INSTDONE_SUBSLICE_NUM ; + subslice++) { + extra->sampler[slice][subslice] = +instdone_read (dev_priv, + slice, subslice, +GEN7_SAMPLER_INSTDONE ); + extra->row[slice][subslice] = +instdone_read (dev_priv, + slice, subslice, +GEN7_ROW_INSTDONE ); + } + } +break ; +case 7 : + extra->slice_common =I915_READ (GEN7_SC_INSTDONE ); + extra->sampler[0 ][0 ] =I915_READ (GEN7_SAMPLER_INSTDONE ); + extra->row[0 ][0 ] =I915_READ (GEN7_ROW_INSTDONE );break ;case 6 :case 5 :drivers/gpu/drm/i915/i915_irq.c +2
-2@@ -2478,8 +2478,8 @@ i915_err_print_instdone(uint32_t render, struct extra_instdone *extra) {pr_err (" INSTDONE (render): 0x%08x\n" , render);pr_err (" INSTDONE (common): 0x%08x\n" , extra->slice_common); -pr_err (" INSTDONE (sampler): 0x%08x\n" , extra->sampler); -pr_err (" INSTDONE (row): 0x%08x\n" , extra->row); +pr_err (" INSTDONE (sampler): 0x%08x\n" , extra->sampler[0 ][0 ]); +pr_err (" INSTDONE (row): 0x%08x\n" , extra->row[0 ][0 ]); }static void i915_report_and_clear_eir (struct drm_device *dev)drivers/gpu/drm/i915/i915_reg.h +3
-0@@ -1596,6 +1596,11 @@ enum skl_disp_power_wells {#define GEN7_SC_INSTDONE 0x07100#define GEN7_SAMPLER_INSTDONE 0x0e160#define GEN7_ROW_INSTDONE 0x0e164 +#define GEN8_MCR_SELECTOR 0xfdc +#define GEN8_MCR_SLICE (slice) (((slice) & 3) << 26) +#define GEN8_MCR_SLICE_MASK (GEN8_MCR_SLICE(3))
Quoted 9 lines
Quoted 8 lines
drivers/gpu/drm/i915/i915_reg.h +2
-0+#define GEN8_MCR_SUBSLICE (slice) (((slice) & 3) << 24) +#define GEN8_MCR_SUBSLICE_MASK (GEN8_MCR_SUBSLICE(3))#define RING_IPEIR (base) ((base)+0x64)#define RING_IPEHR (base) ((base)+0x68)/* Signature · 1 line
2.1.4
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 5/5] drm/i915: Try to print INSTDONE bits for all slice/subslice
Quoted 64 lines · Imre Deak
Quoted 54 lines · Ben Widawsky
Quoted 53 lines · Imre Deak
From: Ben Widawsky <[email protected]>
Signed-off-by Ben Widawsky <[email protected]>---
Changes (Imre):
- use the new INSTDONE capturing by default on new GENs (On Ben's request)
- keep printing the render ring INSTDONE to dmesg
- don't hard code theextra_instdonearray sizes
- fix typo in GEN8_MCR_SLICE/GEN8_MCR_SUBSLICE
- fix typo when capturing toextra->row
- warn if the MCR selectors are non-zero--- drivers/gpu/drm/i915/i915_drv.h | 6 ++-- drivers/gpu/drm/i915/i915_gpu_error.c | 62 +++++++++++++++++++++++++++++++---- drivers/gpu/drm/i915/i915_irq.c | 4 +-- drivers/gpu/drm/i915/i915_reg.h | 5 +++ 4 files changed, 66 insertions(+), 11 deletions(-)drivers/gpu/drm/i915/i915_drv.h +4
-2@@ -513,10 +513,12 @@ struct drm_i915_error_state {u32 gam_ecochk;u32 gab_ctl;u32 gfx_mode; +#define INSTDONE_SLICE_NUM 3 +#define INSTDONE_SUBSLICE_NUM 3struct extra_instdone {u32 slice_common; -u32 sampler; -u32 row; +u32 sampler[INSTDONE_SLICE_NUM ][INSTDONE_SUBSLICE_NUM ]; +u32 row[INSTDONE_SLICE_NUM ][INSTDONE_SUBSLICE_NUM ]; } extra_instdone;u64 fence[I915_MAX_NUM_FENCES ];drivers/gpu/drm/i915/i915_gpu_error.c +1
-1@@ -336,7 +336,7 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,struct drm_i915_private *dev_priv = dev->dev_private;struct drm_i915_error_state *error = error_priv->error;struct drm_i915_error_object *obj; -int i, j, offset, elt; +int i, j, slice, subslice, offset, elt;int max_hangcheck_score;if (!error) {@@ -385,9 +385,17 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,Quoted 8 lines
drivers/gpu/drm/i915/i915_gpu_error.c int i915_error_state_to_str(struct drm_i915_error_state_buf *m, · line 388
Quoted 6 lines
drivers/gpu/drm/i915/i915_gpu_error.c +1
-3err_printf (m," SC_INSTDONE (slice common): 0x%08x\n" , error->extra_instdone.slice_common); -err_printf (m," SAMPLER_INTSDONE: 0x%08x\n" , - error->extra_instdone.sampler); -err_printf (m," ROW_INSTDONE: 0x%08x\n" , error->extra_instdone.row); +for (slice =0 ; slice <INSTDONE_SLICE_NUM ; slice++) {Ideally we should only be doing this for the active slices.
Quoted 7 lines
Looking at it now the spec is not too clear to me:
"""
When slice 0 is disabled (when fuse reflection MMADR 0x9120[25] = 0), this field must be set to a valid slice (slice 1 or slice 2) before issuing a read to a register in a slice unit.
"""
The default is to go to slice 0. So if you have slice 0 disabled (which I believe only exists in special fused configs) you will end up reading garbage on the MMIO. This is true of all MMIO, not just INSTDONE. In other words, if we actually have such things shipping, they surely aren't working today.
Quoted 130 lines
Why is slice 0 special? I would understand the above if it just said "the field must be set to a valid slice", without mentioning specific slices.
But yes, I think it would be safer to access only active slices. I would also limit the readout to active subslices, although there is no similar note about it in bspec.
Quoted 1 line
I was hoping you'd have a chance to look into that.
Ok, I'll resend this patch with the above changed.
Quoted 1 line
Do we know if this works on SKUs with fewer slices?
It worked on CHV and BXT.
Quoted 112 lines
Quoted 111 lines
drivers/gpu/drm/i915/i915_gpu_error.c +53
-3+for (subslice =0 ; subslice <INSTDONE_SUBSLICE_NUM ; + subslice++) { +struct extra_instdone *extra = &error->extra_instdone; + +err_printf (m," SAMPLER_INTSDONE: 0x%08x\n" , + extra->sampler[slice][subslice]); +err_printf (m," ROW_INSTDONE: 0x%08x\n" , + extra->row[slice][subslice]); + } + }if (INTEL_INFO (dev)->gen >=6 ) {err_printf (m,"ERROR: 0x%08x\n" , error->error);@@ -1383,11 +1391,35 @@ const char *i915_cache_level_str(struct drm_i915_private *i915, int type) } } -/* NB: please notice the memset */ +static inline uint32_t instdone_read (struct drm_i915_private *dev_priv,int + slice,int subslice,uint32_t offset) { +/* +* XXX: The MCR register should be locked, but since we are only using +* it for debug/error state, it's not terribly important to +* synchronize it properly. +*/ +uint32_t tmp =I915_READ (GEN8_MCR_SELECTOR ); +uint32_t ret; + +/* +* The HW expects the slice and sublice selectors to be reset to 0 +* after reading out the registers. +*/ +WARN_ON_ONCE (tmp & (GEN8_MCR_SLICE_MASK |GEN8_MCR_SUBSLICE_MASK )); + +I915_WRITE (GEN8_MCR_SELECTOR , tmp |GEN8_MCR_SLICE (slice) | +GEN8_MCR_SUBSLICE (subslice)); + ret =I915_READ (offset); +I915_WRITE (GEN8_MCR_SELECTOR , tmp); + +return ret; +} +void i915_get_extra_instdone (struct drm_device *dev,struct extra_instdone *extra) {struct drm_i915_private *dev_priv = dev->dev_private; +int slice, subslice;/* * The render INSTDONE register (GEN2_INSTDONE, RING_INSTDONE) is read @@ -1396,8 +1428,24 @@ void i915_get_extra_instdone(struct drm_device *dev,switch (INTEL_INFO (dev)->gen) {default : extra->slice_common =I915_READ (GEN7_SC_INSTDONE ); - extra->sampler =I915_READ (GEN7_SAMPLER_INSTDONE ); - extra->row =I915_READ (GEN7_ROW_INSTDONE ); +for (slice =0 ; slice <INSTDONE_SLICE_NUM ; slice++) { +for (subslice =0 ; subslice <INSTDONE_SUBSLICE_NUM ; + subslice++) { + extra->sampler[slice][subslice] = +instdone_read (dev_priv, + slice, subslice, +GEN7_SAMPLER_INSTDONE ); + extra->row[slice][subslice] = +instdone_read (dev_priv, + slice, subslice, +GEN7_ROW_INSTDONE ); + } + } +break ; +case 7 : + extra->slice_common =I915_READ (GEN7_SC_INSTDONE ); + extra->sampler[0 ][0 ] =I915_READ (GEN7_SAMPLER_INSTDONE ); + extra->row[0 ][0 ] =I915_READ (GEN7_ROW_INSTDONE );break ;case 6 :case 5 :drivers/gpu/drm/i915/i915_irq.c +2
-2@@ -2478,8 +2478,8 @@ i915_err_print_instdone(uint32_t render, struct extra_instdone *extra) {pr_err (" INSTDONE (render): 0x%08x\n" , render);pr_err (" INSTDONE (common): 0x%08x\n" , extra->slice_common); -pr_err (" INSTDONE (sampler): 0x%08x\n" , extra->sampler); -pr_err (" INSTDONE (row): 0x%08x\n" , extra->row); +pr_err (" INSTDONE (sampler): 0x%08x\n" , extra->sampler[0 ][0 ]); +pr_err (" INSTDONE (row): 0x%08x\n" , extra->row[0 ][0 ]); }static void i915_report_and_clear_eir (struct drm_device *dev)drivers/gpu/drm/i915/i915_reg.h +5
-0@@ -1596,6 +1596,11 @@ enum skl_disp_power_wells {#define GEN7_SC_INSTDONE 0x07100#define GEN7_SAMPLER_INSTDONE 0x0e160#define GEN7_ROW_INSTDONE 0x0e164 +#define GEN8_MCR_SELECTOR 0xfdc +#define GEN8_MCR_SLICE (slice) (((slice) & 3) << 26) +#define GEN8_MCR_SLICE_MASK (GEN8_MCR_SLICE(3)) +#define GEN8_MCR_SUBSLICE (slice) (((slice) & 3) << 24) +#define GEN8_MCR_SUBSLICE_MASK (GEN8_MCR_SUBSLICE(3))#define RING_IPEIR (base) ((base)+0x64)#define RING_IPEHR (base) ((base)+0x68)/* Signature · 1 line
2.1.4
Signature · 5 lines
Ben Widawsky, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 5/5] drm/i915: Try to print INSTDONE bits for all slice/subslice
In reply to Imre DeakQuoted 90 lines · Imre Deak
From: Ben Widawsky <[email protected]>
Signed-off-by Ben Widawsky <[email protected]>---
Changes (Imre):
- use the new INSTDONE capturing by default on new GENs (On Ben's request)
- keep printing the render ring INSTDONE to dmesg
- don't hard code theextra_instdonearray sizes
- fix typo in GEN8_MCR_SLICE/GEN8_MCR_SUBSLICE
- fix typo when capturing toextra->row
- warn if the MCR selectors are non-zero--- drivers/gpu/drm/i915/i915_drv.h | 6 ++-- drivers/gpu/drm/i915/i915_gpu_error.c | 62 +++++++++++++++++++++++++++++++---- drivers/gpu/drm/i915/i915_irq.c | 4 +-- drivers/gpu/drm/i915/i915_reg.h | 5 +++ 4 files changed, 66 insertions(+), 11 deletions(-)drivers/gpu/drm/i915/i915_drv.h +4
-2@@ -513,10 +513,12 @@ struct drm_i915_error_state {u32 gam_ecochk;u32 gab_ctl;u32 gfx_mode; +#define INSTDONE_SLICE_NUM 3 +#define INSTDONE_SUBSLICE_NUM 3struct extra_instdone {u32 slice_common; -u32 sampler; -u32 row; +u32 sampler[INSTDONE_SLICE_NUM ][INSTDONE_SUBSLICE_NUM ]; +u32 row[INSTDONE_SLICE_NUM ][INSTDONE_SUBSLICE_NUM ]; } extra_instdone;u64 fence[I915_MAX_NUM_FENCES ];drivers/gpu/drm/i915/i915_gpu_error.c +25
-5@@ -336,7 +336,7 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,struct drm_i915_private *dev_priv = dev->dev_private;struct drm_i915_error_state *error = error_priv->error;struct drm_i915_error_object *obj; -int i, j, offset, elt; +int i, j, slice, subslice, offset, elt;int max_hangcheck_score;if (!error) {@@ -385,9 +385,17 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,err_printf (m," SC_INSTDONE (slice common): 0x%08x\n" , error->extra_instdone.slice_common); -err_printf (m," SAMPLER_INTSDONE: 0x%08x\n" , - error->extra_instdone.sampler); -err_printf (m," ROW_INSTDONE: 0x%08x\n" , error->extra_instdone.row); +for (slice =0 ; slice <INSTDONE_SLICE_NUM ; slice++) { +for (subslice =0 ; subslice <INSTDONE_SUBSLICE_NUM ; + subslice++) { +struct extra_instdone *extra = &error->extra_instdone; + +err_printf (m," SAMPLER_INTSDONE: 0x%08x\n" , + extra->sampler[slice][subslice]); +err_printf (m," ROW_INSTDONE: 0x%08x\n" , + extra->row[slice][subslice]); + } + }if (INTEL_INFO (dev)->gen >=6 ) {err_printf (m,"ERROR: 0x%08x\n" , error->error);@@ -1383,11 +1391,35 @@ const char *i915_cache_level_str(struct drm_i915_private *i915, int type) } } -/* NB: please notice the memset */ +static inline uint32_t instdone_read (struct drm_i915_private *dev_priv,int + slice,int subslice,uint32_t offset) { +/* +* XXX: The MCR register should be locked, but since we are only using +* it for debug/error state, it's not terribly important to +* synchronize it properly. +*/ +uint32_t tmp =I915_READ (GEN8_MCR_SELECTOR ); +uint32_t ret; + +/* +* The HW expects the slice and sublice selectors to be reset to 0 +* after reading out the registers.
drivers/gpu/drm/i915/i915_gpu_error.c const char *i915_cache_level_str(struct drm_i915_private *i915, int type) · line 1416
Quoted 10 lines
drivers/gpu/drm/i915/i915_gpu_error.c +10
-0+*/ +WARN_ON_ONCE (tmp & (GEN8_MCR_SLICE_MASK |GEN8_MCR_SUBSLICE_MASK )); + +I915_WRITE (GEN8_MCR_SELECTOR , tmp |GEN8_MCR_SLICE (slice) | +GEN8_MCR_SUBSLICE (subslice)); + ret =I915_READ (offset); +I915_WRITE (GEN8_MCR_SELECTOR , tmp); + +return ret; +}
Hmm. I have second thoughts on this. We should take struct_mutex to prevent any reads/writes while we're doing this.
Quoted 70 lines
drivers/gpu/drm/i915/i915_gpu_error.c +20
-2+void i915_get_extra_instdone (struct drm_device *dev,struct extra_instdone *extra) {struct drm_i915_private *dev_priv = dev->dev_private; +int slice, subslice;/* * The render INSTDONE register (GEN2_INSTDONE, RING_INSTDONE) is read @@ -1396,8 +1428,24 @@ void i915_get_extra_instdone(struct drm_device *dev,switch (INTEL_INFO (dev)->gen) {default : extra->slice_common =I915_READ (GEN7_SC_INSTDONE ); - extra->sampler =I915_READ (GEN7_SAMPLER_INSTDONE ); - extra->row =I915_READ (GEN7_ROW_INSTDONE ); +for (slice =0 ; slice <INSTDONE_SLICE_NUM ; slice++) { +for (subslice =0 ; subslice <INSTDONE_SUBSLICE_NUM ; + subslice++) { + extra->sampler[slice][subslice] = +instdone_read (dev_priv, + slice, subslice, +GEN7_SAMPLER_INSTDONE ); + extra->row[slice][subslice] = +instdone_read (dev_priv, + slice, subslice, +GEN7_ROW_INSTDONE ); + } + } +break ; +case 7 : + extra->slice_common =I915_READ (GEN7_SC_INSTDONE ); + extra->sampler[0 ][0 ] =I915_READ (GEN7_SAMPLER_INSTDONE ); + extra->row[0 ][0 ] =I915_READ (GEN7_ROW_INSTDONE );break ;case 6 :case 5 :drivers/gpu/drm/i915/i915_irq.c +2
-2@@ -2478,8 +2478,8 @@ i915_err_print_instdone(uint32_t render, struct extra_instdone *extra) {pr_err (" INSTDONE (render): 0x%08x\n" , render);pr_err (" INSTDONE (common): 0x%08x\n" , extra->slice_common); -pr_err (" INSTDONE (sampler): 0x%08x\n" , extra->sampler); -pr_err (" INSTDONE (row): 0x%08x\n" , extra->row); +pr_err (" INSTDONE (sampler): 0x%08x\n" , extra->sampler[0 ][0 ]); +pr_err (" INSTDONE (row): 0x%08x\n" , extra->row[0 ][0 ]); }static void i915_report_and_clear_eir (struct drm_device *dev)drivers/gpu/drm/i915/i915_reg.h +5
-0@@ -1596,6 +1596,11 @@ enum skl_disp_power_wells {#define GEN7_SC_INSTDONE 0x07100#define GEN7_SAMPLER_INSTDONE 0x0e160#define GEN7_ROW_INSTDONE 0x0e164 +#define GEN8_MCR_SELECTOR 0xfdc +#define GEN8_MCR_SLICE (slice) (((slice) & 3) << 26) +#define GEN8_MCR_SLICE_MASK (GEN8_MCR_SLICE(3)) +#define GEN8_MCR_SUBSLICE (slice) (((slice) & 3) << 24) +#define GEN8_MCR_SUBSLICE_MASK (GEN8_MCR_SUBSLICE(3))#define RING_IPEIR (base) ((base)+0x64)#define RING_IPEHR (base) ((base)+0x68)/* Signature · 1 line
2.1.4
Signature · 5 lines
Ben Widawsky, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 5/5] drm/i915: Try to print INSTDONE bits for all slice/subslice
Quoted 96 lines · Ben Widawsky
Quoted 95 lines · Imre Deak
From: Ben Widawsky <[email protected]>
Signed-off-by Ben Widawsky <[email protected]>---
Changes (Imre):
- use the new INSTDONE capturing by default on new GENs (On Ben's request)
- keep printing the render ring INSTDONE to dmesg
- don't hard code theextra_instdonearray sizes
- fix typo in GEN8_MCR_SLICE/GEN8_MCR_SUBSLICE
- fix typo when capturing toextra->row
- warn if the MCR selectors are non-zero--- drivers/gpu/drm/i915/i915_drv.h | 6 ++-- drivers/gpu/drm/i915/i915_gpu_error.c | 62 +++++++++++++++++++++++++++++++---- drivers/gpu/drm/i915/i915_irq.c | 4 +-- drivers/gpu/drm/i915/i915_reg.h | 5 +++ 4 files changed, 66 insertions(+), 11 deletions(-)drivers/gpu/drm/i915/i915_drv.h +4
-2@@ -513,10 +513,12 @@ struct drm_i915_error_state {u32 gam_ecochk;u32 gab_ctl;u32 gfx_mode; +#define INSTDONE_SLICE_NUM 3 +#define INSTDONE_SUBSLICE_NUM 3struct extra_instdone {u32 slice_common; -u32 sampler; -u32 row; +u32 sampler[INSTDONE_SLICE_NUM ][INSTDONE_SUBSLICE_NUM ]; +u32 row[INSTDONE_SLICE_NUM ][INSTDONE_SUBSLICE_NUM ]; } extra_instdone;u64 fence[I915_MAX_NUM_FENCES ];drivers/gpu/drm/i915/i915_gpu_error.c +30
-5@@ -336,7 +336,7 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,struct drm_i915_private *dev_priv = dev->dev_private;struct drm_i915_error_state *error = error_priv->error;struct drm_i915_error_object *obj; -int i, j, offset, elt; +int i, j, slice, subslice, offset, elt;int max_hangcheck_score;if (!error) {@@ -385,9 +385,17 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,err_printf (m," SC_INSTDONE (slice common): 0x%08x\n" , error->extra_instdone.slice_common); -err_printf (m," SAMPLER_INTSDONE: 0x%08x\n" , - error->extra_instdone.sampler); -err_printf (m," ROW_INSTDONE: 0x%08x\n" , error->extra_instdone.row); +for (slice =0 ; slice <INSTDONE_SLICE_NUM ; slice++) { +for (subslice =0 ; subslice <INSTDONE_SUBSLICE_NUM ; + subslice++) { +struct extra_instdone *extra = &error->extra_instdone; + +err_printf (m," SAMPLER_INTSDONE: 0x%08x\n" , + extra->sampler[slice][subslice]); +err_printf (m," ROW_INSTDONE: 0x%08x\n" , + extra->row[slice][subslice]); + } + }if (INTEL_INFO (dev)->gen >=6 ) {err_printf (m,"ERROR: 0x%08x\n" , error->error);@@ -1383,11 +1391,35 @@ const char *i915_cache_level_str(struct drm_i915_private *i915, int type) } } -/* NB: please notice the memset */ +static inline uint32_t instdone_read (struct drm_i915_private *dev_priv,int + slice,int subslice,uint32_t offset) { +/* +* XXX: The MCR register should be locked, but since we are only using +* it for debug/error state, it's not terribly important to +* synchronize it properly. +*/ +uint32_t tmp =I915_READ (GEN8_MCR_SELECTOR ); +uint32_t ret; + +/* +* The HW expects the slice and sublice selectors to be reset to 0 +* after reading out the registers. +*/ +WARN_ON_ONCE (tmp & (GEN8_MCR_SLICE_MASK |GEN8_MCR_SUBSLICE_MASK )); + +I915_WRITE (GEN8_MCR_SELECTOR , tmp |GEN8_MCR_SLICE (slice) | +GEN8_MCR_SUBSLICE (subslice));
Quoted 8 lines
drivers/gpu/drm/i915/i915_gpu_error.c const char *i915_cache_level_str(struct drm_i915_private *i915, int type) · line 1416
Quoted 5 lines
drivers/gpu/drm/i915/i915_gpu_error.c +5
-0+ ret =I915_READ (offset); +I915_WRITE (GEN8_MCR_SELECTOR , tmp); + +return ret; +}Hmm. I have second thoughts on this. We should take
struct_mutexto prevent any reads/writes while we're doing this.
Right. I guess taking mutex_lock on the error path would be frowned upon. So how about extending uncore.lock from I915_WRITE to the whole sequence instead?
Quoted 62 lines
Quoted 62 lines
drivers/gpu/drm/i915/i915_gpu_error.c +20
-2+void i915_get_extra_instdone (struct drm_device *dev,struct extra_instdone *extra) {struct drm_i915_private *dev_priv = dev->dev_private; +int slice, subslice;/* * The render INSTDONE register (GEN2_INSTDONE, RING_INSTDONE) is read @@ -1396,8 +1428,24 @@ void i915_get_extra_instdone(struct drm_device *dev,switch (INTEL_INFO (dev)->gen) {default : extra->slice_common =I915_READ (GEN7_SC_INSTDONE ); - extra->sampler =I915_READ (GEN7_SAMPLER_INSTDONE ); - extra->row =I915_READ (GEN7_ROW_INSTDONE ); +for (slice =0 ; slice <INSTDONE_SLICE_NUM ; slice++) { +for (subslice =0 ; subslice <INSTDONE_SUBSLICE_NUM ; + subslice++) { + extra->sampler[slice][subslice] = +instdone_read (dev_priv, + slice, subslice, +GEN7_SAMPLER_INSTDONE ); + extra->row[slice][subslice] = +instdone_read (dev_priv, + slice, subslice, +GEN7_ROW_INSTDONE ); + } + } +break ; +case 7 : + extra->slice_common =I915_READ (GEN7_SC_INSTDONE ); + extra->sampler[0 ][0 ] =I915_READ (GEN7_SAMPLER_INSTDONE ); + extra->row[0 ][0 ] =I915_READ (GEN7_ROW_INSTDONE );break ;case 6 :case 5 :drivers/gpu/drm/i915/i915_irq.c +2
-2@@ -2478,8 +2478,8 @@ i915_err_print_instdone(uint32_t render, struct extra_instdone *extra) {pr_err (" INSTDONE (render): 0x%08x\n" , render);pr_err (" INSTDONE (common): 0x%08x\n" , extra->slice_common); -pr_err (" INSTDONE (sampler): 0x%08x\n" , extra->sampler); -pr_err (" INSTDONE (row): 0x%08x\n" , extra->row); +pr_err (" INSTDONE (sampler): 0x%08x\n" , extra->sampler[0 ][0 ]); +pr_err (" INSTDONE (row): 0x%08x\n" , extra->row[0 ][0 ]); }static void i915_report_and_clear_eir (struct drm_device *dev)drivers/gpu/drm/i915/i915_reg.h +3
-0@@ -1596,6 +1596,11 @@ enum skl_disp_power_wells {#define GEN7_SC_INSTDONE 0x07100#define GEN7_SAMPLER_INSTDONE 0x0e160#define GEN7_ROW_INSTDONE 0x0e164 +#define GEN8_MCR_SELECTOR 0xfdc +#define GEN8_MCR_SLICE (slice) (((slice) & 3) << 26) +#define GEN8_MCR_SLICE_MASK (GEN8_MCR_SLICE(3))
Quoted 9 lines
Quoted 8 lines
drivers/gpu/drm/i915/i915_reg.h +2
-0+#define GEN8_MCR_SUBSLICE (slice) (((slice) & 3) << 24) +#define GEN8_MCR_SUBSLICE_MASK (GEN8_MCR_SUBSLICE(3))#define RING_IPEIR (base) ((base)+0x64)#define RING_IPEHR (base) ((base)+0x68)/* Signature · 1 line
2.1.4
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 5/5] drm/i915: Try to print INSTDONE bits for all slice/subslice
Quoted 106 lines · Imre Deak
Quoted 96 lines · Ben Widawsky
Quoted 95 lines · Imre Deak
From: Ben Widawsky <[email protected]>
Signed-off-by Ben Widawsky <[email protected]>---
Changes (Imre):
- use the new INSTDONE capturing by default on new GENs (On Ben's request)
- keep printing the render ring INSTDONE to dmesg
- don't hard code theextra_instdonearray sizes
- fix typo in GEN8_MCR_SLICE/GEN8_MCR_SUBSLICE
- fix typo when capturing toextra->row
- warn if the MCR selectors are non-zero--- drivers/gpu/drm/i915/i915_drv.h | 6 ++-- drivers/gpu/drm/i915/i915_gpu_error.c | 62 +++++++++++++++++++++++++++++++---- drivers/gpu/drm/i915/i915_irq.c | 4 +-- drivers/gpu/drm/i915/i915_reg.h | 5 +++ 4 files changed, 66 insertions(+), 11 deletions(-)drivers/gpu/drm/i915/i915_drv.h +4
-2@@ -513,10 +513,12 @@ struct drm_i915_error_state {u32 gam_ecochk;u32 gab_ctl;u32 gfx_mode; +#define INSTDONE_SLICE_NUM 3 +#define INSTDONE_SUBSLICE_NUM 3struct extra_instdone {u32 slice_common; -u32 sampler; -u32 row; +u32 sampler[INSTDONE_SLICE_NUM ][INSTDONE_SUBSLICE_NUM ]; +u32 row[INSTDONE_SLICE_NUM ][INSTDONE_SUBSLICE_NUM ]; } extra_instdone;u64 fence[I915_MAX_NUM_FENCES ];drivers/gpu/drm/i915/i915_gpu_error.c +30
-5@@ -336,7 +336,7 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,struct drm_i915_private *dev_priv = dev->dev_private;struct drm_i915_error_state *error = error_priv->error;struct drm_i915_error_object *obj; -int i, j, offset, elt; +int i, j, slice, subslice, offset, elt;int max_hangcheck_score;if (!error) {@@ -385,9 +385,17 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,err_printf (m," SC_INSTDONE (slice common): 0x%08x\n" , error->extra_instdone.slice_common); -err_printf (m," SAMPLER_INTSDONE: 0x%08x\n" , - error->extra_instdone.sampler); -err_printf (m," ROW_INSTDONE: 0x%08x\n" , error->extra_instdone.row); +for (slice =0 ; slice <INSTDONE_SLICE_NUM ; slice++) { +for (subslice =0 ; subslice <INSTDONE_SUBSLICE_NUM ; + subslice++) { +struct extra_instdone *extra = &error->extra_instdone; + +err_printf (m," SAMPLER_INTSDONE: 0x%08x\n" , + extra->sampler[slice][subslice]); +err_printf (m," ROW_INSTDONE: 0x%08x\n" , + extra->row[slice][subslice]); + } + }if (INTEL_INFO (dev)->gen >=6 ) {err_printf (m,"ERROR: 0x%08x\n" , error->error);@@ -1383,11 +1391,35 @@ const char *i915_cache_level_str(struct drm_i915_private *i915, int type) } } -/* NB: please notice the memset */ +static inline uint32_t instdone_read (struct drm_i915_private *dev_priv,int + slice,int subslice,uint32_t offset) { +/* +* XXX: The MCR register should be locked, but since we are only using +* it for debug/error state, it's not terribly important to +* synchronize it properly. +*/ +uint32_t tmp =I915_READ (GEN8_MCR_SELECTOR ); +uint32_t ret; + +/* +* The HW expects the slice and sublice selectors to be reset to 0 +* after reading out the registers. +*/ +WARN_ON_ONCE (tmp & (GEN8_MCR_SLICE_MASK |GEN8_MCR_SUBSLICE_MASK )); + +I915_WRITE (GEN8_MCR_SELECTOR , tmp |GEN8_MCR_SLICE (slice) | +GEN8_MCR_SUBSLICE (subslice));Quoted 8 lines
drivers/gpu/drm/i915/i915_gpu_error.c const char *i915_cache_level_str(struct drm_i915_private *i915, int type) · line 1416
Quoted 5 lines
drivers/gpu/drm/i915/i915_gpu_error.c +5
-0+ ret =I915_READ (offset); +I915_WRITE (GEN8_MCR_SELECTOR , tmp); + +return ret; +}Hmm. I have second thoughts on this. We should take
struct_mutexto prevent any reads/writes while we're doing this.
Quoted 3 lines
Right. I guess taking
mutex_lockon the error path would be frowned upon. So how about extending uncore.lock fromI915_WRITEto the whole sequence instead?
Don't grab locks from the error handling code. And it looks like we're doing funky stuff here anyway, so I'd just leave this as-is. -Daniel
Quoted 74 lines
Quoted 72 lines
Quoted 71 lines
drivers/gpu/drm/i915/i915_gpu_error.c +20
-2+void i915_get_extra_instdone (struct drm_device *dev,struct extra_instdone *extra) {struct drm_i915_private *dev_priv = dev->dev_private; +int slice, subslice;/* * The render INSTDONE register (GEN2_INSTDONE, RING_INSTDONE) is read @@ -1396,8 +1428,24 @@ void i915_get_extra_instdone(struct drm_device *dev,switch (INTEL_INFO (dev)->gen) {default : extra->slice_common =I915_READ (GEN7_SC_INSTDONE ); - extra->sampler =I915_READ (GEN7_SAMPLER_INSTDONE ); - extra->row =I915_READ (GEN7_ROW_INSTDONE ); +for (slice =0 ; slice <INSTDONE_SLICE_NUM ; slice++) { +for (subslice =0 ; subslice <INSTDONE_SUBSLICE_NUM ; + subslice++) { + extra->sampler[slice][subslice] = +instdone_read (dev_priv, + slice, subslice, +GEN7_SAMPLER_INSTDONE ); + extra->row[slice][subslice] = +instdone_read (dev_priv, + slice, subslice, +GEN7_ROW_INSTDONE ); + } + } +break ; +case 7 : + extra->slice_common =I915_READ (GEN7_SC_INSTDONE ); + extra->sampler[0 ][0 ] =I915_READ (GEN7_SAMPLER_INSTDONE ); + extra->row[0 ][0 ] =I915_READ (GEN7_ROW_INSTDONE );break ;case 6 :case 5 :drivers/gpu/drm/i915/i915_irq.c +2
-2@@ -2478,8 +2478,8 @@ i915_err_print_instdone(uint32_t render, struct extra_instdone *extra) {pr_err (" INSTDONE (render): 0x%08x\n" , render);pr_err (" INSTDONE (common): 0x%08x\n" , extra->slice_common); -pr_err (" INSTDONE (sampler): 0x%08x\n" , extra->sampler); -pr_err (" INSTDONE (row): 0x%08x\n" , extra->row); +pr_err (" INSTDONE (sampler): 0x%08x\n" , extra->sampler[0 ][0 ]); +pr_err (" INSTDONE (row): 0x%08x\n" , extra->row[0 ][0 ]); }static void i915_report_and_clear_eir (struct drm_device *dev)drivers/gpu/drm/i915/i915_reg.h +5
-0@@ -1596,6 +1596,11 @@ enum skl_disp_power_wells {#define GEN7_SC_INSTDONE 0x07100#define GEN7_SAMPLER_INSTDONE 0x0e160#define GEN7_ROW_INSTDONE 0x0e164 +#define GEN8_MCR_SELECTOR 0xfdc +#define GEN8_MCR_SLICE (slice) (((slice) & 3) << 26) +#define GEN8_MCR_SLICE_MASK (GEN8_MCR_SLICE(3)) +#define GEN8_MCR_SUBSLICE (slice) (((slice) & 3) << 24) +#define GEN8_MCR_SUBSLICE_MASK (GEN8_MCR_SUBSLICE(3))#define RING_IPEIR (base) ((base)+0x64)#define RING_IPEHR (base) ((base)+0x68)/* Signature · 1 line
2.1.4
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx