[PATCH 2/4] drm/amdgpu/vcn: enable vcn doorbell for vcn4.0.3

Alex Deucher alexander.deucher at amd.com
Tue Mar 28 15:05:48 UTC 2023


From: James Zhu <James.Zhu at amd.com>

Enable vcn doorbell for vcn4.0.3.

Signed-off-by: James Zhu <James.Zhu at amd.com>
Reviewed-by: Leo Liu <leo.liu at amd.com>
Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c b/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c
index 98bff162f453..4418c9f05ec4 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c
@@ -109,7 +109,8 @@ static int vcn_v4_0_3_sw_init(void *handle)
 		return r;
 
 	ring = &adev->vcn.inst->ring_dec;
-	ring->use_doorbell = false;
+	ring->use_doorbell = true;
+	ring->doorbell_index = (adev->doorbell_index.vcn.vcn_ring0_1 << 1) + 5;
 	ring->vm_hub = AMDGPU_MMHUB0(0);
 	sprintf(ring->name, "vcn_dec");
 	r = amdgpu_ring_init(adev, ring, 512, &adev->vcn.inst->irq, 0,
@@ -174,6 +175,13 @@ static int vcn_v4_0_3_hw_init(void *handle)
 	struct amdgpu_ring *ring = &adev->vcn.inst->ring_dec;
 	int r;
 
+	adev->nbio.funcs->vcn_doorbell_range(adev, ring->use_doorbell,
+				ring->doorbell_index, ring->me);
+	if (ring->use_doorbell)
+		WREG32_SOC15(VCN, ring->me, regVCN_RB4_DB_CTRL,
+			ring->doorbell_index << VCN_RB4_DB_CTRL__OFFSET__SHIFT |
+			VCN_RB4_DB_CTRL__EN_MASK);
+
 	r = amdgpu_ring_test_helper(ring);
 
 	if (!r)
-- 
2.39.2



More information about the amd-gfx mailing list