AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Monk Liu <Monk.Liu-5C7GfCeVMHo@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Monk Liu <Monk.Liu-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH 2/4] drm/amdgpu:new method to sync ce&de
Date: Mon, 29 Aug 2016 16:55:37 +0800	[thread overview]
Message-ID: <1472460939-31571-3-git-send-email-Monk.Liu@amd.com> (raw)
In-Reply-To: <1472460939-31571-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>

sync switch buffer scheme with windows kmd for gfx v8,
step2:
Insert 128NOP after&before VM flush to prevent CE vm fault.

Change-Id: Ibec954ce4c817ad7d3bce89c2bcb95b6c6bb5411
Signed-off-by: Monk Liu <Monk.Liu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 24 ++++++------------------
 1 file changed, 6 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index c14ba70..fbc57a7 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -5915,12 +5915,6 @@ static void gfx_v8_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,
 {
 	u32 header, control = 0;
 
-	/* insert SWITCH_BUFFER packet before first IB in the ring frame */
-	if (ctx_switch) {
-		amdgpu_ring_write(ring, PACKET3(PACKET3_SWITCH_BUFFER, 0));
-		amdgpu_ring_write(ring, 0);
-	}
-
 	if (ib->flags & AMDGPU_IB_FLAG_CE)
 		header = PACKET3(PACKET3_INDIRECT_BUFFER_CONST, 2);
 	else
@@ -5990,14 +5984,6 @@ static void gfx_v8_0_ring_emit_pipeline_sync(struct amdgpu_ring *ring)
 	amdgpu_ring_write(ring, seq);
 	amdgpu_ring_write(ring, 0xffffffff);
 	amdgpu_ring_write(ring, 4); /* poll interval */
-
-	if (usepfp) {
-		/* synce CE with ME to prevent CE fetch CEIB before context switch done */
-		amdgpu_ring_write(ring, PACKET3(PACKET3_SWITCH_BUFFER, 0));
-		amdgpu_ring_write(ring, 0);
-		amdgpu_ring_write(ring, PACKET3(PACKET3_SWITCH_BUFFER, 0));
-		amdgpu_ring_write(ring, 0);
-	}
 }
 
 static void gfx_v8_0_ring_emit_vm_flush(struct amdgpu_ring *ring,
@@ -6005,6 +5991,9 @@ static void gfx_v8_0_ring_emit_vm_flush(struct amdgpu_ring *ring,
 {
 	int usepfp = (ring->type == AMDGPU_RING_TYPE_GFX);
 
+	/* GFX8 emits 128 dw nop to prevent DE do vm_flush before CE finish CEIB */
+	amdgpu_ring_insert_nop(ring, 128);
+
 	amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3));
 	amdgpu_ring_write(ring, (WRITE_DATA_ENGINE_SEL(usepfp) |
 				 WRITE_DATA_DST_SEL(0)) |
@@ -6044,11 +6033,10 @@ static void gfx_v8_0_ring_emit_vm_flush(struct amdgpu_ring *ring,
 		/* sync PFP to ME, otherwise we might get invalid PFP reads */
 		amdgpu_ring_write(ring, PACKET3(PACKET3_PFP_SYNC_ME, 0));
 		amdgpu_ring_write(ring, 0x0);
-		amdgpu_ring_write(ring, PACKET3(PACKET3_SWITCH_BUFFER, 0));
-		amdgpu_ring_write(ring, 0);
-		amdgpu_ring_write(ring, PACKET3(PACKET3_SWITCH_BUFFER, 0));
-		amdgpu_ring_write(ring, 0);
 	}
+
+	/* GFX8 emits 128 dw nop to prevent CE access VM before vm_flush finish */
+	amdgpu_ring_insert_nop(ring, 128);
 }
 
 static u32 gfx_v8_0_ring_get_rptr_compute(struct amdgpu_ring *ring)
-- 
1.9.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2016-08-29  8:55 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-29  8:55 [PATCH 0/4] fix GFX8 dmaframe scheme (v2) Monk Liu
     [not found] ` <1472460939-31571-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2016-08-29  8:55   ` [PATCH 1/4] drm/amdgpu:add switch buffer to end of CS (v2) Monk Liu
2016-08-29  8:55   ` Monk Liu [this message]
2016-08-29  8:55   ` [PATCH 3/4] drm/amdgpu:change job->ctx field name Monk Liu
2016-08-29  8:55   ` [PATCH 4/4] drm/amdgpu:implement CONTEXT_CONTROL Monk Liu
2016-08-29  9:15   ` [PATCH 0/4] fix GFX8 dmaframe scheme (v2) Christian König
  -- strict thread matches above, loose matches on Subject: below --
2016-08-29  3:13 [PATCH 0/4] fix GFX8 dma frame scheme Monk Liu
     [not found] ` <1472440438-9429-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2016-08-29  3:13   ` [PATCH 2/4] drm/amdgpu:new method to sync ce&de Monk Liu
2016-08-29  2:55 [PATCH 1/4] drm/amdgpu:add switch buffer to end of CS Monk Liu
     [not found] ` <1472439337-8002-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2016-08-29  2:55   ` [PATCH 2/4] drm/amdgpu:new method to sync ce&de Monk Liu
     [not found]     ` <1472439337-8002-2-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2016-08-29  8:05       ` Christian König
     [not found]         ` <283cbf94-05bf-4d30-c03f-731dd34ac653-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2016-08-29  8:14           ` Liu, Monk
     [not found]             ` <MWHPR12MB1182364E8ADFBB9B2AAFD47A84E10-Gy0DoCVfaSVhjnLHdLm0OQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-08-29  8:25               ` Christian König
     [not found]                 ` <1c8cab37-70cb-3e17-b651-b3b6b2b5b8e0-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2016-08-29  8:28                   ` Liu, Monk
     [not found]                     ` <MWHPR12MB118285051FDBA2381204FE0384E10-Gy0DoCVfaSVhjnLHdLm0OQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-08-29  8:54                       ` Christian König
2016-08-29 13:37                   ` Deucher, Alexander
     [not found]                     ` <MWHPR12MB16948C33AC82C6566DBA5C5EF7E10-Gy0DoCVfaSW4WA4dJ5YXGAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2016-09-05 19:13                       ` Marek Olšák
     [not found]                         ` <CAAxE2A6s0ephQBxb=b8XU01wNbQ3aCX51thv4DrLCs6VckLxzw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-09-06  2:58                           ` Liu, Monk
2016-08-29 13:21       ` Deucher, Alexander

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1472460939-31571-3-git-send-email-Monk.Liu@amd.com \
    --to=monk.liu-5c7gfcevmho@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox