Skip to contentSkip to conversation

drm/amdgpu/vce4: workaround multi vce engine encoding hang issue

PATCH NAK Xiangliang Yu 2 participants 3 messages Apr 9, 2017 – Apr 10, 2017 2 messages not in the archive

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

PATCH 3/5 drm/amdgpu/vce4: workaround multi vce engine encoding hang issue

For SRIOV, multi vce engine will hang when encoding. Add VMHUB flush to workaround it, will continue to find the root cause later.

---
 drivers/gpu/drm/amd/amdgpu/vce_v4_0.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/gpu/drm/amd/amdgpu/vce_v4_0.c +11 -0
index d3448d0..b4e36f3 100644
@@ -31,6 +31,7 @@
 #include "soc15d.h"
 #include "soc15_common.h"
 #include "mmsch_v1_0.h"
+#include "gmc_v9_0.h"
 
 #include "vega10/soc15ip.h"
 #include "vega10/VCE/vce_4_0_offset.h"
@@ -971,6 +972,7 @@ static void vce_v4_0_emit_vm_flush(struct amdgpu_ring *ring,
 	uint32_t req = ring->adev->gart.gart_funcs->get_invalidate_req(vm_id);
 	unsigned eng = ring->idx;
 	unsigned i;
+	struct amdgpu_device *adev = ring->adev;
 
 	pd_addr = pd_addr | 0x1; /* valid bit */
 	/* now only use physical base address of PDE and valid */
@@ -979,6 +981,15 @@ static void vce_v4_0_emit_vm_flush(struct amdgpu_ring *ring,
 	for (i = 0; i < AMDGPU_MAX_VMHUBS; ++i) {
 		struct amdgpu_vmhub *hub = &ring->adev->vmhub[i];
 
+		/* Workaround multi vce engine encoding hang issue */
+		if (i && amdgpu_sriov_vf(adev)) {
+			WREG32_NO_KIQ(hub->ctx0_ptb_addr_lo32 + vm_id * 2,
+				      lower_32_bits(pd_addr));
+			WREG32_NO_KIQ(hub->ctx0_ptb_addr_hi32 + vm_id * 2,
+				      upper_32_bits(pd_addr));
+			gmc_v9_0_flush_vmhub(adev, hub, eng, vm_id);
+		}
+
 		amdgpu_ring_write(ring, VCE_CMD_REG_WRITE);
 		amdgpu_ring_write(ring,
 			(hub->ctx0_ptb_addr_hi32 + vm_id * 2) << 2);
Signature · 6 lines
2.7.4

_______________________________________________
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): 1491741075-23827-1-git-send-email-Xiangliang.Yu-5C7GfCeVMHo@public.gmane.org

#2 lore raw

Am 09.04.2017 um 14:31 schrieb Xiangliang Yu:

Quoted 2 lines

For SRIOV, multi vce engine will hang when encoding. Add VMHUB flush to workaround it, will continue to find the root cause later.

NAK, that won't work and can cause hangs as well.

The hang you experience could be a known issue with old libdrm, do you have updated to the latest version?

Regards,
Christian.

Quoted 33 lines
---
  drivers/gpu/drm/amd/amdgpu/vce_v4_0.c | 11 +++++++++++
  1 file changed, 11 insertions(+)
drivers/gpu/drm/amd/amdgpu/vce_v4_0.c +4 -0
index d3448d0..b4e36f3 100644
@@ -31,6 +31,7 @@
  #include "soc15d.h"
  #include "soc15_common.h"
  #include "mmsch_v1_0.h"
+#include "gmc_v9_0.h"
 
  #include "vega10/soc15ip.h"
  #include "vega10/VCE/vce_4_0_offset.h"
@@ -971,6 +972,7 @@ static void vce_v4_0_emit_vm_flush(struct amdgpu_ring *ring,
  	uint32_t req = ring->adev->gart.gart_funcs->get_invalidate_req(vm_id);
  	unsigned eng = ring->idx;
  	unsigned i;
+	struct amdgpu_device *adev = ring->adev;
 
  	pd_addr = pd_addr | 0x1; /* valid bit */
  	/* now only use physical base address of PDE and valid */
@@ -979,6 +981,15 @@ static void vce_v4_0_emit_vm_flush(struct amdgpu_ring *ring,
  	for (i = 0; i < AMDGPU_MAX_VMHUBS; ++i) {
  		struct amdgpu_vmhub *hub = &ring->adev->vmhub[i];
 
+		/* Workaround multi vce engine encoding hang issue */
+		if (i && amdgpu_sriov_vf(adev)) {

drivers/gpu/drm/amd/amdgpu/vce_v4_0.c static void vce_v4_0_emit_vm_flush(struct amdgpu_ring *ring, · line 995

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/vce_v4_0.c +7 -0
+			WREG32_NO_KIQ(hub->ctx0_ptb_addr_lo32 + vm_id * 2,
+				      lower_32_bits(pd_addr));
+			WREG32_NO_KIQ(hub->ctx0_ptb_addr_hi32 + vm_id * 2,
+				      upper_32_bits(pd_addr));
+			gmc_v9_0_flush_vmhub(adev, hub, eng, vm_id);
+		}
+
  		amdgpu_ring_write(ring, VCE_CMD_REG_WRITE);
  		amdgpu_ring_write(ring,
  			(hub->ctx0_ptb_addr_hi32 + vm_id * 2) << 2);

_______________________________________________
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): 32fa467d-5df0-947a-f251-7636c3ae7235-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#4 lore raw
Quoted 8 lines

Am 09.04.2017 um 14:31 schrieb Xiangliang Yu:

Quoted 2 lines

For SRIOV, multi vce engine will hang when encoding. Add VMHUB flush to workaround it, will continue to find the root cause later.

NAK, that won't work and can cause hangs as well.

The hang you experience could be a known issue with old libdrm, do you have updated to the latest version?

Ok, I'll try it later.

Quoted 43 lines

drivers/gpu/drm/amd/amdgpu/vce_v4_0.c static void vce_v4_0_emit_vm_flush(struct

Quoted 22 lines
---
  drivers/gpu/drm/amd/amdgpu/vce_v4_0.c | 11 +++++++++++
  1 file changed, 11 insertions(+)
drivers/gpu/drm/amd/amdgpu/vce_v4_0.c +1 -0
index d3448d0..b4e36f3 100644
@@ -31,6 +31,7 @@
  #include "soc15d.h"
  #include "soc15_common.h"
  #include "mmsch_v1_0.h"
+#include "gmc_v9_0.h"
 
  #include "vega10/soc15ip.h"
  #include "vega10/VCE/vce_4_0_offset.h"
@@ -971,6 +972,7 @@ static void vce_v4_0_emit_vm_flush(struct

amdgpu_ring *ring,

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/vce_v4_0.c +1 -0
  	uint32_t req = ring->adev->gart.gart_funcs-
 get_invalidate_req(vm_id);
  	unsigned eng = ring->idx;
  	unsigned i;
+	struct amdgpu_device *adev = ring->adev;
 
  	pd_addr = pd_addr | 0x1; /* valid bit */

/* now only use physical base address of PDE and valid */ @@ -979,6
+981,15 @@ static void vce_v4_0_emit_vm_flush(struct amdgpu_ring

*ring,

drivers/gpu/drm/amd/amdgpu/vce_v4_0.c static void vce_v4_0_emit_vm_flush(struct amdgpu_ring *ring,

Quoted 6 lines
  	for (i = 0; i < AMDGPU_MAX_VMHUBS; ++i) {
  		struct amdgpu_vmhub *hub = &ring->adev->vmhub[i];
drivers/gpu/drm/amd/amdgpu/vce_v4_0.c +3 -0
+		/* Workaround multi vce engine encoding hang issue */
+		if (i && amdgpu_sriov_vf(adev)) {
+			WREG32_NO_KIQ(hub->ctx0_ptb_addr_lo32 +

vm_id * 2,

drivers/gpu/drm/amd/amdgpu/vce_v4_0.c

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/vce_v4_0.c +2 -0
+				      lower_32_bits(pd_addr));
+			WREG32_NO_KIQ(hub->ctx0_ptb_addr_hi32 +

vm_id * 2,

Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/vce_v4_0.c static void vce_v4_0_emit_vm_flush(struct amdgpu_ring *ring, · line 995

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/vce_v4_0.c +4 -0
+				      upper_32_bits(pd_addr));
+			gmc_v9_0_flush_vmhub(adev, hub, eng, vm_id);
+		}
+
  		amdgpu_ring_write(ring, VCE_CMD_REG_WRITE);
  		amdgpu_ring_write(ring,
  			(hub->ctx0_ptb_addr_hi32 + vm_id * 2) << 2);

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