On Mon, Nov 16, 2026 at 11:21 AM Siwei He <[email protected]> wrote:
>
> Use logical XCC indices in AMDGPU_INFO_CU_BITMAP in no-partition
> fallback. Also, stop clamping inst_mask to AMDGPU_MAX_GC_INSTANCES.
> Reject with -EOPNOTSUPP so the caller can fall back.
>
> Signed-off-by: Siwei He <[email protected]>
Seems like this should be squashed into the first patch.
Alex
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 10 ++++++++--
> drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 5 +++--
> 2 files changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> index 7a0a1d5542ee..850de3be1659 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> @@ -2072,11 +2072,17 @@ int amdgpu_gfx_get_cu_bitmap(struct amdgpu_device
> *adev, u32 inst_mask,
> u32 num_se, num_sa, sh_mul, se, sa, n = 0;
> int xcc;
>
> - /* cu_info.bitmap[] only has AMDGPU_MAX_GC_INSTANCES slots */
> - inst_mask &= GENMASK(AMDGPU_MAX_GC_INSTANCES - 1, 0);
> if (!inst_mask)
> return -ENODEV;
>
> + /* cu_info.bitmap[] only has AMDGPU_MAX_GC_INSTANCES slots */
> + if (inst_mask & ~GENMASK(AMDGPU_MAX_GC_INSTANCES - 1, 0)) {
> + dev_warn_once(adev->dev,
> + "CU bitmap: %u XCCs exceeds %u slots\n",
> + hweight32(inst_mask), AMDGPU_MAX_GC_INSTANCES);
> + return -EOPNOTSUPP;
> + }
> +
> num_se = config->max_shader_engines;
> num_sa = config->max_sh_per_se;
> if (!num_se || !num_sa)
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> index a8ebc85c9b88..50943ec18b27 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> @@ -1469,10 +1469,11 @@ int amdgpu_info_ioctl(struct drm_device *dev, void
> *data, struct drm_file *filp)
> if (ret)
> return ret;
> } else {
> - inst_mask = adev->gfx.xcc_mask ? adev->gfx.xcc_mask :
> 1;
> + /* inst_mask is a logical mask */
> + inst_mask = adev->gfx.xcc_mask ?
> + GENMASK(NUM_XCC(adev->gfx.xcc_mask) - 1, 0) :
> 1;
> }
>
> - inst_mask &= GENMASK(AMDGPU_MAX_GC_INSTANCES - 1, 0);
> num_xcc = hweight32(inst_mask);
> num_se = adev->gfx.config.max_shader_engines;
> num_sa = adev->gfx.config.max_sh_per_se;
> --
> 2.43.0
>