From: Lijo Lazar <lijo.lazar@xxxxxxx> For aqua vanjaram, add mapping for logical to physical instances. v2: Register accesses on bare metal should be based on physical instance. Use GET_INST() to get physical instance. Signed-off-by: Lijo Lazar <lijo.lazar@xxxxxxx> Reviewed-by: Hawking Zhang <Hawking.Zhang@xxxxxxx> Reviewed-by: Le Ma <Le.Ma@xxxxxxx> Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx> --- drivers/gpu/drm/amd/amdgpu/aqua_vanjaram_reg_init.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/aqua_vanjaram_reg_init.c b/drivers/gpu/drm/amd/amdgpu/aqua_vanjaram_reg_init.c index 5a1511a22367..12379c374457 100644 --- a/drivers/gpu/drm/amd/amdgpu/aqua_vanjaram_reg_init.c +++ b/drivers/gpu/drm/amd/amdgpu/aqua_vanjaram_reg_init.c @@ -59,6 +59,7 @@ static int8_t aqua_vanjaram_logical_to_dev_inst(struct amdgpu_device *adev, switch (block) { case GC_HWIP: + case SDMA0_HWIP: dev_inst = adev->ip_map.dev_inst[block][inst]; break; default: @@ -73,7 +74,7 @@ static int8_t aqua_vanjaram_logical_to_dev_inst(struct amdgpu_device *adev, void aqua_vanjaram_ip_map_init(struct amdgpu_device *adev) { - int xcc_mask; + int xcc_mask, sdma_mask; int l, i; /* Map GC instances */ @@ -87,5 +88,15 @@ void aqua_vanjaram_ip_map_init(struct amdgpu_device *adev) for (; l < HWIP_MAX_INSTANCE; l++) adev->ip_map.dev_inst[GC_HWIP][l] = -1; + l = 0; + sdma_mask = adev->sdma.sdma_mask; + while (sdma_mask) { + i = ffs(sdma_mask) - 1; + adev->ip_map.dev_inst[SDMA0_HWIP][l++] = i; + sdma_mask &= ~(1 << i); + } + for (; l < HWIP_MAX_INSTANCE; l++) + adev->ip_map.dev_inst[SDMA0_HWIP][l] = -1; + adev->ip_map.logical_to_dev_inst = aqua_vanjaram_logical_to_dev_inst; } -- 2.39.2