Skip to contentSkip to conversation

drm/amdgpu: GFX9, GFX10: GRBM requires 1-cycle delay

PATCH In review Tuikov, Luben 4 participants 10 messages Oct 24, 2019 – Oct 28, 2019 7 messages not in the archive

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

PATCH 1/1 drm/amdgpu: GFX9, GFX10: GRBM requires 1-cycle delay

The GRBM interface is now capable of bursting 1-cycle op per register, a WRITE followed by another WRITE, or a WRITE followed by a READ--much faster than previous muti-cycle per completed-transaction interface. This causes a problem, whereby status registers requiring a read/write by hardware, have a 1-cycle delay, due to the register update having to go through GRBM interface.

This patch adds this delay.

A one cycle read op is added after updating the invalidate request and before reading the invalidate-ACK status.

See also commit 534991731cb5fa94b5519957646cf849ca10d17d.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 4 ++--
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c  | 4 ++--
 drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 9 +++++++++
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c  | 8 ++++++++
 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 2 +-
 5 files changed, 22 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +2 -2
index ac43b1af69e3..0042868dbd53 100644
@@ -5129,7 +5129,7 @@ static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_gfx = {
 		5 + /* COND_EXEC */
 		7 + /* PIPELINE_SYNC */
 		SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
-		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 +
+		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 * 2 +
 		2 + /* VM_FLUSH */
 		8 + /* FENCE for VM_FLUSH */
 		20 + /* GDS switch */
@@ -5182,7 +5182,7 @@ static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_compute = {
 		5 + /* hdp invalidate */
 		7 + /* gfx_v10_0_ring_emit_pipeline_sync */
 		SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
-		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 +
+		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 * 2 +
 		2 + /* gfx_v10_0_ring_emit_vm_flush */
 		8 + 8 + 8, /* gfx_v10_0_ring_emit_fence x3 for user fence, vm fence */
 	.emit_ib_size =	7, /* gfx_v10_0_ring_emit_ib_compute */
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -2
index 9fe95e7693d5..9a7a717208de 100644
@@ -6218,7 +6218,7 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_gfx = {
 		5 +  /* COND_EXEC */
 		7 +  /* PIPELINE_SYNC */
 		SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
-		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 +
+		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 * 2 +
 		2 + /* VM_FLUSH */
 		8 +  /* FENCE for VM_FLUSH */
 		20 + /* GDS switch */
@@ -6271,7 +6271,7 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_compute = {
 		5 + /* hdp invalidate */
 		7 + /* gfx_v9_0_ring_emit_pipeline_sync */
 		SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
-		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 +
+		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 * 2 +
 		2 + /* gfx_v9_0_ring_emit_vm_flush */
 		8 + 8 + 8, /* gfx_v9_0_ring_emit_fence x3 for user fence, vm fence */
 	.emit_ib_size =	7, /* gfx_v9_0_ring_emit_ib_compute */
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +9 -0
index 6e1b25bd1fe7..100d526e9a42 100644
@@ -346,6 +346,15 @@ static uint64_t gmc_v10_0_emit_flush_gpu_tlb(struct amdgpu_ring *ring,
 
 	amdgpu_ring_emit_wreg(ring, hub->vm_inv_eng0_req + eng, req);
 
+	/* Insert a dummy read to delay one cycle before the ACK
+	 * inquiry.
+	 */
+	if (ring->funcs->type == AMDGPU_RING_TYPE_SDMA ||
+	    ring->funcs->type == AMDGPU_RING_TYPE_GFX  ||
+	    ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE)
+		amdgpu_ring_emit_reg_wait(ring,
+					  hub->vm_inv_eng0_req + eng, 0, 0);
+
 	/* wait for the invalidate to complete */
 	amdgpu_ring_emit_reg_wait(ring, hub->vm_inv_eng0_ack + eng,
 				  1 << vmid, 1 << vmid);
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +8 -0
index 9f2a893871ec..8f3097e45299 100644
@@ -495,6 +495,14 @@ static uint64_t gmc_v9_0_emit_flush_gpu_tlb(struct amdgpu_ring *ring,
 	amdgpu_ring_emit_wreg(ring, hub->ctx0_ptb_addr_hi32 + (2 * vmid),
 			      upper_32_bits(pd_addr));
 
+	/* Insert a dummy read to delay one cycle before the ACK
+	 * inquiry.
+	 */
+	if (ring->funcs->type == AMDGPU_RING_TYPE_GFX  ||
+	    ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE)
+		amdgpu_ring_emit_reg_wait(ring,
+					  hub->vm_inv_eng0_req + eng, 0, 0);
+
 	amdgpu_ring_emit_reg_write_reg_wait(ring, hub->vm_inv_eng0_req + eng,
 					    hub->vm_inv_eng0_ack + eng,
 					    req, 1 << vmid);
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +1 -1
index b8fdb192f6d6..0c41b4fdc58b 100644
@@ -1588,7 +1588,7 @@ static const struct amdgpu_ring_funcs sdma_v5_0_ring_funcs = {
 		6 + /* sdma_v5_0_ring_emit_pipeline_sync */
 		/* sdma_v5_0_ring_emit_vm_flush */
 		SOC15_FLUSH_GPU_TLB_NUM_WREG * 3 +
-		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 6 +
+		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 6 * 2 +
 		10 + 10 + 10, /* sdma_v5_0_ring_emit_fence x3 for user fence, vm fence */
 	.emit_ib_size = 7 + 6, /* sdma_v5_0_ring_emit_ib */
 	.emit_ib = sdma_v5_0_ring_emit_ib,
Signature · 6 lines
2.23.0.385.gbc12974a89

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Inline.

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Tuikov, Luben
Sent: Friday, October 25, 2019 5:17 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Pelloux-prayer, Pierre-eric <[email protected]>; Tuikov, Luben <[email protected]>; Koenig, Christian <[email protected]>
Subject: [PATCH] drm/amdgpu: GFX9, GFX10: GRBM requires 1-cycle delay

The GRBM interface is now capable of bursting 1-cycle op per register, a WRITE followed by another WRITE, or a WRITE followed by a READ--much faster than previous muti-cycle per completed-transaction interface. This causes a problem, whereby status registers requiring a read/write by hardware, have a 1-cycle delay, due to the register update having to go through GRBM interface.

This patch adds this delay.

A one cycle read op is added after updating the invalidate request and before reading the invalidate-ACK status.

See also commit
534991731cb5fa94b5519957646cf849ca10d17d.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 4 ++--  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c  | 4 ++--  drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 9 +++++++++  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c  | 8 ++++++++  drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 2 +-
 5 files changed, 22 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +2 -2
index ac43b1af69e3..0042868dbd53 100644
@@ -5129,7 +5129,7 @@ static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_gfx = {
 		5 + /* COND_EXEC */
 		7 + /* PIPELINE_SYNC */
 		SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
-		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 +
+		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 * 2 +
 		2 + /* VM_FLUSH */
 		8 + /* FENCE for VM_FLUSH */
 		20 + /* GDS switch */
@@ -5182,7 +5182,7 @@ static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_compute = {
 		5 + /* hdp invalidate */
 		7 + /* gfx_v10_0_ring_emit_pipeline_sync */
 		SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
-		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 +
+		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 * 2 +
 		2 + /* gfx_v10_0_ring_emit_vm_flush */
 		8 + 8 + 8, /* gfx_v10_0_ring_emit_fence x3 for user fence, vm fence */
 	.emit_ib_size =	7, /* gfx_v10_0_ring_emit_ib_compute */
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -2
index 9fe95e7693d5..9a7a717208de 100644
@@ -6218,7 +6218,7 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_gfx = {
 		5 +  /* COND_EXEC */
 		7 +  /* PIPELINE_SYNC */
 		SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
-		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 +
+		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 * 2 +
 		2 + /* VM_FLUSH */
 		8 +  /* FENCE for VM_FLUSH */
 		20 + /* GDS switch */
@@ -6271,7 +6271,7 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_compute = {
 		5 + /* hdp invalidate */
 		7 + /* gfx_v9_0_ring_emit_pipeline_sync */
 		SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
-		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 +
+		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 * 2 +
 		2 + /* gfx_v9_0_ring_emit_vm_flush */
 		8 + 8 + 8, /* gfx_v9_0_ring_emit_fence x3 for user fence, vm fence */
 	.emit_ib_size =	7, /* gfx_v9_0_ring_emit_ib_compute */
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +9 -0
index 6e1b25bd1fe7..100d526e9a42 100644
@@ -346,6 +346,15 @@ static uint64_t gmc_v10_0_emit_flush_gpu_tlb(struct amdgpu_ring *ring,
 
 	amdgpu_ring_emit_wreg(ring, hub->vm_inv_eng0_req + eng, req);
 
+	/* Insert a dummy read to delay one cycle before the ACK
+	 * inquiry.
+	 */
+	if (ring->funcs->type == AMDGPU_RING_TYPE_SDMA ||
+	    ring->funcs->type == AMDGPU_RING_TYPE_GFX  ||
+	    ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE)
+		amdgpu_ring_emit_reg_wait(ring,
+					  hub->vm_inv_eng0_req + eng, 0, 0);
+
 	/* wait for the invalidate to complete */
 	amdgpu_ring_emit_reg_wait(ring, hub->vm_inv_eng0_ack + eng,
 				  1 << vmid, 1 << vmid);
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +8 -0
index 9f2a893871ec..8f3097e45299 100644
@@ -495,6 +495,14 @@ static uint64_t gmc_v9_0_emit_flush_gpu_tlb(struct amdgpu_ring *ring,
 	amdgpu_ring_emit_wreg(ring, hub->ctx0_ptb_addr_hi32 + (2 * vmid),
 			      upper_32_bits(pd_addr));
 
+	/* Insert a dummy read to delay one cycle before the ACK
+	 * inquiry.
+	 */
+	if (ring->funcs->type == AMDGPU_RING_TYPE_GFX  ||
+	    ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE)
+		amdgpu_ring_emit_reg_wait(ring,
+					  hub->vm_inv_eng0_req + eng, 0, 0);
+
 
 

Why do we add amdgpu_ring_emit_reg_wait here? There is no amdgpu_ring_emit_wreg(ring, hub->vm_inv_eng0_req + eng, req); before it like gmc10. In gmc9,amdgpu_ring_emit_wreg and amdgpu_ring_emit_reg_wait are called in amdgpu_ring_emit_reg_write_reg_wait.
I think it may be more reasonable to add dummy amdgpu_ring_emit_reg_wait in amdgpu_ring_emit_reg_write_reg_wait. Besides, we should also think about the influence of SROV's patch:
drm/amdgpu: Remove the sriov checking and add firmware checking

amdgpu_ring_emit_reg_write_reg_wait(ring, hub->vm_inv_eng0_req + eng,
hub->vm_inv_eng0_ack + eng, req, 1 << vmid);

drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +1 -1
index b8fdb192f6d6..0c41b4fdc58b 100644
@@ -1588,7 +1588,7 @@ static const struct amdgpu_ring_funcs sdma_v5_0_ring_funcs = {
 		6 + /* sdma_v5_0_ring_emit_pipeline_sync */
 		/* sdma_v5_0_ring_emit_vm_flush */
 		SOC15_FLUSH_GPU_TLB_NUM_WREG * 3 +
-		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 6 +
+		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 6 * 2 +
 		10 + 10 + 10, /* sdma_v5_0_ring_emit_fence x3 for user fence, vm fence */
 	.emit_ib_size = 7 + 6, /* sdma_v5_0_ring_emit_ib */
 	.emit_ib = sdma_v5_0_ring_emit_ib,

--
2.23.0.385.gbc12974a89

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#3 lore raw
In reply to a message not in the archive

Am 24.10.19 um 23:16 schrieb Tuikov, Luben:

Quoted 10 lines

The GRBM interface is now capable of bursting 1-cycle op per register, a WRITE followed by another WRITE, or a WRITE followed by a READ--much faster than previous muti-cycle per completed-transaction interface. This causes a problem, whereby status registers requiring a read/write by hardware, have a 1-cycle delay, due to the register update having to go through GRBM interface.

Quoted 5 lines

This patch adds this delay.

A one cycle read op is added after updating the invalidate request and before reading the invalidate-ACK status.

Please completely drop all changes for GFX9 since this patch will most likely break SRIOV.

Additional to that please apply the workaround only to SDMA since the CP driven engines should handle that in firmware.

Regards,
Christian.

Quoted 101 lines

See also commit 534991731cb5fa94b5519957646cf849ca10d17d.

---
  drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 4 ++--
  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c  | 4 ++--
  drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 9 +++++++++
  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c  | 8 ++++++++
  drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 2 +-
  5 files changed, 22 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +2 -2
index ac43b1af69e3..0042868dbd53 100644
@@ -5129,7 +5129,7 @@ static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_gfx = {
  		5 + /* COND_EXEC */
  		7 + /* PIPELINE_SYNC */
  		SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
-		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 +
+		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 * 2 +
  		2 + /* VM_FLUSH */
  		8 + /* FENCE for VM_FLUSH */
  		20 + /* GDS switch */
@@ -5182,7 +5182,7 @@ static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_compute = {
  		5 + /* hdp invalidate */
  		7 + /* gfx_v10_0_ring_emit_pipeline_sync */
  		SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
-		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 +
+		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 * 2 +
  		2 + /* gfx_v10_0_ring_emit_vm_flush */
  		8 + 8 + 8, /* gfx_v10_0_ring_emit_fence x3 for user fence, vm fence */
  	.emit_ib_size =	7, /* gfx_v10_0_ring_emit_ib_compute */
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -2
index 9fe95e7693d5..9a7a717208de 100644
@@ -6218,7 +6218,7 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_gfx = {
  		5 +  /* COND_EXEC */
  		7 +  /* PIPELINE_SYNC */
  		SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
-		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 +
+		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 * 2 +
  		2 + /* VM_FLUSH */
  		8 +  /* FENCE for VM_FLUSH */
  		20 + /* GDS switch */
@@ -6271,7 +6271,7 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_compute = {
  		5 + /* hdp invalidate */
  		7 + /* gfx_v9_0_ring_emit_pipeline_sync */
  		SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
-		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 +
+		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 * 2 +
  		2 + /* gfx_v9_0_ring_emit_vm_flush */
  		8 + 8 + 8, /* gfx_v9_0_ring_emit_fence x3 for user fence, vm fence */
  	.emit_ib_size =	7, /* gfx_v9_0_ring_emit_ib_compute */
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +9 -0
index 6e1b25bd1fe7..100d526e9a42 100644
@@ -346,6 +346,15 @@ static uint64_t gmc_v10_0_emit_flush_gpu_tlb(struct amdgpu_ring *ring,
 
  	amdgpu_ring_emit_wreg(ring, hub->vm_inv_eng0_req + eng, req);
 
+	/* Insert a dummy read to delay one cycle before the ACK
+	 * inquiry.
+	 */
+	if (ring->funcs->type == AMDGPU_RING_TYPE_SDMA ||
+	    ring->funcs->type == AMDGPU_RING_TYPE_GFX  ||
+	    ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE)
+		amdgpu_ring_emit_reg_wait(ring,
+					  hub->vm_inv_eng0_req + eng, 0, 0);
+
  	/* wait for the invalidate to complete */
  	amdgpu_ring_emit_reg_wait(ring, hub->vm_inv_eng0_ack + eng,
  				  1 << vmid, 1 << vmid);
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +8 -0
index 9f2a893871ec..8f3097e45299 100644
@@ -495,6 +495,14 @@ static uint64_t gmc_v9_0_emit_flush_gpu_tlb(struct amdgpu_ring *ring,
  	amdgpu_ring_emit_wreg(ring, hub->ctx0_ptb_addr_hi32 + (2 * vmid),
  			      upper_32_bits(pd_addr));
 
+	/* Insert a dummy read to delay one cycle before the ACK
+	 * inquiry.
+	 */
+	if (ring->funcs->type == AMDGPU_RING_TYPE_GFX  ||
+	    ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE)
+		amdgpu_ring_emit_reg_wait(ring,
+					  hub->vm_inv_eng0_req + eng, 0, 0);
+
  	amdgpu_ring_emit_reg_write_reg_wait(ring, hub->vm_inv_eng0_req + eng,
  					    hub->vm_inv_eng0_ack + eng,
  					    req, 1 << vmid);
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +0 -0
index b8fdb192f6d6..0c41b4fdc58b 100644

drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c static const struct amdgpu_ring_funcs sdma_v5_0_ring_funcs = { · line 1594

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +1 -1
@@ -1588,7 +1588,7 @@ static const struct amdgpu_ring_funcs sdma_v5_0_ring_funcs = {
  		6 + /* sdma_v5_0_ring_emit_pipeline_sync */
  		/* sdma_v5_0_ring_emit_vm_flush */
  		SOC15_FLUSH_GPU_TLB_NUM_WREG * 3 +
-		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 6 +
+		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 6 * 2 +
  		10 + 10 + 10, /* sdma_v5_0_ring_emit_fence x3 for user fence, vm fence */
  	.emit_ib_size = 7 + 6, /* sdma_v5_0_ring_emit_ib */
  	.emit_ib = sdma_v5_0_ring_emit_ib,

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 6be2805a-dddc-7b02-84ea-f52fab9780b0-5C7GfCeVMHo@public.gmane.org

#5 lore raw
Quoted 18 lines · Christian

Am 24.10.19 um 23:16 schrieb Tuikov, Luben:

Quoted 10 lines

The GRBM interface is now capable of bursting 1-cycle op per register, a WRITE followed by another WRITE, or a WRITE followed by a READ--much faster than previous muti-cycle per completed-transaction interface. This causes a problem, whereby status registers requiring a read/write by hardware, have a 1-cycle delay, due to the register update having to go through GRBM interface.

Quoted 5 lines

This patch adds this delay.

A one cycle read op is added after updating the invalidate request and before reading the invalidate-ACK status.

Quoted 5 lines

Please completely drop all changes for GFX9 since this patch will most likely break SRIOV.

Additional to that please apply the workaround only to SDMA since the CP driven engines should handle that in firmware.

I think the CP only handles this in firmware if we use the new TLB invalidation packet. I don't think it applies it to general register writes like we do.

Alex

Quoted 110 lines

Regards,
Christian.

Quoted 106 lines

See also commit 534991731cb5fa94b5519957646cf849ca10d17d.

---
  drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 4 ++--
  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c  | 4 ++--
  drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 9 +++++++++
  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c  | 8 ++++++++
  drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 2 +-
  5 files changed, 22 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +2 -2
index ac43b1af69e3..0042868dbd53 100644
@@ -5129,7 +5129,7 @@ static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_gfx = {
              5 + /* COND_EXEC */
              7 + /* PIPELINE_SYNC */
              SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
-             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 +
+             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 * 2 +
              2 + /* VM_FLUSH */
              8 + /* FENCE for VM_FLUSH */
              20 + /* GDS switch */
@@ -5182,7 +5182,7 @@ static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_compute = {
              5 + /* hdp invalidate */
              7 + /* gfx_v10_0_ring_emit_pipeline_sync */
              SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
-             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 +
+             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 * 2 +
              2 + /* gfx_v10_0_ring_emit_vm_flush */
              8 + 8 + 8, /* gfx_v10_0_ring_emit_fence x3 for user fence, vm fence */
      .emit_ib_size = 7, /* gfx_v10_0_ring_emit_ib_compute */
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -2
index 9fe95e7693d5..9a7a717208de 100644
@@ -6218,7 +6218,7 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_gfx = {
              5 +  /* COND_EXEC */
              7 +  /* PIPELINE_SYNC */
              SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
-             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 +
+             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 * 2 +
              2 + /* VM_FLUSH */
              8 +  /* FENCE for VM_FLUSH */
              20 + /* GDS switch */
@@ -6271,7 +6271,7 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_compute = {
              5 + /* hdp invalidate */
              7 + /* gfx_v9_0_ring_emit_pipeline_sync */
              SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
-             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 +
+             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 * 2 +
              2 + /* gfx_v9_0_ring_emit_vm_flush */
              8 + 8 + 8, /* gfx_v9_0_ring_emit_fence x3 for user fence, vm fence */
      .emit_ib_size = 7, /* gfx_v9_0_ring_emit_ib_compute */
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +9 -0
index 6e1b25bd1fe7..100d526e9a42 100644
@@ -346,6 +346,15 @@ static uint64_t gmc_v10_0_emit_flush_gpu_tlb(struct amdgpu_ring *ring,
 
      amdgpu_ring_emit_wreg(ring, hub->vm_inv_eng0_req + eng, req);
 
+     /* Insert a dummy read to delay one cycle before the ACK
+      * inquiry.
+      */
+     if (ring->funcs->type == AMDGPU_RING_TYPE_SDMA ||
+         ring->funcs->type == AMDGPU_RING_TYPE_GFX  ||
+         ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE)
+             amdgpu_ring_emit_reg_wait(ring,
+                                       hub->vm_inv_eng0_req + eng, 0, 0);
+
      /* wait for the invalidate to complete */
      amdgpu_ring_emit_reg_wait(ring, hub->vm_inv_eng0_ack + eng,
                                1 << vmid, 1 << vmid);
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +8 -0
index 9f2a893871ec..8f3097e45299 100644
@@ -495,6 +495,14 @@ static uint64_t gmc_v9_0_emit_flush_gpu_tlb(struct amdgpu_ring *ring,
      amdgpu_ring_emit_wreg(ring, hub->ctx0_ptb_addr_hi32 + (2 * vmid),
                            upper_32_bits(pd_addr));
 
+     /* Insert a dummy read to delay one cycle before the ACK
+      * inquiry.
+      */
+     if (ring->funcs->type == AMDGPU_RING_TYPE_GFX  ||
+         ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE)
+             amdgpu_ring_emit_reg_wait(ring,
+                                       hub->vm_inv_eng0_req + eng, 0, 0);
+
      amdgpu_ring_emit_reg_write_reg_wait(ring, hub->vm_inv_eng0_req + eng,
                                          hub->vm_inv_eng0_ack + eng,
                                          req, 1 << vmid);
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +1 -1
index b8fdb192f6d6..0c41b4fdc58b 100644
@@ -1588,7 +1588,7 @@ static const struct amdgpu_ring_funcs sdma_v5_0_ring_funcs = {
              6 + /* sdma_v5_0_ring_emit_pipeline_sync */
              /* sdma_v5_0_ring_emit_vm_flush */
              SOC15_FLUSH_GPU_TLB_NUM_WREG * 3 +
-             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 6 +
+             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 6 * 2 +
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c static const struct amdgpu_ring_funcs sdma_v5_0_ring_funcs = { · line 1594

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +0 -0
              10 + 10 + 10, /* sdma_v5_0_ring_emit_fence x3 for user fence, vm fence */
      .emit_ib_size = 7 + 6, /* sdma_v5_0_ring_emit_ib */
      .emit_ib = sdma_v5_0_ring_emit_ib,

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CADnq5_NsTABDWTMBFcQBGfaBganBpzN+YQ0gmw55pa8PswNZYA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#7 lore raw

Am 25.10.19 um 18:05 schrieb Alex Deucher:

Quoted 18 lines
Quoted 16 lines · Christian

Am 24.10.19 um 23:16 schrieb Tuikov, Luben:

Quoted 15 lines

The GRBM interface is now capable of bursting 1-cycle op per register, a WRITE followed by another WRITE, or a WRITE followed by a READ--much faster than previous muti-cycle per completed-transaction interface. This causes a problem, whereby status registers requiring a read/write by hardware, have a 1-cycle delay, due to the register update having to go through GRBM interface.

This patch adds this delay.

A one cycle read op is added after updating the invalidate request and before reading the invalidate-ACK status.

Quoted 8 lines
Quoted 5 lines

Please completely drop all changes for GFX9 since this patch will most likely break SRIOV.

Additional to that please apply the workaround only to SDMA since the CP driven engines should handle that in firmware.

I think the CP only handles this in firmware if we use the new TLB invalidation packet. I don't think it applies it to general register writes like we do.

No, on the CP we should use the combined write/wait command even if we don't use the new specialized VM invalidate command. Everything else won't work with SRIOV.

Even if we want to we can't insert an extra read in this combined write/wait command. And if we split up the commands we would break SRIOV once more.

So applying this workaround to the CP code doesn't make any sense at all.

The only TODO which I can see is that we maybe don't use the combined write/wait command on Navi yet.

Christian.

Quoted 118 lines

Alex

Quoted 115 lines

Regards,
Christian.

Quoted 100 lines

See also commit 534991731cb5fa94b5519957646cf849ca10d17d.

---
   drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 4 ++--
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c  | 4 ++--
   drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 9 +++++++++
   drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c  | 8 ++++++++
   drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 2 +-
   5 files changed, 22 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +2 -2
index ac43b1af69e3..0042868dbd53 100644
@@ -5129,7 +5129,7 @@ static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_gfx = {
               5 + /* COND_EXEC */
               7 + /* PIPELINE_SYNC */
               SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
-             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 +
+             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 * 2 +
               2 + /* VM_FLUSH */
               8 + /* FENCE for VM_FLUSH */
               20 + /* GDS switch */
@@ -5182,7 +5182,7 @@ static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_compute = {
               5 + /* hdp invalidate */
               7 + /* gfx_v10_0_ring_emit_pipeline_sync */
               SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
-             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 +
+             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 * 2 +
               2 + /* gfx_v10_0_ring_emit_vm_flush */
               8 + 8 + 8, /* gfx_v10_0_ring_emit_fence x3 for user fence, vm fence */
       .emit_ib_size = 7, /* gfx_v10_0_ring_emit_ib_compute */
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -2
index 9fe95e7693d5..9a7a717208de 100644
@@ -6218,7 +6218,7 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_gfx = {
               5 +  /* COND_EXEC */
               7 +  /* PIPELINE_SYNC */
               SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
-             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 +
+             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 * 2 +
               2 + /* VM_FLUSH */
               8 +  /* FENCE for VM_FLUSH */
               20 + /* GDS switch */
@@ -6271,7 +6271,7 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_compute = {
               5 + /* hdp invalidate */
               7 + /* gfx_v9_0_ring_emit_pipeline_sync */
               SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
-             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 +
+             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 * 2 +
               2 + /* gfx_v9_0_ring_emit_vm_flush */
               8 + 8 + 8, /* gfx_v9_0_ring_emit_fence x3 for user fence, vm fence */
       .emit_ib_size = 7, /* gfx_v9_0_ring_emit_ib_compute */
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +9 -0
index 6e1b25bd1fe7..100d526e9a42 100644
@@ -346,6 +346,15 @@ static uint64_t gmc_v10_0_emit_flush_gpu_tlb(struct amdgpu_ring *ring,
 
       amdgpu_ring_emit_wreg(ring, hub->vm_inv_eng0_req + eng, req);
 
+     /* Insert a dummy read to delay one cycle before the ACK
+      * inquiry.
+      */
+     if (ring->funcs->type == AMDGPU_RING_TYPE_SDMA ||
+         ring->funcs->type == AMDGPU_RING_TYPE_GFX  ||
+         ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE)
+             amdgpu_ring_emit_reg_wait(ring,
+                                       hub->vm_inv_eng0_req + eng, 0, 0);
+
       /* wait for the invalidate to complete */
       amdgpu_ring_emit_reg_wait(ring, hub->vm_inv_eng0_ack + eng,
                                 1 << vmid, 1 << vmid);
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +8 -0
index 9f2a893871ec..8f3097e45299 100644
@@ -495,6 +495,14 @@ static uint64_t gmc_v9_0_emit_flush_gpu_tlb(struct amdgpu_ring *ring,
       amdgpu_ring_emit_wreg(ring, hub->ctx0_ptb_addr_hi32 + (2 * vmid),
                             upper_32_bits(pd_addr));
 
+     /* Insert a dummy read to delay one cycle before the ACK
+      * inquiry.
+      */
+     if (ring->funcs->type == AMDGPU_RING_TYPE_GFX  ||
+         ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE)
+             amdgpu_ring_emit_reg_wait(ring,
+                                       hub->vm_inv_eng0_req + eng, 0, 0);
+
       amdgpu_ring_emit_reg_write_reg_wait(ring, hub->vm_inv_eng0_req + eng,
                                           hub->vm_inv_eng0_ack + eng,
                                           req, 1 << vmid);
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +0 -0
index b8fdb192f6d6..0c41b4fdc58b 100644

drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c static const struct amdgpu_ring_funcs sdma_v5_0_ring_funcs = { · line 1594

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +1 -1
@@ -1588,7 +1588,7 @@ static const struct amdgpu_ring_funcs sdma_v5_0_ring_funcs = {
               6 + /* sdma_v5_0_ring_emit_pipeline_sync */
               /* sdma_v5_0_ring_emit_vm_flush */
               SOC15_FLUSH_GPU_TLB_NUM_WREG * 3 +
-             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 6 +
+             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 6 * 2 +
               10 + 10 + 10, /* sdma_v5_0_ring_emit_fence x3 for user fence, vm fence */
       .emit_ib_size = 7 + 6, /* sdma_v5_0_ring_emit_ib */
       .emit_ib = sdma_v5_0_ring_emit_ib,

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): b40c78f1-17a5-f0f9-183e-0c78fd7163e9-5C7GfCeVMHo@public.gmane.org

#9 lore raw
Quoted 24 lines · Christian

Am 25.10.19 um 18:05 schrieb Alex Deucher:

Quoted 23 lines
Quoted 21 lines · Christian

Am 24.10.19 um 23:16 schrieb Tuikov, Luben:

Quoted 10 lines

The GRBM interface is now capable of bursting 1-cycle op per register, a WRITE followed by another WRITE, or a WRITE followed by a READ--much faster than previous muti-cycle per completed-transaction interface. This causes a problem, whereby status registers requiring a read/write by hardware, have a 1-cycle delay, due to the register update having to go through GRBM interface.

Quoted 5 lines

This patch adds this delay.

A one cycle read op is added after updating the invalidate request and before reading the invalidate-ACK status.

Please completely drop all changes for GFX9 since this patch will most likely break SRIOV.

Additional to that please apply the workaround only to SDMA since the CP driven engines should handle that in firmware.

Thank you Christian for reviewing this patch.

This patch stirred quite a bit of noise. So, then, I'll go by your last comment above--I suppose this is the desired way to go forward then?

Regards,
Luben

Quoted 12 lines
Quoted 3 lines

I think the CP only handles this in firmware if we use the new TLB invalidation packet. I don't think it applies it to general register writes like we do.

No, on the CP we should use the combined write/wait command even if we don't use the new specialized VM invalidate command. Everything else won't work with SRIOV.

Even if we want to we can't insert an extra read in this combined write/wait command. And if we split up the commands we would break SRIOV once more.

Quoted 126 lines

So applying this workaround to the CP code doesn't make any sense at all.

The only TODO which I can see is that we maybe don't use the combined write/wait command on Navi yet.

Christian.

Quoted 118 lines

Alex

Quoted 115 lines

Regards,
Christian.

Quoted 100 lines

See also commit 534991731cb5fa94b5519957646cf849ca10d17d.

---
   drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 4 ++--
   drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c  | 4 ++--
   drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 9 +++++++++
   drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c  | 8 ++++++++
   drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 2 +-
   5 files changed, 22 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +2 -2
index ac43b1af69e3..0042868dbd53 100644
@@ -5129,7 +5129,7 @@ static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_gfx = {
               5 + /* COND_EXEC */
               7 + /* PIPELINE_SYNC */
               SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
-             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 +
+             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 * 2 +
               2 + /* VM_FLUSH */
               8 + /* FENCE for VM_FLUSH */
               20 + /* GDS switch */
@@ -5182,7 +5182,7 @@ static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_compute = {
               5 + /* hdp invalidate */
               7 + /* gfx_v10_0_ring_emit_pipeline_sync */
               SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
-             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 +
+             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 * 2 +
               2 + /* gfx_v10_0_ring_emit_vm_flush */
               8 + 8 + 8, /* gfx_v10_0_ring_emit_fence x3 for user fence, vm fence */
       .emit_ib_size = 7, /* gfx_v10_0_ring_emit_ib_compute */
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -2
index 9fe95e7693d5..9a7a717208de 100644
@@ -6218,7 +6218,7 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_gfx = {
               5 +  /* COND_EXEC */
               7 +  /* PIPELINE_SYNC */
               SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
-             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 +
+             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 * 2 +
               2 + /* VM_FLUSH */
               8 +  /* FENCE for VM_FLUSH */
               20 + /* GDS switch */
@@ -6271,7 +6271,7 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_compute = {
               5 + /* hdp invalidate */
               7 + /* gfx_v9_0_ring_emit_pipeline_sync */
               SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
-             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 +
+             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 * 2 +
               2 + /* gfx_v9_0_ring_emit_vm_flush */
               8 + 8 + 8, /* gfx_v9_0_ring_emit_fence x3 for user fence, vm fence */
       .emit_ib_size = 7, /* gfx_v9_0_ring_emit_ib_compute */
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +9 -0
index 6e1b25bd1fe7..100d526e9a42 100644
@@ -346,6 +346,15 @@ static uint64_t gmc_v10_0_emit_flush_gpu_tlb(struct amdgpu_ring *ring,
 
       amdgpu_ring_emit_wreg(ring, hub->vm_inv_eng0_req + eng, req);
 
+     /* Insert a dummy read to delay one cycle before the ACK
+      * inquiry.
+      */
+     if (ring->funcs->type == AMDGPU_RING_TYPE_SDMA ||
+         ring->funcs->type == AMDGPU_RING_TYPE_GFX  ||
+         ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE)
+             amdgpu_ring_emit_reg_wait(ring,
+                                       hub->vm_inv_eng0_req + eng, 0, 0);
+
       /* wait for the invalidate to complete */
       amdgpu_ring_emit_reg_wait(ring, hub->vm_inv_eng0_ack + eng,
                                 1 << vmid, 1 << vmid);
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +8 -0
index 9f2a893871ec..8f3097e45299 100644
@@ -495,6 +495,14 @@ static uint64_t gmc_v9_0_emit_flush_gpu_tlb(struct amdgpu_ring *ring,
       amdgpu_ring_emit_wreg(ring, hub->ctx0_ptb_addr_hi32 + (2 * vmid),
                             upper_32_bits(pd_addr));
 
+     /* Insert a dummy read to delay one cycle before the ACK
+      * inquiry.
+      */
+     if (ring->funcs->type == AMDGPU_RING_TYPE_GFX  ||
+         ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE)
+             amdgpu_ring_emit_reg_wait(ring,
+                                       hub->vm_inv_eng0_req + eng, 0, 0);
+
       amdgpu_ring_emit_reg_write_reg_wait(ring, hub->vm_inv_eng0_req + eng,
                                           hub->vm_inv_eng0_ack + eng,
                                           req, 1 << vmid);
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +0 -0
index b8fdb192f6d6..0c41b4fdc58b 100644

drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c static const struct amdgpu_ring_funcs sdma_v5_0_ring_funcs = { · line 1594

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +1 -1
@@ -1588,7 +1588,7 @@ static const struct amdgpu_ring_funcs sdma_v5_0_ring_funcs = {
               6 + /* sdma_v5_0_ring_emit_pipeline_sync */
               /* sdma_v5_0_ring_emit_vm_flush */
               SOC15_FLUSH_GPU_TLB_NUM_WREG * 3 +
-             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 6 +
+             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 6 * 2 +
               10 + 10 + 10, /* sdma_v5_0_ring_emit_fence x3 for user fence, vm fence */
       .emit_ib_size = 7 + 6, /* sdma_v5_0_ring_emit_ib */
       .emit_ib = sdma_v5_0_ring_emit_ib,

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): c3e496c7-2ace-149e-0c51-92dd1342d31d-5C7GfCeVMHo@public.gmane.org

#11 lore raw

Am 26.10.19 um 00:45 schrieb Tuikov, Luben:

Quoted 23 lines · Christian
Quoted 22 lines

Am 25.10.19 um 18:05 schrieb Alex Deucher:

Quoted 21 lines
Quoted 19 lines · Christian

Am 24.10.19 um 23:16 schrieb Tuikov, Luben:

Quoted 10 lines

The GRBM interface is now capable of bursting 1-cycle op per register, a WRITE followed by another WRITE, or a WRITE followed by a READ--much faster than previous muti-cycle per completed-transaction interface. This causes a problem, whereby status registers requiring a read/write by hardware, have a 1-cycle delay, due to the register update having to go through GRBM interface.

Quoted 5 lines

This patch adds this delay.

A one cycle read op is added after updating the invalidate request and before reading the invalidate-ACK status.

Please completely drop all changes for GFX9 since this patch will most likely break SRIOV.

Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Additional to that please apply the workaround only to SDMA since the CP driven engines should handle that in firmware.

Thank you Christian for reviewing this patch.

This patch stirred quite a bit of noise. So, then, I'll go by your last comment above--I suppose this is the desired way to go forward then?

You most likely broke the SRIOV use case on GFX9 with that, no wonder that this raised eyebrows.

As far as I can see this manual workaround is only applicable to the SDMA on Navi.

But we should double check that the CP firmware interface with the combined write/wait command is correctly used on Navi/GFX10 as well. IIRC that came in rather late for GFX9, could be that the Navi bringup branch never had that.

Regards,
Christian.

Quoted 140 lines

Regards,
Luben

Quoted 135 lines
Quoted 3 lines

I think the CP only handles this in firmware if we use the new TLB invalidation packet. I don't think it applies it to general register writes like we do.

No, on the CP we should use the combined write/wait command even if we don't use the new specialized VM invalidate command. Everything else won't work with SRIOV.

Even if we want to we can't insert an extra read in this combined write/wait command. And if we split up the commands we would break SRIOV once more.

So applying this workaround to the CP code doesn't make any sense at all.

The only TODO which I can see is that we maybe don't use the combined write/wait command on Navi yet.

Christian.

Quoted 117 lines

Alex

Quoted 115 lines

Regards,
Christian.

Quoted 100 lines

See also commit 534991731cb5fa94b5519957646cf849ca10d17d.

---
    drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 4 ++--
    drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c  | 4 ++--
    drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 9 +++++++++
    drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c  | 8 ++++++++
    drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 2 +-
    5 files changed, 22 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +2 -2
index ac43b1af69e3..0042868dbd53 100644
@@ -5129,7 +5129,7 @@ static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_gfx = {
                5 + /* COND_EXEC */
                7 + /* PIPELINE_SYNC */
                SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
-             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 +
+             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 * 2 +
                2 + /* VM_FLUSH */
                8 + /* FENCE for VM_FLUSH */
                20 + /* GDS switch */
@@ -5182,7 +5182,7 @@ static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_compute = {
                5 + /* hdp invalidate */
                7 + /* gfx_v10_0_ring_emit_pipeline_sync */
                SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
-             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 +
+             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 * 2 +
                2 + /* gfx_v10_0_ring_emit_vm_flush */
                8 + 8 + 8, /* gfx_v10_0_ring_emit_fence x3 for user fence, vm fence */
        .emit_ib_size = 7, /* gfx_v10_0_ring_emit_ib_compute */
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -2
index 9fe95e7693d5..9a7a717208de 100644
@@ -6218,7 +6218,7 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_gfx = {
                5 +  /* COND_EXEC */
                7 +  /* PIPELINE_SYNC */
                SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
-             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 +
+             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 * 2 +
                2 + /* VM_FLUSH */
                8 +  /* FENCE for VM_FLUSH */
                20 + /* GDS switch */
@@ -6271,7 +6271,7 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_compute = {
                5 + /* hdp invalidate */
                7 + /* gfx_v9_0_ring_emit_pipeline_sync */
                SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
-             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 +
+             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 * 2 +
                2 + /* gfx_v9_0_ring_emit_vm_flush */
                8 + 8 + 8, /* gfx_v9_0_ring_emit_fence x3 for user fence, vm fence */
        .emit_ib_size = 7, /* gfx_v9_0_ring_emit_ib_compute */
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +9 -0
index 6e1b25bd1fe7..100d526e9a42 100644
@@ -346,6 +346,15 @@ static uint64_t gmc_v10_0_emit_flush_gpu_tlb(struct amdgpu_ring *ring,
 
        amdgpu_ring_emit_wreg(ring, hub->vm_inv_eng0_req + eng, req);
 
+     /* Insert a dummy read to delay one cycle before the ACK
+      * inquiry.
+      */
+     if (ring->funcs->type == AMDGPU_RING_TYPE_SDMA ||
+         ring->funcs->type == AMDGPU_RING_TYPE_GFX  ||
+         ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE)
+             amdgpu_ring_emit_reg_wait(ring,
+                                       hub->vm_inv_eng0_req + eng, 0, 0);
+
        /* wait for the invalidate to complete */
        amdgpu_ring_emit_reg_wait(ring, hub->vm_inv_eng0_ack + eng,
                                  1 << vmid, 1 << vmid);
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +8 -0
index 9f2a893871ec..8f3097e45299 100644
@@ -495,6 +495,14 @@ static uint64_t gmc_v9_0_emit_flush_gpu_tlb(struct amdgpu_ring *ring,
        amdgpu_ring_emit_wreg(ring, hub->ctx0_ptb_addr_hi32 + (2 * vmid),
                              upper_32_bits(pd_addr));
 
+     /* Insert a dummy read to delay one cycle before the ACK
+      * inquiry.
+      */
+     if (ring->funcs->type == AMDGPU_RING_TYPE_GFX  ||
+         ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE)
+             amdgpu_ring_emit_reg_wait(ring,
+                                       hub->vm_inv_eng0_req + eng, 0, 0);
+
        amdgpu_ring_emit_reg_write_reg_wait(ring, hub->vm_inv_eng0_req + eng,
                                            hub->vm_inv_eng0_ack + eng,
                                            req, 1 << vmid);
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +0 -0
index b8fdb192f6d6..0c41b4fdc58b 100644

drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c static const struct amdgpu_ring_funcs sdma_v5_0_ring_funcs = { · line 1594

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +1 -1
@@ -1588,7 +1588,7 @@ static const struct amdgpu_ring_funcs sdma_v5_0_ring_funcs = {
                6 + /* sdma_v5_0_ring_emit_pipeline_sync */
                /* sdma_v5_0_ring_emit_vm_flush */
                SOC15_FLUSH_GPU_TLB_NUM_WREG * 3 +
-             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 6 +
+             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 6 * 2 +
                10 + 10 + 10, /* sdma_v5_0_ring_emit_fence x3 for user fence, vm fence */
        .emit_ib_size = 7 + 6, /* sdma_v5_0_ring_emit_ib */
        .emit_ib = sdma_v5_0_ring_emit_ib,

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 122f3bde-5fd0-1fa5-864c-547c0cefb744-5C7GfCeVMHo@public.gmane.org

#13 lore raw
Quoted 28 lines · Christian

Am 26.10.19 um 00:45 schrieb Tuikov, Luben:

Quoted 27 lines · Christian
Quoted 24 lines

Am 25.10.19 um 18:05 schrieb Alex Deucher:

Quoted 23 lines
Quoted 21 lines · Christian

Am 24.10.19 um 23:16 schrieb Tuikov, Luben:

Quoted 10 lines

The GRBM interface is now capable of bursting 1-cycle op per register, a WRITE followed by another WRITE, or a WRITE followed by a READ--much faster than previous muti-cycle per completed-transaction interface. This causes a problem, whereby status registers requiring a read/write by hardware, have a 1-cycle delay, due to the register update having to go through GRBM interface.

Quoted 5 lines

This patch adds this delay.

A one cycle read op is added after updating the invalidate request and before reading the invalidate-ACK status.

Please completely drop all changes for GFX9 since this patch will most likely break SRIOV.

Additional to that please apply the workaround only to SDMA since the CP driven engines should handle that in firmware.

Thank you Christian for reviewing this patch.

Quoted 8 lines
Quoted 2 lines

This patch stirred quite a bit of noise. So, then, I'll go by your last comment above--I suppose this is the desired way to go forward then?

You most likely broke the SRIOV use case on GFX9 with that, no wonder that this raised eyebrows.

As far as I can see this manual workaround is only applicable to the SDMA on Navi.

Did you see the (v2) patch?

Regards,
Luben

Quoted 150 lines

But we should double check that the CP firmware interface with the combined write/wait command is correctly used on Navi/GFX10 as well. IIRC that came in rather late for GFX9, could be that the Navi bringup branch never had that.

Regards,
Christian.

Quoted 140 lines

Regards,
Luben

Quoted 135 lines
Quoted 3 lines

I think the CP only handles this in firmware if we use the new TLB invalidation packet. I don't think it applies it to general register writes like we do.

No, on the CP we should use the combined write/wait command even if we don't use the new specialized VM invalidate command. Everything else won't work with SRIOV.

Even if we want to we can't insert an extra read in this combined write/wait command. And if we split up the commands we would break SRIOV once more.

So applying this workaround to the CP code doesn't make any sense at all.

The only TODO which I can see is that we maybe don't use the combined write/wait command on Navi yet.

Christian.

Quoted 117 lines

Alex

Quoted 115 lines

Regards,
Christian.

Quoted 100 lines

See also commit 534991731cb5fa94b5519957646cf849ca10d17d.

---
    drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 4 ++--
    drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c  | 4 ++--
    drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 9 +++++++++
    drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c  | 8 ++++++++
    drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 2 +-
    5 files changed, 22 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +2 -2
index ac43b1af69e3..0042868dbd53 100644
@@ -5129,7 +5129,7 @@ static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_gfx = {
                5 + /* COND_EXEC */
                7 + /* PIPELINE_SYNC */
                SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
-             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 +
+             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 * 2 +
                2 + /* VM_FLUSH */
                8 + /* FENCE for VM_FLUSH */
                20 + /* GDS switch */
@@ -5182,7 +5182,7 @@ static const struct amdgpu_ring_funcs gfx_v10_0_ring_funcs_compute = {
                5 + /* hdp invalidate */
                7 + /* gfx_v10_0_ring_emit_pipeline_sync */
                SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
-             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 +
+             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 * 2 +
                2 + /* gfx_v10_0_ring_emit_vm_flush */
                8 + 8 + 8, /* gfx_v10_0_ring_emit_fence x3 for user fence, vm fence */
        .emit_ib_size = 7, /* gfx_v10_0_ring_emit_ib_compute */
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -2
index 9fe95e7693d5..9a7a717208de 100644
@@ -6218,7 +6218,7 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_gfx = {
                5 +  /* COND_EXEC */
                7 +  /* PIPELINE_SYNC */
                SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
-             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 +
+             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 * 2 +
                2 + /* VM_FLUSH */
                8 +  /* FENCE for VM_FLUSH */
                20 + /* GDS switch */
@@ -6271,7 +6271,7 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_compute = {
                5 + /* hdp invalidate */
                7 + /* gfx_v9_0_ring_emit_pipeline_sync */
                SOC15_FLUSH_GPU_TLB_NUM_WREG * 5 +
-             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 +
+             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 7 * 2 +
                2 + /* gfx_v9_0_ring_emit_vm_flush */
                8 + 8 + 8, /* gfx_v9_0_ring_emit_fence x3 for user fence, vm fence */
        .emit_ib_size = 7, /* gfx_v9_0_ring_emit_ib_compute */
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +9 -0
index 6e1b25bd1fe7..100d526e9a42 100644
@@ -346,6 +346,15 @@ static uint64_t gmc_v10_0_emit_flush_gpu_tlb(struct amdgpu_ring *ring,
 
        amdgpu_ring_emit_wreg(ring, hub->vm_inv_eng0_req + eng, req);
 
+     /* Insert a dummy read to delay one cycle before the ACK
+      * inquiry.
+      */
+     if (ring->funcs->type == AMDGPU_RING_TYPE_SDMA ||
+         ring->funcs->type == AMDGPU_RING_TYPE_GFX  ||
+         ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE)
+             amdgpu_ring_emit_reg_wait(ring,
+                                       hub->vm_inv_eng0_req + eng, 0, 0);
+
        /* wait for the invalidate to complete */
        amdgpu_ring_emit_reg_wait(ring, hub->vm_inv_eng0_ack + eng,
                                  1 << vmid, 1 << vmid);
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +8 -0
index 9f2a893871ec..8f3097e45299 100644
@@ -495,6 +495,14 @@ static uint64_t gmc_v9_0_emit_flush_gpu_tlb(struct amdgpu_ring *ring,
        amdgpu_ring_emit_wreg(ring, hub->ctx0_ptb_addr_hi32 + (2 * vmid),
                              upper_32_bits(pd_addr));
 
+     /* Insert a dummy read to delay one cycle before the ACK
+      * inquiry.
+      */
+     if (ring->funcs->type == AMDGPU_RING_TYPE_GFX  ||
+         ring->funcs->type == AMDGPU_RING_TYPE_COMPUTE)
+             amdgpu_ring_emit_reg_wait(ring,
+                                       hub->vm_inv_eng0_req + eng, 0, 0);
+
        amdgpu_ring_emit_reg_write_reg_wait(ring, hub->vm_inv_eng0_req + eng,
                                            hub->vm_inv_eng0_ack + eng,
                                            req, 1 << vmid);
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +0 -0
index b8fdb192f6d6..0c41b4fdc58b 100644

drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c static const struct amdgpu_ring_funcs sdma_v5_0_ring_funcs = { · line 1594

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +1 -1
@@ -1588,7 +1588,7 @@ static const struct amdgpu_ring_funcs sdma_v5_0_ring_funcs = {
                6 + /* sdma_v5_0_ring_emit_pipeline_sync */
                /* sdma_v5_0_ring_emit_vm_flush */
                SOC15_FLUSH_GPU_TLB_NUM_WREG * 3 +
-             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 6 +
+             SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 6 * 2 +
                10 + 10 + 10, /* sdma_v5_0_ring_emit_fence x3 for user fence, vm fence */
        .emit_ib_size = 7 + 6, /* sdma_v5_0_ring_emit_ib */
        .emit_ib = sdma_v5_0_ring_emit_ib,

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#14 lore raw

PATCH 1/1 drm/amdgpu: GFX10: GRBM requires 1-cycle delay (v2)

In reply to a message not in the archive

The GRBM interface is now capable of bursting 1-cycle op per register, a WRITE followed by another WRITE, or a WRITE followed by a READ--much faster than previous muti-cycle per completed-transaction interface. This causes a problem, whereby status registers requiring a read/write by hardware, have a 1-cycle delay, due to the register update having to go through GRBM interface.

This patch adds this delay.

A one cycle read op is added after updating the invalidate request and before reading the invalidate-ACK status.

See also commit 534991731cb5fa94b5519957646cf849ca10d17d.

v2: Remove GFX9 and apply only to SDMA ring.

---
 drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 7 +++++++
 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +7 -0
index 6e1b25bd1fe7..dedd7e1ab2fb 100644
@@ -346,6 +346,13 @@ static uint64_t gmc_v10_0_emit_flush_gpu_tlb(struct amdgpu_ring *ring,
 
 	amdgpu_ring_emit_wreg(ring, hub->vm_inv_eng0_req + eng, req);
 
+	/* Insert a dummy read to delay one cycle after the write REQ,
+	 * and before the ACK inquiry.
+	 */
+	if (ring->funcs->type == AMDGPU_RING_TYPE_SDMA)
+		amdgpu_ring_emit_reg_wait(ring,
+					  hub->vm_inv_eng0_req + eng, 0, 0);
+
 	/* wait for the invalidate to complete */
 	amdgpu_ring_emit_reg_wait(ring, hub->vm_inv_eng0_ack + eng,
 				  1 << vmid, 1 << vmid);
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +1 -1
index b8fdb192f6d6..0c41b4fdc58b 100644
@@ -1588,7 +1588,7 @@ static const struct amdgpu_ring_funcs sdma_v5_0_ring_funcs = {
 		6 + /* sdma_v5_0_ring_emit_pipeline_sync */
 		/* sdma_v5_0_ring_emit_vm_flush */
 		SOC15_FLUSH_GPU_TLB_NUM_WREG * 3 +
-		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 6 +
+		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 6 * 2 +
 		10 + 10 + 10, /* sdma_v5_0_ring_emit_fence x3 for user fence, vm fence */
 	.emit_ib_size = 7 + 6, /* sdma_v5_0_ring_emit_ib */
 	.emit_ib = sdma_v5_0_ring_emit_ib,
Signature · 6 lines
2.23.0.385.gbc12974a89

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

#16 lore raw

Re: [PATCH] drm/amdgpu: GFX10: GRBM requires 1-cycle delay (v2)

Am 26.10.19 um 00:59 schrieb Tuikov, Luben:

Quoted 35 lines

The GRBM interface is now capable of bursting 1-cycle op per register, a WRITE followed by another WRITE, or a WRITE followed by a READ--much faster than previous muti-cycle per completed-transaction interface. This causes a problem, whereby status registers requiring a read/write by hardware, have a 1-cycle delay, due to the register update having to go through GRBM interface.

This patch adds this delay.

A one cycle read op is added after updating the invalidate request and before reading the invalidate-ACK status.

See also commit 534991731cb5fa94b5519957646cf849ca10d17d.

v2: Remove GFX9 and apply only to SDMA ring.

---
  drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 7 +++++++
  drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 2 +-
  2 files changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0 -0
index 6e1b25bd1fe7..dedd7e1ab2fb 100644
@@ -346,6 +346,13 @@ static uint64_t gmc_v10_0_emit_flush_gpu_tlb(struct amdgpu_ring *ring,
 
  	amdgpu_ring_emit_wreg(ring, hub->vm_inv_eng0_req + eng, req);
 

drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c static uint64_t gmc_v10_0_emit_flush_gpu_tlb(struct amdgpu_ring *ring, · line 358

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +7 -0
+	/* Insert a dummy read to delay one cycle after the write REQ,
+	 * and before the ACK inquiry.
+	 */
+	if (ring->funcs->type == AMDGPU_RING_TYPE_SDMA)
+		amdgpu_ring_emit_reg_wait(ring,
+					  hub->vm_inv_eng0_req + eng, 0, 0);
+
  	/* wait for the invalidate to complete */
  	amdgpu_ring_emit_reg_wait(ring, hub->vm_inv_eng0_ack + eng,
  				  1 << vmid, 1 << vmid);

Looks like we indeed doesn't use the integrated write/wait CP command on Navi.

Anyway that is a completely separate issue, this patch is Reviewed-by:
Christian König <[email protected]>

Regards,
Christian.

drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c static const struct amdgpu_ring_funcs sdma_v5_0_ring_funcs = { · line 1594

Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +1 -1
index b8fdb192f6d6..0c41b4fdc58b 100644
@@ -1588,7 +1588,7 @@ static const struct amdgpu_ring_funcs sdma_v5_0_ring_funcs = {
  		6 + /* sdma_v5_0_ring_emit_pipeline_sync */
  		/* sdma_v5_0_ring_emit_vm_flush */
  		SOC15_FLUSH_GPU_TLB_NUM_WREG * 3 +
-		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 6 +
+		SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 6 * 2 +
  		10 + 10 + 10, /* sdma_v5_0_ring_emit_fence x3 for user fence, vm fence */
  	.emit_ib_size = 7 + 6, /* sdma_v5_0_ring_emit_ib */
  	.emit_ib = sdma_v5_0_ring_emit_ib,

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx