[Intel-xe] [PATCH v2 06/14] drm/xe/uapi: Align on a common way to return arrays (gt)

Rodrigo Vivi rodrigo.vivi at intel.com
Tue Nov 28 20:51:39 UTC 2023


On Wed, Nov 22, 2023 at 02:38:25PM +0000, Francois Dugast wrote:
> The uAPI provides queries which return arrays of elements. As of now
> the format used in the struct is different depending on which element
> is queried. However, aligning on the new common pattern:
> 
>     struct drm_xe_query_Xs {
>        __u32 num_Xs;
>        struct drm_xe_X Xs[];
>        ...
>     }
> 
> ... would mean bringing back the name "gts" which is avoided per
> commit ("drm/xe/uapi: Rename gts to gt_list") so make an exception
> for gt and leave gt_list. Also, this change removes "query" in the
> name of struct drm_xe_query_gt as it is not returned from the query
> IOCTL. There is no functional change.
> 
> v2: Leave gt_list (Matt Roper)
> 
> Signed-off-by: Francois Dugast <francois.dugast at intel.com>


Reviewed-by: Rodrigo Vivi <rodrigo.vivi at intel.com>

> ---
>  drivers/gpu/drm/xe/xe_query.c | 2 +-
>  include/uapi/drm/xe_drm.h     | 6 +++---
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_query.c b/drivers/gpu/drm/xe/xe_query.c
> index f321ed4d3b0b..28ea6dbf1cf9 100644
> --- a/drivers/gpu/drm/xe/xe_query.c
> +++ b/drivers/gpu/drm/xe/xe_query.c
> @@ -354,7 +354,7 @@ static int query_gt_list(struct xe_device *xe, struct drm_xe_device_query *query
>  {
>  	struct xe_gt *gt;
>  	size_t size = sizeof(struct drm_xe_query_gt_list) +
> -		xe->info.gt_count * sizeof(struct drm_xe_query_gt);
> +		xe->info.gt_count * sizeof(struct drm_xe_gt);
>  	struct drm_xe_query_gt_list __user *query_ptr =
>  		u64_to_user_ptr(query->data);
>  	struct drm_xe_query_gt_list *gt_list;
> diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h
> index a9bbdf141fe2..e38e7b701edf 100644
> --- a/include/uapi/drm/xe_drm.h
> +++ b/include/uapi/drm/xe_drm.h
> @@ -356,14 +356,14 @@ struct drm_xe_query_config {
>  };
>  
>  /**
> - * struct drm_xe_query_gt - describe an individual GT.
> + * struct drm_xe_gt - describe an individual GT.
>   *
>   * To be used with drm_xe_query_gt_list, which will return a list with all the
>   * existing GT individual descriptions.
>   * Graphics Technology (GT) is a subset of a GPU/tile that is responsible for
>   * implementing graphics and/or media operations.
>   */
> -struct drm_xe_query_gt {
> +struct drm_xe_gt {
>  #define DRM_XE_QUERY_GT_TYPE_MAIN		0
>  #define DRM_XE_QUERY_GT_TYPE_MEDIA		1
>  	/** @type: GT type: Main or Media */
> @@ -403,7 +403,7 @@ struct drm_xe_query_gt_list {
>  	/** @pad: MBZ */
>  	__u32 pad;
>  	/** @gt_list: The GT list returned for this device */
> -	struct drm_xe_query_gt gt_list[];
> +	struct drm_xe_gt gt_list[];
>  };
>  
>  /**
> -- 
> 2.34.1
> 


More information about the Intel-xe mailing list