Skip to contentSkip to conversation

Rendering specific Hw workarounds for VLV

PATCH Superseded [email protected] 5 participants 20 messages Feb 7, 2014 – Mar 22, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover Rendering specific Hw workarounds for VLV

From: Akash Goel <[email protected]>

The following patches leads to stable behavior on VLV, especially when playing 3D Apps, benchmarks.
Addressed review comments from Ville.

Akash Goel (3):
drm/i915/vlv: Added a rendering specific Hw WA
'WaTlbInvalidateStoreDataBefore'
drm/i915/vlv: Added a rendering specific Hw WA
'WaReadAfterWriteHazard'
drm/i915/vlv: Modified the programming of 2 regs in Ring
initialisation

 drivers/gpu/drm/i915/intel_ringbuffer.c | 68 ++++++++++++++++++++++++++++++---
 1 file changed, 63 insertions(+), 5 deletions(-)
Signature · 1 line
1.8.5.2
#1 lore raw

PATCH v2 1/3 drm/i915/vlv: Added a rendering specific Hw WA 'WaTlbInvalidateStoreDataBefore'

From: Akash Goel <[email protected]>

Added a new rendering specific Workaround 'WaTlbInvalidateStoreDataBefore'. In this WA, before pipecontrol with TLB invalidate set, need to add 2 MI Store data commands.

v2: Modified the WA comment. (Ville)

---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
drivers/gpu/drm/i915/intel_ringbuffer.c +23 -0
index d897a19..2ac6600 100644
@@ -2183,6 +2183,29 @@ intel_ring_invalidate_all_caches(struct intel_ring_buffer *ring)
 	uint32_t flush_domains;
 	int ret;
 
+	if (IS_VALLEYVIEW(ring->dev)) {
+		/*
+		 * WaTlbInvalidateStoreDataBefore
+		 * Before pipecontrol with TLB invalidate set, need 2 store
+		 * data commands (such as MI_STORE_DATA_IMM or MI_STORE_DATA_INDEX)
+		 * Without this, hardware cannot guarantee the command after the
+		 * PIPE_CONTROL with TLB inv will not use the old TLB values.
+		 * FIXME, should also apply to snb, ivb
+		 */
+		int i;
+		ret = intel_ring_begin(ring, 4 * 2);
+		if (ret)
+			return ret;
+		for (i = 0; i < 2; i++) {
+			intel_ring_emit(ring, MI_STORE_DWORD_INDEX);
+			intel_ring_emit(ring, I915_GEM_HWS_SCRATCH_INDEX <<
+						MI_STORE_DWORD_INDEX_SHIFT);
+			intel_ring_emit(ring, 0);
+			intel_ring_emit(ring, MI_NOOP);
+		}
+		intel_ring_advance(ring);
+	}
+
 	flush_domains = 0;
 	if (ring->gpu_caches_dirty)
 		flush_domains = I915_GEM_GPU_DOMAINS;
Signature · 1 line
1.8.5.2
#2 lore raw

Re: [PATCH v2 1/3] drm/i915/vlv: Added a rendering specific Hw WA 'WaTlbInvalidateStoreDataBefore'

Quoted 48 lines · Akash

From: Akash Goel <[email protected]>

Added a new rendering specific Workaround 'WaTlbInvalidateStoreDataBefore'. In this WA, before pipecontrol with TLB invalidate set, need to add 2 MI Store data commands.

v2: Modified the WA comment. (Ville)

---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
drivers/gpu/drm/i915/intel_ringbuffer.c +23 -1
index d897a19..2ac6600 100644
@@ -2183,6 +2183,29 @@ intel_ring_invalidate_all_caches(struct intel_ring_buffer *ring)
        uint32_t flush_domains;
        int ret;
 
+       if (IS_VALLEYVIEW(ring->dev)) {
+               /*
+                * WaTlbInvalidateStoreDataBefore
+                * Before pipecontrol with TLB invalidate set, need 2 store
+                * data commands (such as MI_STORE_DATA_IMM or MI_STORE_DATA_INDEX)
+                * Without this, hardware cannot guarantee the command after the
+                * PIPE_CONTROL with TLB inv will not use the old TLB values.
+                * FIXME, should also apply to snb, ivb
+                */
+               int i;
+               ret = intel_ring_begin(ring, 4 * 2);
+               if (ret)
+                       return ret;
+               for (i = 0; i < 2; i++) {
+                       intel_ring_emit(ring, MI_STORE_DWORD_INDEX);
+                       intel_ring_emit(ring, I915_GEM_HWS_SCRATCH_INDEX <<
+                                               MI_STORE_DWORD_INDEX_SHIFT);
+                       intel_ring_emit(ring, 0);
+                       intel_ring_emit(ring, MI_NOOP);
+               }
+               intel_ring_advance(ring);
+       }
+
        flush_domains = 0;
        if (ring->gpu_caches_dirty)
                flush_domains = I915_GEM_GPU_DOMAINS;
--
Quoted 2 lines

1.8.5.2

Hi Ville,

Can you please let us know the status of this patch, as there are no further comments to address here.

Regards,
Sourab

#3 lore raw

Re: [PATCH v2 1/3] drm/i915/vlv: Added a rendering specific Hw WA 'WaTlbInvalidateStoreDataBefore'

In reply to [email protected]
Quoted 20 lines · On Fri, Feb 07, 2014 at 05:52:10PM +0530, [email protected] wrote:

From: Akash Goel <[email protected]>

Added a new rendering specific Workaround 'WaTlbInvalidateStoreDataBefore'. In this WA, before pipecontrol with TLB invalidate set, need to add 2 MI Store data commands.

v2: Modified the WA comment. (Ville)

---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
drivers/gpu/drm/i915/intel_ringbuffer.c +0 -0
index d897a19..2ac6600 100644
@@ -2183,6 +2183,29 @@ intel_ring_invalidate_all_caches(struct intel_ring_buffer *ring)
 	uint32_t flush_domains;
 	int ret;

drivers/gpu/drm/i915/intel_ringbuffer.c intel_ring_invalidate_all_caches(struct intel_ring_buffer *ring) · line 2194

Quoted 10 lines
drivers/gpu/drm/i915/intel_ringbuffer.c +9 -0
 
+	if (IS_VALLEYVIEW(ring->dev)) {
+		/*
+		 * WaTlbInvalidateStoreDataBefore
+		 * Before pipecontrol with TLB invalidate set, need 2 store
+		 * data commands (such as MI_STORE_DATA_IMM or MI_STORE_DATA_INDEX)
+		 * Without this, hardware cannot guarantee the command after the
+		 * PIPE_CONTROL with TLB inv will not use the old TLB values.
+		 * FIXME, should also apply to snb, ivb
+		 */

We have a small syntax to indicate for which platform a W/A has been implemented so a script in intel-gpu-tool can pick them up and make a list. It's a bit low-fi, but has proven to be handy to quickly check what we implement for a specific platform.

So this should be WaTlbInvalidateStoreDataBefore:vlv

This script works like this:

$ /path/to/intel-gpu-tools/scripts/list-workarounds -p vlv /path/to/kernel
WaCatErrorRejectionIssue
WaDisableAsyncFlipPerfMode
WaDisableBackToBackFlipFix
WaDisableDopClockGating
WaDisableEarlyCull
WaDisableL3Bank2xClockGate
WaDisablePSDDualDispatchEnable
...
Signature · 1 line
Damien
#4 lore raw

PATCH v2 2/3 drm/i915/vlv: Added a rendering specific Hw WA 'WaReadAfterWriteHazard'

In reply to [email protected]

From: Akash Goel <[email protected]>

Added a new rendering specific Workaround 'WaReadAfterWriteHazard'. In this WA, need to add 12 MI Store Dword commands to ensure proper flush of h/w pipeline.

v2: Modified the WA comment (Ville)

---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
drivers/gpu/drm/i915/intel_ringbuffer.c +26 -0
index 2ac6600..49370a1 100644
@@ -2173,6 +2173,32 @@ intel_ring_flush_all_caches(struct intel_ring_buffer *ring)
 
 	trace_i915_gem_ring_flush(ring, 0, I915_GEM_GPU_DOMAINS);
 
+	if (IS_VALLEYVIEW(ring->dev)) {
+		/*
+		 * WaReadAfterWriteHazard
+		 * Send a number of Store Data commands here to finish
+		 * flushing hardware pipeline.This is needed in the case
+		 * where the next workload tries reading from the same
+		 * surface that this batch writes to. Without these StoreDWs,
+		 * not all of the data will actually be flushd to the surface
+		 * by the time the next batch starts reading it, possibly
+		 * causing a small amount of corruption.
+		 * FIXME, should also apply to snb, ivb.
+		 */
+		int i;
+		ret = intel_ring_begin(ring, 4 * 12);
+		if (ret)
+			return ret;
+		for (i = 0; i < 12; i++) {
+			intel_ring_emit(ring, MI_STORE_DWORD_INDEX);
+			intel_ring_emit(ring, I915_GEM_HWS_SCRATCH_INDEX <<
+							MI_STORE_DWORD_INDEX_SHIFT);
+			intel_ring_emit(ring, 0);
+			intel_ring_emit(ring, MI_NOOP);
+		}
+		intel_ring_advance(ring);
+	}
+
 	ring->gpu_caches_dirty = false;
 	return 0;
 }
Signature · 1 line
1.8.5.2
#5 lore raw

PATCH v2 3/3 drm/i915/vlv: Modified the programming of 2 regs in Ring initialisation

In reply to [email protected]

From: Akash Goel <[email protected]>

Modified programming of following 2 regs in Render ring initialisation fn.
1. GFX_MODE_GEN7 (Enabling TLB invalidate)
2. MI_MODE (Enabling MI Flush)

v2: Removed the enabling of MI_FLUSH (Ville)
Added new comments (Ville).

---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +14 -5
index 49370a1..0d7d927b 100644
@@ -563,7 +563,10 @@ static int init_render_ring(struct intel_ring_buffer *ring)
 	int ret = init_ring_common(ring);
 
 	if (INTEL_INFO(dev)->gen > 3)
-		I915_WRITE(MI_MODE, _MASKED_BIT_ENABLE(VS_TIMER_DISPATCH));
+		/* FIXME, should also apply to ivb */
+		if (!IS_VALLEYVIEW(dev))
+			I915_WRITE(MI_MODE,
+				_MASKED_BIT_ENABLE(VS_TIMER_DISPATCH));
 
 	/* We need to disable the AsyncFlip performance optimisations in order
 	 * to use MI_WAIT_FOR_EVENT within the CS. It should already be
@@ -579,10 +582,16 @@ static int init_render_ring(struct intel_ring_buffer *ring)
 		I915_WRITE(GFX_MODE,
 			   _MASKED_BIT_ENABLE(GFX_TLB_INVALIDATE_ALWAYS));
 
-	if (IS_GEN7(dev))
-		I915_WRITE(GFX_MODE_GEN7,
-			   _MASKED_BIT_DISABLE(GFX_TLB_INVALIDATE_ALWAYS) |
-			   _MASKED_BIT_ENABLE(GFX_REPLAY_MODE));
+	if (IS_GEN7(dev)) {
+		if (IS_VALLEYVIEW(dev)) {
+			/* FIXME, should also apply to ivb */
+			I915_WRITE(GFX_MODE_GEN7,
+				_MASKED_BIT_ENABLE(GFX_REPLAY_MODE));
+		} else
+			I915_WRITE(GFX_MODE_GEN7,
+				_MASKED_BIT_DISABLE(GFX_TLB_INVALIDATE_ALWAYS) |
+				_MASKED_BIT_ENABLE(GFX_REPLAY_MODE));
+	}
 
 	if (INTEL_INFO(dev)->gen >= 5) {
 		ret = init_pipe_control(ring);
Signature · 1 line
1.8.5.2
#6 lore raw

Re: [PATCH v2 3/3] drm/i915/vlv: Modified the programming of 2 regs in Ring initialisation

Quoted 4 lines · On Fri, Feb 07, 2014 at 05:52:12PM +0530, [email protected] wrote:

From: Akash Goel <[email protected]>

Modified programming of following 2 regs in Render ring initialisation fn.
1. GFX_MODE_GEN7 (Enabling TLB invalidate)

The changelog needs to explain why. According to the spec this is a pessimisation.

Quoted 1 line

2. MI_MODE (Enabling MI Flush)

And this is out-of-date. Doesn't describe the actual change nor why. -Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#7 lore raw

Re: [PATCH v2 3/3] drm/i915/vlv: Modified the programming of 2 regs in Ring initialisation

Quoted 3 lines

1. GFX_MODE_GEN7 (Enabling TLB invalidate)

Quoted 1 line

The changelog needs to explain why. According to the spec this is a pessimisation.

Ok, Will look into this.

Quoted 2 lines

2. MI_MODE (Enabling MI Flush)

Quoted 1 line

And this is out-of-date. Doesn't describe the actual change nor why.

Sorry I did not update the commit message properly.
Actually I have reverted the change, enabling of MI_FLUSH, in this new version of the patch, as you also said this is obsolete.

Best Regards
Akash

-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: Friday, February 07, 2014 6:01 PM
To: Goel, Akash
Cc: [email protected]
Subject: Re: [Intel-gfx] [PATCH v2 3/3] drm/i915/vlv: Modified the programming of 2 regs in Ring initialisation

Quoted 4 lines · On Fri, Feb 07, 2014 at 05:52:12PM +0530, [email protected] wrote:

From: Akash Goel <[email protected]>

Modified programming of following 2 regs in Render ring initialisation fn.
1. GFX_MODE_GEN7 (Enabling TLB invalidate)

The changelog needs to explain why. According to the spec this is a pessimisation.

-Chris

--
Chris Wilson, Intel Open Source Technology Centre

#8 lore raw

PATCH 1/2 drm/i915/vlv: Remove the enabling of VS_TIMER_DISPATCH bit in MI MODE reg

In reply to Chris Wilson

From: Akash Goel <[email protected]>

Removing the VS_TIMER_DISPATCH bit enable for MI MODE reg for VLV platform as it is not required.

---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +4 -1
index 1c734ab..7da5774 100644
@@ -567,7 +567,10 @@ static int init_render_ring(struct intel_ring_buffer *ring)
 	int ret = init_ring_common(ring);
 
 	if (INTEL_INFO(dev)->gen > 3)
-		I915_WRITE(MI_MODE, _MASKED_BIT_ENABLE(VS_TIMER_DISPATCH));
+		/* FIXME, should also apply to ivb */
+		if (!IS_VALLEYVIEW(dev))
+			I915_WRITE(MI_MODE,
+					_MASKED_BIT_ENABLE(VS_TIMER_DISPATCH));
 
 	/* We need to disable the AsyncFlip performance optimisations in order
 	 * to use MI_WAIT_FOR_EVENT within the CS. It should already be
Signature · 1 line
1.8.5.1
#9 lore raw

PATCH 2/2 drm/i915/vlv: Enabling the TLB invalidate bit in GFX Mode register

From: Akash Goel <[email protected]>

This patch Enables the bit for TLB invalidate in GFX Mode register.

According to bspec, When enabled this bit limits the invalidation of the TLB only to batch buffer boundaries, to pipe_control commands which have the TLB invalidation bit set and sync flushes. If disabled, the TLB caches are flushed for every full flush of the pipeline.

---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +10 -4
index 7da5774..320637b 100644
@@ -586,10 +586,16 @@ static int init_render_ring(struct intel_ring_buffer *ring)
 		I915_WRITE(GFX_MODE,
 			   _MASKED_BIT_ENABLE(GFX_TLB_INVALIDATE_ALWAYS));
 
-	if (IS_GEN7(dev))
-		I915_WRITE(GFX_MODE_GEN7,
-			   _MASKED_BIT_DISABLE(GFX_TLB_INVALIDATE_ALWAYS) |
-			   _MASKED_BIT_ENABLE(GFX_REPLAY_MODE));
+	if (IS_GEN7(dev)) {
+		if (IS_VALLEYVIEW(dev)) {
+			/* FIXME, should also apply to ivb */
+			I915_WRITE(GFX_MODE_GEN7,
+					_MASKED_BIT_ENABLE(GFX_REPLAY_MODE));
+		} else
+			I915_WRITE(GFX_MODE_GEN7,
+					_MASKED_BIT_DISABLE(GFX_TLB_INVALIDATE_ALWAYS) |
+					_MASKED_BIT_ENABLE(GFX_REPLAY_MODE));
+	}
 
 	if (INTEL_INFO(dev)->gen >= 5) {
 		ret = init_pipe_control(ring);
Signature · 1 line
1.8.5.1
#10 lore raw

Re: [PATCH 2/2] drm/i915/vlv: Enabling the TLB invalidate bit in GFX Mode register

Quoted 9 lines · On Fri, Mar 21, 2014 at 06:05:04PM +0530, [email protected] wrote:

From: Akash Goel <[email protected]>

This patch Enables the bit for TLB invalidate in GFX Mode register.

According to bspec, When enabled this bit limits the invalidation of the TLB only to batch buffer boundaries, to pipe_control commands which have the TLB invalidation bit set and sync flushes. If disabled, the TLB caches are flushed for every full flush of the pipeline.

So why do we want to not disable it?
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#11 lore raw

Re: [PATCH 2/2] drm/i915/vlv: Enabling the TLB invalidate bit in GFX Mode register

Quoted 5 lines · Chris Wilson
Quoted 4 lines · On Fri, Mar 21, 2014 at 06:05:04PM +0530, [email protected] wrote:

From: Akash Goel <[email protected]>

This patch Enables the bit for TLB invalidate in GFX Mode register.

Quoted 9 lines
Quoted 5 lines

According to bspec, When enabled this bit limits the invalidation of the TLB only to batch buffer boundaries, to pipe_control commands which have the TLB invalidation bit set and sync flushes. If disabled, the TLB caches are flushed for every full flush of the pipeline.

So why do we want to not disable it?
-Chris

Hi Chris,
As per the description, enabling this bit will make the TLB invalidation more optimal. Otherwise, TLB invalidation will happen for every full pipeline flush. Thats why we are enabling this bit.

Regards,
Sourab

#12 lore raw

Re: [PATCH 2/2] drm/i915/vlv: Enabling the TLB invalidate bit in GFX Mode register

Quoted 12 lines · Sourab
Quoted 11 lines · Chris Wilson
Quoted 9 lines · On Fri, Mar 21, 2014 at 06:05:04PM +0530, [email protected] wrote:

From: Akash Goel <[email protected]>

This patch Enables the bit for TLB invalidate in GFX Mode register.

According to bspec, When enabled this bit limits the invalidation of the TLB only to batch buffer boundaries, to pipe_control commands which have the TLB invalidation bit set and sync flushes. If disabled, the TLB caches are flushed for every full flush of the pipeline.

Quoted 7 lines
Quoted 3 lines

So why do we want to not disable it?
-Chris

Hi Chris,
As per the description, enabling this bit will make the TLB invalidation more optimal. Otherwise, TLB invalidation will happen for every full pipeline flush. Thats why we are enabling this bit.

You are not enabling the bit either, you simply do not disable it. -Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#13 lore raw

Re: [PATCH 2/2] drm/i915/vlv: Enabling the TLB invalidate bit in GFX Mode register

Quoted 16 lines · Chris Wilson
Quoted 15 lines · Sourab
Quoted 14 lines · Chris Wilson
Quoted 9 lines · On Fri, Mar 21, 2014 at 06:05:04PM +0530, [email protected] wrote:

From: Akash Goel <[email protected]>

This patch Enables the bit for TLB invalidate in GFX Mode register.

According to bspec, When enabled this bit limits the invalidation of the TLB only to batch buffer boundaries, to pipe_control commands which have the TLB invalidation bit set and sync flushes. If disabled, the TLB caches are flushed for every full flush of the pipeline.

So why do we want to not disable it?
-Chris

Quoted 8 lines
Quoted 4 lines

Hi Chris,
As per the description, enabling this bit will make the TLB invalidation more optimal. Otherwise, TLB invalidation will happen for every full pipeline flush. Thats why we are enabling this bit.

You are not enabling the bit either, you simply do not disable it. -Chris

Hi Chris,
According to spec, the default value of this bit will be 1 after reset. So, we are letting the default value remain as 1 and not disabling it. Probably the commit message should have better reflected this as 'not resetting the bit for TLB invalidate from its default value of 1'.

If required, we can explicitly set the value to 1 (without assuming any defaults).

Regards,
Sourab

#14 lore raw

Re: [PATCH 2/2] drm/i915/vlv: Enabling the TLB invalidate bit in GFX Mode register

Quoted 25 lines · Sourab
Quoted 16 lines · Chris Wilson
Quoted 15 lines · Sourab
Quoted 14 lines · Chris Wilson
Quoted 9 lines · On Fri, Mar 21, 2014 at 06:05:04PM +0530, [email protected] wrote:

From: Akash Goel <[email protected]>

This patch Enables the bit for TLB invalidate in GFX Mode register.

According to bspec, When enabled this bit limits the invalidation of the TLB only to batch buffer boundaries, to pipe_control commands which have the TLB invalidation bit set and sync flushes. If disabled, the TLB caches are flushed for every full flush of the pipeline.

So why do we want to not disable it?
-Chris

Quoted 8 lines
Quoted 4 lines

Hi Chris,
As per the description, enabling this bit will make the TLB invalidation more optimal. Otherwise, TLB invalidation will happen for every full pipeline flush. Thats why we are enabling this bit.

You are not enabling the bit either, you simply do not disable it. -Chris

Quoted 8 lines

Hi Chris,
According to spec, the default value of this bit will be 1 after reset. So, we are letting the default value remain as 1 and not disabling it. Probably the commit message should have better reflected this as 'not resetting the bit for TLB invalidate from its default value of 1'.

If required, we can explicitly set the value to 1 (without assuming any defaults).

I would indeed explicitly set it according to how we've implemented TLB flushes. And you can then reference the commit that adds the pre-requisite pipe-control invalidation as if we trust our history then at some point in the past relying on an invalidate on MI_BATCH_BUFFER_START was insufficient.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#15 lore raw

PATCH v2 1/1 drm/i915/vlv: Enabling the TLB invalidate bit in GFX Mode register

From: Akash Goel <[email protected]>

This patch Enables the bit for TLB invalidate in GFX Mode register.

According to bspec, When enabled this bit limits the invalidation of the TLB only to batch buffer boundaries, to pipe_control commands which have the TLB invalidation bit set and sync flushes. If disabled, the TLB caches are flushed for every full flush of the pipeline.

v2: Explicitly enabling TLB invalidate bit instead of assuming default 1 (Chris Wilson)

---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +11 -4
index 4eb3e06..dca8c6d 100644
@@ -583,10 +583,17 @@ static int init_render_ring(struct intel_ring_buffer *ring)
 		I915_WRITE(GFX_MODE,
 			   _MASKED_BIT_ENABLE(GFX_TLB_INVALIDATE_ALWAYS));
 
-	if (IS_GEN7(dev))
-		I915_WRITE(GFX_MODE_GEN7,
-			   _MASKED_BIT_DISABLE(GFX_TLB_INVALIDATE_ALWAYS) |
-			   _MASKED_BIT_ENABLE(GFX_REPLAY_MODE));
+	if (IS_GEN7(dev)) {
+		if (IS_VALLEYVIEW(dev)) {
+			/* FIXME, should also apply to ivb */
+			I915_WRITE(GFX_MODE_GEN7,
+					_MASKED_BIT_ENABLE(GFX_TLB_INVALIDATE_ALWAYS) |
+					_MASKED_BIT_ENABLE(GFX_REPLAY_MODE));
+		} else
+			I915_WRITE(GFX_MODE_GEN7,
+					_MASKED_BIT_DISABLE(GFX_TLB_INVALIDATE_ALWAYS) |
+					_MASKED_BIT_ENABLE(GFX_REPLAY_MODE));
+	}
 
 	if (INTEL_INFO(dev)->gen >= 5) {
 		ret = init_pipe_control(ring);
Signature · 1 line
1.8.5.1
#16 lore raw

Re: [PATCH v2] drm/i915/vlv: Enabling the TLB invalidate bit in GFX Mode register

Quoted 4 lines · On Fri, Mar 21, 2014 at 08:58:08PM +0530, [email protected] wrote:

From: Akash Goel <[email protected]>

This patch Enables the bit for TLB invalidate in GFX Mode register.

Quoted 8 lines

According to bspec, When enabled this bit limits the invalidation of the TLB only to batch buffer boundaries, to pipe_control commands which have the TLB invalidation bit set and sync flushes. If disabled, the TLB caches are flushed for every full flush of the pipeline.

v2: Explicitly enabling TLB invalidate bit instead of assuming default 1 (Chris Wilson)

Right, but there is nothing special about this code for vlv, all of gen7 share the same TLB invalidation code, and there is no documented reason not to do the switch. So do a cursory test on ivb/hsw and send a patch that doesn't say FIXME.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#17 lore raw

Re: [PATCH v2] drm/i915/vlv: Enabling the TLB invalidate bit in GFX Mode register

Quoted 11 lines · Chris Wilson
Quoted 10 lines · On Fri, Mar 21, 2014 at 08:58:08PM +0530, [email protected] wrote:

From: Akash Goel <[email protected]>

This patch Enables the bit for TLB invalidate in GFX Mode register.

According to bspec, When enabled this bit limits the invalidation of the TLB only to batch buffer boundaries, to pipe_control commands which have the TLB invalidation bit set and sync flushes. If disabled, the TLB caches are flushed for every full flush of the pipeline.

Quoted 9 lines
Quoted 2 lines

v2: Explicitly enabling TLB invalidate bit instead of assuming default 1 (Chris Wilson)

Right, but there is nothing special about this code for vlv, all of gen7 share the same TLB invalidation code, and there is no documented reason not to do the switch. So do a cursory test on ivb/hsw and send a patch that doesn't say FIXME.
-Chris

Hi Chris,
I agree, this could be applicable to ivb also. But we are constrained by the availability of ivb/hsw machines and we're not able to test it on those. We didn't want to cause any regression on those platforms. Thats why we were limiting our patch to vlv only with a FIXME comment. We've done this for other WAs also.

If required we can put this patch for full GEN7 (not tested on ivb/hsw) and keep our fingers crossed! :)

Regards,
Sourab

Tested-by
#18 lore raw

Re: [PATCH v2] drm/i915/vlv: Enabling the TLB invalidate bit in GFX Mode register

Quoted 28 lines · Sourab
Quoted 11 lines · Chris Wilson
Quoted 10 lines · On Fri, Mar 21, 2014 at 08:58:08PM +0530, [email protected] wrote:

From: Akash Goel <[email protected]>

This patch Enables the bit for TLB invalidate in GFX Mode register.

According to bspec, When enabled this bit limits the invalidation of the TLB only to batch buffer boundaries, to pipe_control commands which have the TLB invalidation bit set and sync flushes. If disabled, the TLB caches are flushed for every full flush of the pipeline.

Quoted 9 lines
Quoted 2 lines

v2: Explicitly enabling TLB invalidate bit instead of assuming default 1 (Chris Wilson)

Right, but there is nothing special about this code for vlv, all of gen7 share the same TLB invalidation code, and there is no documented reason not to do the switch. So do a cursory test on ivb/hsw and send a patch that doesn't say FIXME.
-Chris

Hi Chris,
I agree, this could be applicable to ivb also. But we are constrained by the availability of ivb/hsw machines and we're not able to test it on those. We didn't want to cause any regression on those platforms. Thats why we were limiting our patch to vlv only with a FIXME comment. We've done this for other WAs also.

Quoted 2 lines

If required we can put this patch for full GEN7 (not tested on ivb/hsw) and keep our fingers crossed! :)

How about for the generalised patch,

Happy now? :)
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#19 lore raw

Re: [PATCH v2 3/3] drm/i915/vlv: Modified the programming of 2 regs in Ring initialisation

In reply to [email protected]
Quoted 19 lines · On Fri, Feb 07, 2014 at 05:52:12PM +0530, [email protected] wrote:

From: Akash Goel <[email protected]>

Modified programming of following 2 regs in Render ring initialisation fn.
1. GFX_MODE_GEN7 (Enabling TLB invalidate)
2. MI_MODE (Enabling MI Flush)

v2: Removed the enabling of MI_FLUSH (Ville)
Added new comments (Ville).

---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +0 -0
index 49370a1..0d7d927b 100644

drivers/gpu/drm/i915/intel_ringbuffer.c static int init_render_ring(struct intel_ring_buffer *ring) · line 569

Quoted 8 lines
drivers/gpu/drm/i915/intel_ringbuffer.c +4 -1
@@ -563,7 +563,10 @@ static int init_render_ring(struct intel_ring_buffer *ring)
 	int ret = init_ring_common(ring);
 
 	if (INTEL_INFO(dev)->gen > 3)
-		I915_WRITE(MI_MODE, _MASKED_BIT_ENABLE(VS_TIMER_DISPATCH));
+		/* FIXME, should also apply to ivb */
+		if (!IS_VALLEYVIEW(dev))
+			I915_WRITE(MI_MODE,
+				_MASKED_BIT_ENABLE(VS_TIMER_DISPATCH));

Was this supposed to be here? I guess it should be a separate patch.

Quoted 31 lines
drivers/gpu/drm/i915/intel_ringbuffer.c +10 -4
 	/* We need to disable the AsyncFlip performance optimisations in order
 	 * to use MI_WAIT_FOR_EVENT within the CS. It should already be
@@ -579,10 +582,16 @@ static int init_render_ring(struct intel_ring_buffer *ring)
 		I915_WRITE(GFX_MODE,
 			   _MASKED_BIT_ENABLE(GFX_TLB_INVALIDATE_ALWAYS));
 
-	if (IS_GEN7(dev))
-		I915_WRITE(GFX_MODE_GEN7,
-			   _MASKED_BIT_DISABLE(GFX_TLB_INVALIDATE_ALWAYS) |
-			   _MASKED_BIT_ENABLE(GFX_REPLAY_MODE));
+	if (IS_GEN7(dev)) {
+		if (IS_VALLEYVIEW(dev)) {
+			/* FIXME, should also apply to ivb */
+			I915_WRITE(GFX_MODE_GEN7,
+				_MASKED_BIT_ENABLE(GFX_REPLAY_MODE));
+		} else
+			I915_WRITE(GFX_MODE_GEN7,
+				_MASKED_BIT_DISABLE(GFX_TLB_INVALIDATE_ALWAYS) |
+				_MASKED_BIT_ENABLE(GFX_REPLAY_MODE));
+	}
 
 	if (INTEL_INFO(dev)->gen >= 5) {
 		ret = init_pipe_control(ring);
Signature · 6 lines
1.8.5.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä
Intel OTC