When examining the VCN function init, it is common to find a loop that
initializes VCN rings, which uses one IRQ per instance. However, VCN
4.0.3 deviates from this pattern, as it includes a distinct field to
differentiate instances, which results in a slightly different ring
init. This commit makes this difference explicit by using a fixed index
when initializing the ring buffer and also adds a comment.

Signed-off-by: Rodrigo Siqueira <sique...@igalia.com>
---
 drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c | 6 +++++-
 1 file changed, 5 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 7b93a275ec4f..bae1ad4484ed 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c
@@ -212,7 +212,11 @@ static int vcn_v4_0_3_sw_init(struct amdgpu_ip_block 
*ip_block)
 
                ring->vm_hub = AMDGPU_MMHUB0(adev->vcn.inst[i].aid_id);
                sprintf(ring->name, "vcn_unified_%d", adev->vcn.inst[i].aid_id);
-               r = amdgpu_ring_init(adev, ring, 512, &adev->vcn.inst->irq, 0,
+
+               /* There are no per-instance irq source IDs on 4.0.3, the IH
+                * packets use a separate field to differentiate instances.
+                */
+               r = amdgpu_ring_init(adev, ring, 512, &adev->vcn.inst[0].irq, 0,
                                     AMDGPU_RING_PRIO_DEFAULT,
                                     &adev->vcn.inst[i].sched_score);
                if (r)
-- 
2.47.2

Reply via email to