]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amdgpu: support xcc harvest for ih translate
authorLikun Gao <Likun.Gao@amd.com>
Fri, 4 Jul 2025 02:45:40 +0000 (10:45 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 16 Dec 2025 18:28:55 +0000 (13:28 -0500)
Support xcc harvest for ih translate to logic xcc.
V2: Only check available instances

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c

index 2f94c44bd6e117cd35703c7058c8563f54667fe1..26f8394bdce4b448ca3d9cdc4bb6d7a7a66a7c7c 100644 (file)
@@ -700,14 +700,16 @@ static int gfx_v12_1_get_xccs_per_xcp(struct amdgpu_device *adev)
 
 static int gfx_v12_1_ih_to_xcc_inst(struct amdgpu_device *adev, int ih_node)
 {
+       int logic_xcc;
        int xcc = (ih_node & 0x7) - 2 + (ih_node >> 3) * 4;
 
-       if (xcc < 0 || xcc >= hweight8(adev->gfx.xcc_mask)) {
-               dev_err(adev->dev, "Couldn't find xcc mapping from IH node");
-               return -EINVAL;
+       for (logic_xcc = 0; logic_xcc < NUM_XCC(adev->gfx.xcc_mask); logic_xcc++) {
+               if (xcc == GET_INST(GC, logic_xcc))
+                       return logic_xcc;
        }
 
-       return xcc;
+       dev_err(adev->dev, "Couldn't find xcc mapping from IH node");
+       return -EINVAL;
 }
 
 static const struct amdgpu_gfx_funcs gfx_v12_1_gfx_funcs = {