Skip to contentSkip to conversation

drm/amdgpu/vpe: correct queue stop programing

PATCH In review Lang Yu 2 participants 2 messages Oct 23, 2023

Subsystems (2)
lore
Share & tools
lore

Lang Yu

author
#0 lore raw

PATCH 1/1 drm/amdgpu/vpe: correct queue stop programing

IB test would fail if not stop queue correctly.

---
 drivers/gpu/drm/amd/amdgpu/vpe_v6_1.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/vpe_v6_1.c +10 -8
index 756f39348dd9..174f13eff575 100644
@@ -205,19 +205,21 @@ static int vpe_v6_1_ring_start(struct amdgpu_vpe *vpe)
 static int vpe_v_6_1_ring_stop(struct amdgpu_vpe *vpe)
 {
 	struct amdgpu_device *adev = vpe->ring.adev;
-	uint32_t rb_cntl, ib_cntl;
+	uint32_t queue_reset;
+	int ret;
 
-	rb_cntl = RREG32(vpe_get_reg_offset(vpe, 0, regVPEC_QUEUE0_RB_CNTL));
-	rb_cntl = REG_SET_FIELD(rb_cntl, VPEC_QUEUE0_RB_CNTL, RB_ENABLE, 0);
-	WREG32(vpe_get_reg_offset(vpe, 0, regVPEC_QUEUE0_RB_CNTL), rb_cntl);
+	queue_reset = RREG32(vpe_get_reg_offset(vpe, 0, regVPEC_QUEUE_RESET_REQ));
+	queue_reset = REG_SET_FIELD(queue_reset, VPEC_QUEUE_RESET_REQ, QUEUE0_RESET, 1);
+	WREG32(vpe_get_reg_offset(vpe, 0, regVPEC_QUEUE_RESET_REQ), queue_reset);
 
-	ib_cntl = RREG32(vpe_get_reg_offset(vpe, 0, regVPEC_QUEUE0_IB_CNTL));
-	ib_cntl = REG_SET_FIELD(ib_cntl, VPEC_QUEUE0_IB_CNTL, IB_ENABLE, 0);
-	WREG32(vpe_get_reg_offset(vpe, 0, regVPEC_QUEUE0_IB_CNTL), ib_cntl);
+	ret = SOC15_WAIT_ON_RREG(VPE, 0, regVPEC_QUEUE_RESET_REQ, 0,
+				 VPEC_QUEUE_RESET_REQ__QUEUE0_RESET_MASK);
+	if (ret)
+		dev_err(adev->dev, "VPE queue reset failed\n");
 
 	vpe->ring.sched.ready = false;
 
-	return 0;
+	return ret;
 }
 
 static int vpe_v6_1_set_trap_irq_state(struct amdgpu_device *adev,
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only - General]

This patch is:

Best Regards,
Yifan

-----Original Message-----
From: Yu, Lang <[email protected]>
Sent: Monday, October 23, 2023 5:25 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Zhang, Yifan <[email protected]>; Chiu, Solomon <[email protected]>; Yu, Lang <[email protected]>
Subject: [PATCH] drm/amdgpu/vpe: correct queue stop programing

IB test would fail if not stop queue correctly.

---
 drivers/gpu/drm/amd/amdgpu/vpe_v6_1.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/vpe_v6_1.c +11 -9
index 756f39348dd9..174f13eff575 100644
@@ -205,19 +205,21 @@ static int vpe_v6_1_ring_start(struct amdgpu_vpe *vpe)  static int vpe_v_6_1_ring_stop(struct amdgpu_vpe *vpe)  {
        struct amdgpu_device *adev = vpe->ring.adev;
-       uint32_t rb_cntl, ib_cntl;
+       uint32_t queue_reset;
+       int ret;
 
-       rb_cntl = RREG32(vpe_get_reg_offset(vpe, 0, regVPEC_QUEUE0_RB_CNTL));
-       rb_cntl = REG_SET_FIELD(rb_cntl, VPEC_QUEUE0_RB_CNTL, RB_ENABLE, 0);
-       WREG32(vpe_get_reg_offset(vpe, 0, regVPEC_QUEUE0_RB_CNTL), rb_cntl);
+       queue_reset = RREG32(vpe_get_reg_offset(vpe, 0, regVPEC_QUEUE_RESET_REQ));
+       queue_reset = REG_SET_FIELD(queue_reset, VPEC_QUEUE_RESET_REQ, QUEUE0_RESET, 1);
+       WREG32(vpe_get_reg_offset(vpe, 0, regVPEC_QUEUE_RESET_REQ),
+queue_reset);
 
-       ib_cntl = RREG32(vpe_get_reg_offset(vpe, 0, regVPEC_QUEUE0_IB_CNTL));
-       ib_cntl = REG_SET_FIELD(ib_cntl, VPEC_QUEUE0_IB_CNTL, IB_ENABLE, 0);
-       WREG32(vpe_get_reg_offset(vpe, 0, regVPEC_QUEUE0_IB_CNTL), ib_cntl);
+       ret = SOC15_WAIT_ON_RREG(VPE, 0, regVPEC_QUEUE_RESET_REQ, 0,
+                                VPEC_QUEUE_RESET_REQ__QUEUE0_RESET_MASK);
+       if (ret)
+               dev_err(adev->dev, "VPE queue reset failed\n");
 
        vpe->ring.sched.ready = false;
 
-       return 0;
+       return ret;
 }
 
 static int vpe_v6_1_set_trap_irq_state(struct amdgpu_device *adev,
--

2.25.1