[Public]

Reviewed-by: Prike Liang <[email protected]>

Regards,
      Prike

> -----Original Message-----
> From: amd-gfx <[email protected]> On Behalf Of Alex
> Deucher
> Sent: Saturday, October 11, 2025 5:15 AM
> To: [email protected]
> Cc: Deucher, Alexander <[email protected]>
> Subject: [PATCH 5/7] drm/amdgpu: Update AMDGPU_INFO_UQ_FW_AREAS
> query for compute
>
> Add a query for compute queues.  Userspace can use this to query the size of 
> the
> EOP buffers for compute user queues.
>
> Signed-off-by: Alex Deucher <[email protected]>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 26 +++++++++++++++++++++++++
>  include/uapi/drm/amdgpu_drm.h           |  8 ++++++++
>  2 files changed, 34 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> index a9327472c6514..f368bda40be41 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> @@ -391,6 +391,24 @@ static int amdgpu_userq_metadata_info_gfx(struct
> amdgpu_device *adev,
>       return ret;
>  }
>
> +static int amdgpu_userq_metadata_info_compute(struct amdgpu_device *adev,
> +                                           struct drm_amdgpu_info *info,
> +                                           struct
> drm_amdgpu_info_uq_metadata_compute *meta) {
> +     int ret = -EOPNOTSUPP;
> +
> +     if (adev->gfx.funcs->get_gfx_shadow_info) {
> +             struct amdgpu_gfx_shadow_info shadow = {};
> +
> +             adev->gfx.funcs->get_gfx_shadow_info(adev, &shadow, true);
> +             meta->eop_size = shadow.eop_size;
> +             meta->eop_alignment = shadow.eop_alignment;
> +             ret = 0;
> +     }
> +
> +     return ret;
> +}
> +
>  static int amdgpu_hw_ip_info(struct amdgpu_device *adev,
>                            struct drm_amdgpu_info *info,
>                            struct drm_amdgpu_info_hw_ip *result) @@ -1359,6
> +1377,14 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct
> drm_file *filp)
>                       if (ret)
>                               return ret;
>
> +                     ret = copy_to_user(out, &meta_info,
> +                                             min((size_t)size, 
> sizeof(meta_info))) ? -
> EFAULT : 0;
> +                     return 0;
> +             case AMDGPU_HW_IP_COMPUTE:
> +                     ret = amdgpu_userq_metadata_info_compute(adev, info,
> &meta_info.compute);
> +                     if (ret)
> +                             return ret;
> +
>                       ret = copy_to_user(out, &meta_info,
>                                               min((size_t)size, 
> sizeof(meta_info))) ? -
> EFAULT : 0;
>                       return 0;
> diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h 
> index
> e5252bf597b36..881e8cc986e2b 100644
> --- a/include/uapi/drm/amdgpu_drm.h
> +++ b/include/uapi/drm/amdgpu_drm.h
> @@ -1638,9 +1638,17 @@ struct drm_amdgpu_info_uq_metadata_gfx {
>       __u32 csa_alignment;
>  };
>
> +struct drm_amdgpu_info_uq_metadata_compute {
> +     /* EOP size for gfx11 */
> +     __u32 eop_size;
> +     /* EOP base virtual alignment for gfx11 */
> +     __u32 eop_alignment;
> +};
> +
>  struct drm_amdgpu_info_uq_metadata {
>       union {
>               struct drm_amdgpu_info_uq_metadata_gfx gfx;
> +             struct drm_amdgpu_info_uq_metadata_compute compute;
>       };
>  };
>
> --
> 2.51.0

Reply via email to