drm/amdgpu/sdma: use per-ctx sdma csa address for mes sdma queue
authorJack Xiao <Jack.Xiao@amd.com>
Sun, 22 Mar 2020 05:31:52 +0000 (13:31 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 4 May 2022 14:43:49 +0000 (10:43 -0400)
Use per context sdma csa address for mes sdma queue.

Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c

index e1835fd..8e221a1 100644 (file)
@@ -74,14 +74,22 @@ uint64_t amdgpu_sdma_get_csa_mc_addr(struct amdgpu_ring *ring,
        if (amdgpu_sriov_vf(adev) || vmid == 0 || !amdgpu_mcbp)
                return 0;
 
-       r = amdgpu_sdma_get_index_from_ring(ring, &index);
-
-       if (r || index > 31)
-               csa_mc_addr = 0;
-       else
-               csa_mc_addr = amdgpu_csa_vaddr(adev) +
-                       AMDGPU_CSA_SDMA_OFFSET +
-                       index * AMDGPU_CSA_SDMA_SIZE;
+       if (ring->is_mes_queue) {
+               uint32_t offset = 0;
+
+               offset = offsetof(struct amdgpu_mes_ctx_meta_data,
+                                 sdma[ring->idx].sdma_meta_data);
+               csa_mc_addr = amdgpu_mes_ctx_get_offs_gpu_addr(ring, offset);
+       } else {
+               r = amdgpu_sdma_get_index_from_ring(ring, &index);
+
+               if (r || index > 31)
+                       csa_mc_addr = 0;
+               else
+                       csa_mc_addr = amdgpu_csa_vaddr(adev) +
+                               AMDGPU_CSA_SDMA_OFFSET +
+                               index * AMDGPU_CSA_SDMA_SIZE;
+       }
 
        return csa_mc_addr;
 }