From: Likun Gao Date: Fri, 4 Jul 2025 02:45:40 +0000 (+0800) Subject: drm/amdgpu: support xcc harvest for ih translate X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c9908d9c988810ad6253a8a1f70cf1baa23facb2;p=thirdparty%2Fkernel%2Flinux.git drm/amdgpu: support xcc harvest for ih translate Support xcc harvest for ih translate to logic xcc. V2: Only check available instances Signed-off-by: Likun Gao Reviewed-by: Hawking Zhang Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c b/drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c index 2f94c44bd6e1..26f8394bdce4 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c @@ -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 = {