summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/amdgpu/aqua_vanjaram_reg_init.c
diff options
context:
space:
mode:
authorLijo Lazar <lijo.lazar@amd.com>2022-06-29 15:45:06 +0530
committerAlex Deucher <alexander.deucher@amd.com>2023-06-09 09:47:23 -0400
commitcab7d478da112e66f2ad8eec7dcfc0aa2a5babe1 (patch)
tree2726c60352440605920ce270c6e7db451f83c934 /drivers/gpu/drm/amd/amdgpu/aqua_vanjaram_reg_init.c
parent6df442a03d1a839242397259fa13168858c52413 (diff)
downloadlwn-cab7d478da112e66f2ad8eec7dcfc0aa2a5babe1.tar.gz
lwn-cab7d478da112e66f2ad8eec7dcfc0aa2a5babe1.zip
drm/amdgpu: Add IP instance map for aqua vanjaram
Add XCC logical to physical instance map for aqua vanjaram v2: Keep look up table only for required IPs, for others return default mapping (Felix). Signed-off-by: Lijo Lazar <lijo.lazar@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Reviewed-by: Le Ma <Le.Ma@amd.com> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/aqua_vanjaram_reg_init.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/aqua_vanjaram_reg_init.c39
1 files changed, 39 insertions, 0 deletions
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 3b97bc922d4a..dbff8220fc19 100644
--- a/drivers/gpu/drm/amd/amdgpu/aqua_vanjaram_reg_init.c
+++ b/drivers/gpu/drm/amd/amdgpu/aqua_vanjaram_reg_init.c
@@ -50,3 +50,42 @@ void aqua_vanjaram_doorbell_index_init(struct amdgpu_device *adev)
adev->doorbell_index.max_assignment = AMDGPU_DOORBELL_LAYOUT1_MAX_ASSIGNMENT << 1;
}
+
+static int8_t aqua_vanjaram_logical_to_dev_inst(struct amdgpu_device *adev,
+ enum amd_hw_ip_block_type block,
+ int8_t inst)
+{
+ int8_t dev_inst;
+
+ switch (block) {
+ case GC_HWIP:
+ dev_inst = adev->ip_map.dev_inst[block][inst];
+ break;
+ default:
+ /* For rest of the IPs, no look up required.
+ * Assume 'logical instance == physical instance' for all configs. */
+ dev_inst = inst;
+ break;
+ }
+
+ return dev_inst;
+}
+
+void aqua_vanjaram_ip_map_init(struct amdgpu_device *adev)
+{
+ int xcc_mask;
+ int l, i;
+
+ /* Map GC instances */
+ l = 0;
+ xcc_mask = adev->gfx.xcc_mask;
+ while (xcc_mask) {
+ i = ffs(xcc_mask) - 1;
+ adev->ip_map.dev_inst[GC_HWIP][l++] = i;
+ xcc_mask &= ~(1 << i);
+ }
+ for (; l < HWIP_MAX_INSTANCE; l++)
+ adev->ip_map.dev_inst[GC_HWIP][l] = -1;
+
+ adev->ip_map.logical_to_dev_inst = aqua_vanjaram_logical_to_dev_inst;
+}