drm/i915: g4x/ilk reset fixes
Subsystems (2)
cover drm/i915: g4x/ilk reset fixes
From: Ville Syrjälä <[email protected]>
I was looking through the docs and spotted all kinds of nonsense in our reset code. The ilk code was totally bonkers. g4x just missed one workaround. The rest of gen4 looks rather wrong too, but I didn't want to touch that yet.
Quickly tested on elk and ilk, and both seem quite happy now.
Ville Syrjälä (6):
drm/i915: Drop bogus comments about display reset drm/i915: Fix ILK reset wait
drm/i915: Fix ILK GPU reset domain bits
drm/i915: Kill RMW from ILK reset code
drm/i915: Clear GDSR after reset on ILK
drm/i915: Implement WaVcpClkGateDisableForMediaReset:ctg,elk
drivers/gpu/drm/i915/i915_reg.h | 12 +++++++- drivers/gpu/drm/i915/intel_uncore.c | 59 +++++++++++++++++++++++++++++-------- 2 files changed, 58 insertions(+), 13 deletions(-)
Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/6 drm/i915: Drop bogus comments about display reset
From: Ville Syrjälä <[email protected]>
There are comments in the gen4-5 reset functions stating that we can't reset render and media without also doing a display reset. But that's exactly what the code does, ie. we don't perform a display reset. Drop the bogus comments.
--- drivers/gpu/drm/i915/intel_uncore.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +0 -2
@@ -978,7 +978,6 @@ static int i965_do_reset(struct drm_device *dev)if (ret)return ret; -/* We can't reset render&media without also resetting display ... */ pci_write_config_byte (dev->pdev,I965_GDRST ,GRDOM_MEDIA |GRDOM_RESET_ENABLE );
@@ -1005,7 +1004,6 @@ static int ironlake_do_reset(struct drm_device *dev)if (ret)return ret; -/* We can't reset render&media without also resetting display ... */ gdrst =I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ); gdrst &= ~GRDOM_MASK ; I915_WRITE(MCHBAR_MIRROR_BASE + ILK_GDSR,
Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 1/6] drm/i915: Drop bogus comments about display reset
Quoted 25 lines · On Mon, 19 May 2014 19:23:22 +0300 [email protected] wrote:
From: Ville Syrjälä <[email protected]>
There are comments in the gen4-5 reset functions stating that we can't reset render and media without also doing a display reset. But that's exactly what the code does, ie. we don't perform a display reset. Drop the bogus comments.
Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/intel_uncore.c | 2 -- 1 file changed, 2 deletions(-)drivers/gpu/drm/i915/intel_uncore.c +0
-1@@ -978,7 +978,6 @@ static int i965_do_reset(struct drm_device *dev)if (ret)return ret; -/* We can't reset render&media without also resetting display ... */ pci_write_config_byte (dev->pdev,I965_GDRST ,GRDOM_MEDIA |GRDOM_RESET_ENABLE );
drivers/gpu/drm/i915/intel_uncore.c static int ironlake_do_reset(struct drm_device *dev) · line 1009
Quoted 7 lines
drivers/gpu/drm/i915/intel_uncore.c +0
-1@@ -1005,7 +1004,6 @@ static int ironlake_do_reset(struct drm_device *dev)if (ret)return ret; -/* We can't reset render&media without also resetting display ... */ gdrst =I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ); gdrst &= ~GRDOM_MASK ; I915_WRITE(MCHBAR_MIRROR_BASE + ILK_GDSR,
Signature · 5 lines
Jesse Barnes, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/6 drm/i915: Fix ILK reset wait
In reply to [email protected]From: Ville Syrjälä <[email protected]>
We should be waiting for the reset bit to clear, not remain set.
--- drivers/gpu/drm/i915/intel_uncore.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +4 -2
@@ -1000,7 +1000,8 @@ static int ironlake_do_reset(struct drm_device *dev) gdrst &= ~GRDOM_MASK ;I915_WRITE (MCHBAR_MIRROR_BASE +ILK_GDSR , gdrst |GRDOM_RENDER |GRDOM_RESET_ENABLE ); - ret =wait_for (I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ) &0x1 ,500 ); + ret =wait_for ((I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ) & +GRDOM_RESET_ENABLE ) ==0 ,500 );if (ret)return ret;
@@ -1008,7 +1009,8 @@ static int ironlake_do_reset(struct drm_device *dev) gdrst &= ~GRDOM_MASK ;I915_WRITE (MCHBAR_MIRROR_BASE +ILK_GDSR , gdrst |GRDOM_MEDIA |GRDOM_RESET_ENABLE ); -return wait_for (I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ) &0x1 ,500 ); +return wait_for ((I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ) & +GRDOM_RESET_ENABLE ) ==0 ,500 ); }static int gen6_do_reset (struct drm_device *dev)
Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/6] drm/i915: Fix ILK reset wait
Quoted 24 lines · On Mon, 19 May 2014 19:23:23 +0300 [email protected] wrote:
From: Ville Syrjälä <[email protected]>
We should be waiting for the reset bit to clear, not remain set.
Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/intel_uncore.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/intel_uncore.c +2
-1@@ -1000,7 +1000,8 @@ static int ironlake_do_reset(struct drm_device *dev) gdrst &= ~GRDOM_MASK ;I915_WRITE (MCHBAR_MIRROR_BASE +ILK_GDSR , gdrst |GRDOM_RENDER |GRDOM_RESET_ENABLE ); - ret =wait_for (I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ) &0x1 ,500 ); + ret =wait_for ((I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ) & +GRDOM_RESET_ENABLE ) ==0 ,500 );if (ret)return ret;
drivers/gpu/drm/i915/intel_uncore.c static int ironlake_do_reset(struct drm_device *dev) · line 1016
Quoted 9 lines
drivers/gpu/drm/i915/intel_uncore.c +2
-1@@ -1008,7 +1009,8 @@ static int ironlake_do_reset(struct drm_device *dev) gdrst &= ~GRDOM_MASK ;I915_WRITE (MCHBAR_MIRROR_BASE +ILK_GDSR , gdrst |GRDOM_MEDIA |GRDOM_RESET_ENABLE ); -return wait_for (I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ) &0x1 ,500 ); +return wait_for ((I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ) & +GRDOM_RESET_ENABLE ) ==0 ,500 ); }static int gen6_do_reset (struct drm_device *dev)
Arg, I lost the docs on this, but it matches what I remember.
Signature · 5 lines
Jesse Barnes, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/6] drm/i915: Fix ILK reset wait
Quoted 35 lines · Jesse Barnes
Quoted 32 lines · On Mon, 19 May 2014 19:23:23 +0300 [email protected] wrote:
From: Ville Syrjälä <[email protected]>
We should be waiting for the reset bit to clear, not remain set.
Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/intel_uncore.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/intel_uncore.c +4
-2@@ -1000,7 +1000,8 @@ static int ironlake_do_reset(struct drm_device *dev) gdrst &= ~GRDOM_MASK ;I915_WRITE (MCHBAR_MIRROR_BASE +ILK_GDSR , gdrst |GRDOM_RENDER |GRDOM_RESET_ENABLE ); - ret =wait_for (I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ) &0x1 ,500 ); + ret =wait_for ((I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ) & +GRDOM_RESET_ENABLE ) ==0 ,500 );if (ret)return ret;@@ -1008,7 +1009,8 @@ static int ironlake_do_reset(struct drm_device *dev) gdrst &= ~GRDOM_MASK ;I915_WRITE (MCHBAR_MIRROR_BASE +ILK_GDSR , gdrst |GRDOM_MEDIA |GRDOM_RESET_ENABLE ); -return wait_for (I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ) &0x1 ,500 ); +return wait_for ((I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ) & +GRDOM_RESET_ENABLE ) ==0 ,500 ); }
Quoted 5 lines
drivers/gpu/drm/i915/intel_uncore.c static int ironlake_do_reset(struct drm_device *dev) · line 1016
Quoted 1 line
drivers/gpu/drm/i915/intel_uncore.c +0
-0static int gen6_do_reset (struct drm_device *dev)Arg, I lost the docs on this, but it matches what I remember.
Reviewed-by Jesse Barnes <[email protected]>
Was this tested on an ilk? I remember writing a similar patch and I didn't apply it due to conflict with reality.
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Re: [PATCH 2/6] drm/i915: Fix ILK reset wait
Quoted 36 lines · Daniel Vetter
Quoted 35 lines · Jesse Barnes
Quoted 32 lines · On Mon, 19 May 2014 19:23:23 +0300 [email protected] wrote:
From: Ville Syrjälä <[email protected]>
We should be waiting for the reset bit to clear, not remain set.
Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/intel_uncore.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/intel_uncore.c +4
-2@@ -1000,7 +1000,8 @@ static int ironlake_do_reset(struct drm_device *dev) gdrst &= ~GRDOM_MASK ;I915_WRITE (MCHBAR_MIRROR_BASE +ILK_GDSR , gdrst |GRDOM_RENDER |GRDOM_RESET_ENABLE ); - ret =wait_for (I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ) &0x1 ,500 ); + ret =wait_for ((I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ) & +GRDOM_RESET_ENABLE ) ==0 ,500 );if (ret)return ret;@@ -1008,7 +1009,8 @@ static int ironlake_do_reset(struct drm_device *dev) gdrst &= ~GRDOM_MASK ;I915_WRITE (MCHBAR_MIRROR_BASE +ILK_GDSR , gdrst |GRDOM_MEDIA |GRDOM_RESET_ENABLE ); -return wait_for (I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ) &0x1 ,500 ); +return wait_for ((I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ) & +GRDOM_RESET_ENABLE ) ==0 ,500 ); }
Quoted 8 lines
Quoted 5 lines
drivers/gpu/drm/i915/intel_uncore.c static int ironlake_do_reset(struct drm_device *dev) · line 1016
Quoted 1 line
drivers/gpu/drm/i915/intel_uncore.c +0
-0static int gen6_do_reset (struct drm_device *dev)Arg, I lost the docs on this, but it matches what I remember.
Reviewed-by Jesse Barnes <[email protected]>Was this tested on an ilk? I remember writing a similar patch and I didn't apply it due to conflict with reality.
Yes. My ILK seems happy now. Maybe your ILK barfed on it due to specifying invalid reset domains (fixed in 3/6)?
Signature · 2 lines
Ville Syrjälä Intel OTC
Re: [PATCH 2/6] drm/i915: Fix ILK reset wait
Quoted 41 lines · Ville Syrjälä
Quoted 40 lines · Daniel Vetter
Quoted 39 lines · Jesse Barnes
Quoted 24 lines · On Mon, 19 May 2014 19:23:23 +0300 [email protected] wrote:
From: Ville Syrjälä <[email protected]>
We should be waiting for the reset bit to clear, not remain set.
Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/intel_uncore.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/intel_uncore.c +2
-1@@ -1000,7 +1000,8 @@ static int ironlake_do_reset(struct drm_device *dev) gdrst &= ~GRDOM_MASK ;I915_WRITE (MCHBAR_MIRROR_BASE +ILK_GDSR , gdrst |GRDOM_RENDER |GRDOM_RESET_ENABLE ); - ret =wait_for (I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ) &0x1 ,500 ); + ret =wait_for ((I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ) & +GRDOM_RESET_ENABLE ) ==0 ,500 );if (ret)return ret;drivers/gpu/drm/i915/intel_uncore.c static int ironlake_do_reset(struct drm_device *dev) · line 1016
Quoted 9 lines
drivers/gpu/drm/i915/intel_uncore.c +2
-1@@ -1008,7 +1009,8 @@ static int ironlake_do_reset(struct drm_device *dev) gdrst &= ~GRDOM_MASK ;I915_WRITE (MCHBAR_MIRROR_BASE +ILK_GDSR , gdrst |GRDOM_MEDIA |GRDOM_RESET_ENABLE ); -return wait_for (I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ) &0x1 ,500 ); +return wait_for ((I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ) & +GRDOM_RESET_ENABLE ) ==0 ,500 ); }static int gen6_do_reset (struct drm_device *dev)Arg, I lost the docs on this, but it matches what I remember.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Reviewed-by Jesse Barnes <[email protected]>Was this tested on an ilk? I remember writing a similar patch and I didn't apply it due to conflict with reality.
Yes. My ILK seems happy now. Maybe your ILK barfed on it due to specifying invalid reset domains (fixed in 3/6)?
That might indeed explain what I've seen. Both patches applied, thanks. -Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 3/6 drm/i915: Fix ILK GPU reset domain bits
In reply to [email protected]From: Ville Syrjälä <[email protected]>
We're using the reset domains bits for g4x on ilk. But on ilk those bits actually shifted by one bit. Fix it up so that we use the correct bits.
We were actually always writing 0x2 to the reset domain bits, which is a reserved value. In practice it looks like the hardware ignores that value since nothing happens if I write that value when there's a 3D workload running. Writing the _correct_ render domain value actually makes the GPU stop.
--- drivers/gpu/drm/i915/i915_reg.h | 8 +++++++- drivers/gpu/drm/i915/intel_uncore.c | 12 ++++++------ 2 files changed, 13 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +7 -1
@@ -79,13 +79,19 @@/* Graphics reset regs */ #define I965_GDRST 0xc0/* PCI config register */ -#define ILK_GDSR 0x2ca4/* MCHBAR offset */ #define GRDOM_FULL (0<<2)#define GRDOM_RENDER (1<<2)#define GRDOM_MEDIA (3<<2)#define GRDOM_MASK (3<<2)#define GRDOM_RESET_ENABLE (1<<0) +#define ILK_GDSR 0x2ca4/* MCHBAR offset */ +#define ILK_GRDOM_FULL (0<<1) +#define ILK_GRDOM_RENDER (1<<1) +#define ILK_GRDOM_MEDIA (3<<1) +#define ILK_GRDOM_MASK (3<<1) +#define ILK_GRDOM_RESET_ENABLE (1<<0) +#define GEN6_MBCUNIT_SNPCR 0x900c/* for LLC config */ #define GEN6_MBC_SNPCR_SHIFT 21#define GEN6_MBC_SNPCR_MASK (3<<21)
drivers/gpu/drm/i915/intel_uncore.c +6 -6
@@ -997,20 +997,20 @@ static int ironlake_do_reset(struct drm_device *dev)int ret; gdrst =I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ); - gdrst &= ~GRDOM_MASK ; + gdrst &= ~ILK_GRDOM_MASK ;I915_WRITE (MCHBAR_MIRROR_BASE +ILK_GDSR , - gdrst |GRDOM_RENDER |GRDOM_RESET_ENABLE ); + gdrst |ILK_GRDOM_RENDER |ILK_GRDOM_RESET_ENABLE ); ret =wait_for ((I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ) & -GRDOM_RESET_ENABLE ) ==0 ,500 ); +ILK_GRDOM_RESET_ENABLE ) ==0 ,500 );if (ret)return ret; gdrst =I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ); - gdrst &= ~GRDOM_MASK ; + gdrst &= ~ILK_GRDOM_MASK ;I915_WRITE (MCHBAR_MIRROR_BASE +ILK_GDSR , - gdrst |GRDOM_MEDIA |GRDOM_RESET_ENABLE ); + gdrst |ILK_GRDOM_MEDIA |ILK_GRDOM_RESET_ENABLE );return wait_for ((I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ) & -GRDOM_RESET_ENABLE ) ==0 ,500 ); +ILK_GRDOM_RESET_ENABLE ) ==0 ,500 ); }static int gen6_do_reset (struct drm_device *dev)
Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 3/6] drm/i915: Fix ILK GPU reset domain bits
Quoted 63 lines · On Mon, 19 May 2014 19:23:24 +0300 [email protected] wrote:
From: Ville Syrjälä <[email protected]>
We're using the reset domains bits for g4x on ilk. But on ilk those bits actually shifted by one bit. Fix it up so that we use the correct bits.
We were actually always writing
0x2to the reset domain bits, which is a reserved value. In practice it looks like the hardware ignores that value since nothing happens if I write that value when there's a 3D workload running. Writing the _correct_ render domain value actually makes the GPU stop.Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 8 +++++++- drivers/gpu/drm/i915/intel_uncore.c | 12 ++++++------ 2 files changed, 13 insertions(+), 7 deletions(-)drivers/gpu/drm/i915/i915_reg.h +7
-1@@ -79,13 +79,19 @@/* Graphics reset regs */ #define I965_GDRST 0xc0/* PCI config register */ -#define ILK_GDSR 0x2ca4/* MCHBAR offset */ #define GRDOM_FULL (0<<2)#define GRDOM_RENDER (1<<2)#define GRDOM_MEDIA (3<<2)#define GRDOM_MASK (3<<2)#define GRDOM_RESET_ENABLE (1<<0) +#define ILK_GDSR 0x2ca4/* MCHBAR offset */ +#define ILK_GRDOM_FULL (0<<1) +#define ILK_GRDOM_RENDER (1<<1) +#define ILK_GRDOM_MEDIA (3<<1) +#define ILK_GRDOM_MASK (3<<1) +#define ILK_GRDOM_RESET_ENABLE (1<<0) +#define GEN6_MBCUNIT_SNPCR 0x900c/* for LLC config */ #define GEN6_MBC_SNPCR_SHIFT 21#define GEN6_MBC_SNPCR_MASK (3<<21)drivers/gpu/drm/i915/intel_uncore.c +3
-4@@ -997,20 +997,20 @@ static int ironlake_do_reset(struct drm_device *dev)int ret; gdrst =I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ); - gdrst &= ~GRDOM_MASK ; + gdrst &= ~ILK_GRDOM_MASK ;I915_WRITE (MCHBAR_MIRROR_BASE +ILK_GDSR , - gdrst |GRDOM_RENDER |GRDOM_RESET_ENABLE ); + gdrst |ILK_GRDOM_RENDER |ILK_GRDOM_RESET_ENABLE ); ret =wait_for ((I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ) & -GRDOM_RESET_ENABLE ) ==0 ,500 ); +ILK_GRDOM_RESET_ENABLE ) ==0 ,500 );if (ret)return ret; gdrst =I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ); - gdrst &= ~GRDOM_MASK ;
drivers/gpu/drm/i915/intel_uncore.c static int ironlake_do_reset(struct drm_device *dev) · line 1016
Quoted 10 lines
drivers/gpu/drm/i915/intel_uncore.c +3
-2+ gdrst &= ~ILK_GRDOM_MASK ;I915_WRITE (MCHBAR_MIRROR_BASE +ILK_GDSR , - gdrst |GRDOM_MEDIA |GRDOM_RESET_ENABLE ); + gdrst |ILK_GRDOM_MEDIA |ILK_GRDOM_RESET_ENABLE );return wait_for ((I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ) & -GRDOM_RESET_ENABLE ) ==0 ,500 ); +ILK_GRDOM_RESET_ENABLE ) ==0 ,500 ); }static int gen6_do_reset (struct drm_device *dev)
Can't find docs, but if you tested that wins anyway.
Signature · 5 lines
Jesse Barnes, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/6 drm/i915: Kill RMW from ILK reset code
In reply to [email protected]From: Ville Syrjälä <[email protected]>
All the other bits in the GDSR register are read-only, so we don't have to preserve them when we perform a GPU reset.
--- drivers/gpu/drm/i915/intel_uncore.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +2 -7
@@ -993,22 +993,17 @@ static int i965_do_reset(struct drm_device *dev)static int ironlake_do_reset (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private; -u32 gdrst;int ret; - gdrst =I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ); - gdrst &= ~ILK_GRDOM_MASK ;I915_WRITE (MCHBAR_MIRROR_BASE +ILK_GDSR , - gdrst |ILK_GRDOM_RENDER |ILK_GRDOM_RESET_ENABLE ); +ILK_GRDOM_RENDER |ILK_GRDOM_RESET_ENABLE ); ret =wait_for ((I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ) &ILK_GRDOM_RESET_ENABLE ) ==0 ,500 );if (ret)return ret; - gdrst =I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ); - gdrst &= ~ILK_GRDOM_MASK ;I915_WRITE (MCHBAR_MIRROR_BASE +ILK_GDSR , - gdrst |ILK_GRDOM_MEDIA |ILK_GRDOM_RESET_ENABLE ); +ILK_GRDOM_MEDIA |ILK_GRDOM_RESET_ENABLE );return wait_for ((I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ) &ILK_GRDOM_RESET_ENABLE ) ==0 ,500 ); }
Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 4/6] drm/i915: Kill RMW from ILK reset code
Quoted 29 lines · On Mon, 19 May 2014 19:23:25 +0300 [email protected] wrote:
From: Ville Syrjälä <[email protected]>
All the other bits in the GDSR register are read-only, so we don't have to preserve them when we perform a GPU reset.
Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/intel_uncore.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)drivers/gpu/drm/i915/intel_uncore.c +1
-4@@ -993,22 +993,17 @@ static int i965_do_reset(struct drm_device *dev)static int ironlake_do_reset (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private; -u32 gdrst;int ret; - gdrst =I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ); - gdrst &= ~ILK_GRDOM_MASK ;I915_WRITE (MCHBAR_MIRROR_BASE +ILK_GDSR , - gdrst |ILK_GRDOM_RENDER |ILK_GRDOM_RESET_ENABLE ); +ILK_GRDOM_RENDER |ILK_GRDOM_RESET_ENABLE ); ret =wait_for ((I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ) &ILK_GRDOM_RESET_ENABLE ) ==0 ,500 );if (ret)
drivers/gpu/drm/i915/intel_uncore.c static int i965_do_reset(struct drm_device *dev) · line 1009
Quoted 10 lines
drivers/gpu/drm/i915/intel_uncore.c +1
-3return ret; - gdrst =I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ); - gdrst &= ~ILK_GRDOM_MASK ;I915_WRITE (MCHBAR_MIRROR_BASE +ILK_GDSR , - gdrst |ILK_GRDOM_MEDIA |ILK_GRDOM_RESET_ENABLE ); +ILK_GRDOM_MEDIA |ILK_GRDOM_RESET_ENABLE );return wait_for ((I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ) &ILK_GRDOM_RESET_ENABLE ) ==0 ,500 ); }
Signature · 5 lines
Jesse Barnes, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/6 drm/i915: Clear GDSR after reset on ILK
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Clear the reset domain after a succesful GPU reset on ilk. We already do that on gen4, so let's try to be a bit more consistent. And if ether render or media reset fails, we might use the leftover value in the register to pinpoint the culprit.
--- drivers/gpu/drm/i915/intel_uncore.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +8 -2
@@ -1004,8 +1004,14 @@ static int ironlake_do_reset(struct drm_device *dev)I915_WRITE (MCHBAR_MIRROR_BASE +ILK_GDSR ,ILK_GRDOM_MEDIA |ILK_GRDOM_RESET_ENABLE ); -return wait_for ((I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ) & -ILK_GRDOM_RESET_ENABLE ) ==0 ,500 ); + ret =wait_for ((I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ) & +ILK_GRDOM_RESET_ENABLE ) ==0 ,500 ); +if (ret) +return ret; + +I915_WRITE (MCHBAR_MIRROR_BASE +ILK_GDSR ,0 ); + +return 0 ; }static int gen6_do_reset (struct drm_device *dev)
Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 5/6] drm/i915: Clear GDSR after reset on ILK
Quoted 23 lines · On Mon, 19 May 2014 19:23:26 +0300 [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Clear the reset domain after a succesful GPU reset on ilk. We already do that on gen4, so let's try to be a bit more consistent. And if ether render or media reset fails, we might use the leftover value in the register to pinpoint the culprit.
Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/intel_uncore.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/intel_uncore.c +1
-2@@ -1004,8 +1004,14 @@ static int ironlake_do_reset(struct drm_device *dev)I915_WRITE (MCHBAR_MIRROR_BASE +ILK_GDSR ,ILK_GRDOM_MEDIA |ILK_GRDOM_RESET_ENABLE ); -return wait_for ((I915_READ (MCHBAR_MIRROR_BASE +ILK_GDSR ) & -ILK_GRDOM_RESET_ENABLE ) ==0 ,500 ); + ret = wait_for((I915_READ(MCHBAR_MIRROR_BASE + ILK_GDSR) &
drivers/gpu/drm/i915/intel_uncore.c static int ironlake_do_reset(struct drm_device *dev) · line 1017
Quoted 10 lines
drivers/gpu/drm/i915/intel_uncore.c +7
-0+ ILK_GRDOM_RESET_ENABLE) == 0, 500); +if (ret) +return ret; + +I915_WRITE (MCHBAR_MIRROR_BASE +ILK_GDSR ,0 ); + +return 0 ; }static int gen6_do_reset (struct drm_device *dev)
Signature · 5 lines
Jesse Barnes, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 6/6 drm/i915: Implement WaVcpClkGateDisableForMediaReset:ctg, elk
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Apparently we need to disable VCP unit clock gating around media reset on g4x.
--- drivers/gpu/drm/i915/i915_reg.h | 4 ++++ drivers/gpu/drm/i915/intel_uncore.c | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_reg.h +4 -0
@@ -1724,6 +1724,10 @@ enum punit_power_well {#define VF_UNIT_CLOCK_GATE_DISABLE (1 << 9)#define GS_UNIT_CLOCK_GATE_DISABLE (1 << 7)#define CL_UNIT_CLOCK_GATE_DISABLE (1 << 6) + +#define VDECCLK_GATE_D 0x620C/* g4x only */ +#define VCP_UNIT_CLOCK_GATE_DISABLE (1 << 4) +#define RAMCLK_GATE_D 0x6210/* CRL only */ #define DEUC 0x6214/* CRL only */
drivers/gpu/drm/i915/intel_uncore.c +35 -1
@@ -990,6 +990,36 @@ static int i965_do_reset(struct drm_device *dev)return 0 ; } +static int g4x_do_reset (struct drm_device *dev) +{ +struct drm_i915_private *dev_priv = dev->dev_private; +int ret; + +pci_write_config_byte (dev->pdev,I965_GDRST , +GRDOM_RENDER |GRDOM_RESET_ENABLE ); + ret =wait_for (i965_reset_complete (dev),500 ); +if (ret) +return ret; + +/* WaVcpClkGateDisableForMediaReset:ctg,elk */ +I915_WRITE (VDECCLK_GATE_D ,I915_READ (VDECCLK_GATE_D ) |VCP_UNIT_CLOCK_GATE_DISABLE ); +POSTING_READ (VDECCLK_GATE_D ); + +pci_write_config_byte (dev->pdev,I965_GDRST , +GRDOM_MEDIA |GRDOM_RESET_ENABLE ); + ret =wait_for (i965_reset_complete (dev),500 ); +if (ret) +return ret; + +/* WaVcpClkGateDisableForMediaReset:ctg,elk */ +I915_WRITE (VDECCLK_GATE_D ,I915_READ (VDECCLK_GATE_D ) & ~VCP_UNIT_CLOCK_GATE_DISABLE ); +POSTING_READ (VDECCLK_GATE_D ); + +pci_write_config_byte (dev->pdev,I965_GDRST ,0 ); + +return 0 ; +} +static int ironlake_do_reset (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;
@@ -1042,7 +1072,11 @@ int intel_gpu_reset(struct drm_device *dev)case 7 :case 6 :return gen6_do_reset (dev);case 5 :return ironlake_do_reset (dev); -case 4 :return i965_do_reset (dev); +case 4 : +if (IS_G4X (dev)) +return g4x_do_reset (dev); +else +return i965_do_reset (dev);default :return -ENODEV ; } }
Signature · 6 lines
1.8.5.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 6/6] drm/i915: Implement WaVcpClkGateDisableForMediaReset:ctg, elk
Quoted 70 lines · On Mon, 19 May 2014 19:23:27 +0300 [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Apparently we need to disable VCP unit clock gating around media reset on g4x.
Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 4 ++++ drivers/gpu/drm/i915/intel_uncore.c | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_reg.h +4
-0@@ -1724,6 +1724,10 @@ enum punit_power_well {#define VF_UNIT_CLOCK_GATE_DISABLE (1 << 9)#define GS_UNIT_CLOCK_GATE_DISABLE (1 << 7)#define CL_UNIT_CLOCK_GATE_DISABLE (1 << 6) + +#define VDECCLK_GATE_D 0x620C/* g4x only */ +#define VCP_UNIT_CLOCK_GATE_DISABLE (1 << 4) +#define RAMCLK_GATE_D 0x6210/* CRL only */ #define DEUC 0x6214/* CRL only */ drivers/gpu/drm/i915/intel_uncore.c +30
-0@@ -990,6 +990,36 @@ static int i965_do_reset(struct drm_device *dev)return 0 ; } +static int g4x_do_reset (struct drm_device *dev) +{ +struct drm_i915_private *dev_priv = dev->dev_private; +int ret; + +pci_write_config_byte (dev->pdev,I965_GDRST , +GRDOM_RENDER |GRDOM_RESET_ENABLE ); + ret =wait_for (i965_reset_complete (dev),500 ); +if (ret) +return ret; + +/* WaVcpClkGateDisableForMediaReset:ctg,elk */ +I915_WRITE (VDECCLK_GATE_D ,I915_READ (VDECCLK_GATE_D ) |VCP_UNIT_CLOCK_GATE_DISABLE ); +POSTING_READ (VDECCLK_GATE_D ); + +pci_write_config_byte (dev->pdev,I965_GDRST , +GRDOM_MEDIA |GRDOM_RESET_ENABLE ); + ret =wait_for (i965_reset_complete (dev),500 ); +if (ret) +return ret; + +/* WaVcpClkGateDisableForMediaReset:ctg,elk */ +I915_WRITE (VDECCLK_GATE_D ,I915_READ (VDECCLK_GATE_D ) & ~VCP_UNIT_CLOCK_GATE_DISABLE ); +POSTING_READ (VDECCLK_GATE_D ); + +pci_write_config_byte (dev->pdev,I965_GDRST ,0 ); + +return 0 ; +} +static int ironlake_do_reset (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;@@ -1042,7 +1072,11 @@ int intel_gpu_reset(struct drm_device *dev)case 7 :case 6 :return gen6_do_reset (dev);
drivers/gpu/drm/i915/intel_uncore.c int intel_gpu_reset(struct drm_device *dev) · line 1082
Quoted 10 lines
drivers/gpu/drm/i915/intel_uncore.c +5
-1case 5 :return ironlake_do_reset (dev); -case 4 :return i965_do_reset (dev); +case 4 : +if (IS_G4X (dev)) +return g4x_do_reset (dev); +else +return i965_do_reset (dev);default :return -ENODEV ; } }
Given how the reset flow stuff works this seems sensible, but I couldn't find it in the docs I have. Shouldn't do any harm at the very worst...
Signature · 5 lines
Jesse Barnes, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 6/6] drm/i915: Implement WaVcpClkGateDisableForMediaReset:ctg, elk
Quoted 88 lines · Jesse Barnes
Quoted 70 lines · On Mon, 19 May 2014 19:23:27 +0300 [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Apparently we need to disable VCP unit clock gating around media reset on g4x.
Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 4 ++++ drivers/gpu/drm/i915/intel_uncore.c | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_reg.h +4
-0@@ -1724,6 +1724,10 @@ enum punit_power_well {#define VF_UNIT_CLOCK_GATE_DISABLE (1 << 9)#define GS_UNIT_CLOCK_GATE_DISABLE (1 << 7)#define CL_UNIT_CLOCK_GATE_DISABLE (1 << 6) + +#define VDECCLK_GATE_D 0x620C/* g4x only */ +#define VCP_UNIT_CLOCK_GATE_DISABLE (1 << 4) +#define RAMCLK_GATE_D 0x6210/* CRL only */ #define DEUC 0x6214/* CRL only */ drivers/gpu/drm/i915/intel_uncore.c +30
-0@@ -990,6 +990,36 @@ static int i965_do_reset(struct drm_device *dev)return 0 ; } +static int g4x_do_reset (struct drm_device *dev) +{ +struct drm_i915_private *dev_priv = dev->dev_private; +int ret; + +pci_write_config_byte (dev->pdev,I965_GDRST , +GRDOM_RENDER |GRDOM_RESET_ENABLE ); + ret =wait_for (i965_reset_complete (dev),500 ); +if (ret) +return ret; + +/* WaVcpClkGateDisableForMediaReset:ctg,elk */ +I915_WRITE (VDECCLK_GATE_D ,I915_READ (VDECCLK_GATE_D ) |VCP_UNIT_CLOCK_GATE_DISABLE ); +POSTING_READ (VDECCLK_GATE_D ); + +pci_write_config_byte (dev->pdev,I965_GDRST , +GRDOM_MEDIA |GRDOM_RESET_ENABLE ); + ret =wait_for (i965_reset_complete (dev),500 ); +if (ret) +return ret; + +/* WaVcpClkGateDisableForMediaReset:ctg,elk */ +I915_WRITE (VDECCLK_GATE_D ,I915_READ (VDECCLK_GATE_D ) & ~VCP_UNIT_CLOCK_GATE_DISABLE ); +POSTING_READ (VDECCLK_GATE_D ); + +pci_write_config_byte (dev->pdev,I965_GDRST ,0 ); + +return 0 ; +} +static int ironlake_do_reset (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;@@ -1042,7 +1072,11 @@ int intel_gpu_reset(struct drm_device *dev)case 7 :case 6 :return gen6_do_reset (dev);drivers/gpu/drm/i915/intel_uncore.c int intel_gpu_reset(struct drm_device *dev) · line 1082
Quoted 10 lines
drivers/gpu/drm/i915/intel_uncore.c +5
-1case 5 :return ironlake_do_reset (dev); -case 4 :return i965_do_reset (dev); +case 4 : +if (IS_G4X (dev)) +return g4x_do_reset (dev); +else +return i965_do_reset (dev);default :return -ENODEV ; } }Given how the reset flow stuff works this seems sensible, but I couldn't find it in the docs I have. Shouldn't do any harm at the very worst...
Quoted 1 line
Acked-by Jesse Barnes <[email protected]>
I want the g4x/i965 split, so also merged this one here ;-) -Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch