[PATCH 05/23] drm/amdgpu: Derive active clusters from SDMA

Alex Deucher alexander.deucher at amd.com
Thu Mar 30 19:42:16 UTC 2023


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

SDMA instances per active cluster and SDMA instance mask are used
to find the number of active clusters.

Signed-off-by: Lijo Lazar <lijo.lazar at amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang at amd.com>
Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/aqua_vanjaram_reg_init.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

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 a6204b588829..6f7226b5d446 100644
--- a/drivers/gpu/drm/amd/amdgpu/aqua_vanjaram_reg_init.c
+++ b/drivers/gpu/drm/amd/amdgpu/aqua_vanjaram_reg_init.c
@@ -357,12 +357,22 @@ static int aqua_vanjaram_xcp_mgr_init(struct amdgpu_device *adev)
 
 int aqua_vanjaram_init_soc_config(struct amdgpu_device *adev)
 {
+	u32 inst_mask = adev->sdma.sdma_mask;
 	int ret;
 
 	/* generally 1 AID supports 4 instances */
 	adev->sdma.num_inst_per_aid = 4;
 	adev->sdma.num_instances = NUM_SDMA(adev->sdma.sdma_mask);
 
+	adev->num_aid = 1;
+	inst_mask >>= adev->sdma.num_inst_per_aid;
+
+	for (const u32 mask = (1 << adev->sdma.num_inst_per_aid) - 1; inst_mask;
+	     inst_mask >>= adev->sdma.num_inst_per_aid) {
+		if ((inst_mask & mask) == mask)
+			adev->num_aid++;
+	}
+
 	adev->vcn.num_inst_per_aid = 1;
 	adev->vcn.num_vcn_inst = adev->vcn.num_inst_per_aid * adev->num_aid;
 	adev->jpeg.num_inst_per_aid = 1;
-- 
2.39.2



More information about the amd-gfx mailing list