[PATCH 4/5] drm/amdgpu: Use SDMA instance table for aqua vanjaram

Alex Deucher alexander.deucher at amd.com
Wed Mar 29 20:17:43 UTC 2023


From: Lijo Lazar <lijo.lazar at amd.com>

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 at amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang at amd.com>
Reviewed-by: Le Ma <Le.Ma at amd.com>
Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
---
 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



More information about the amd-gfx mailing list