[Intel-xe] [PATCH v2 07/50] drm/xe: Remove useless query config num_params

Francois Dugast francois.dugast at intel.com
Tue Nov 7 15:49:12 UTC 2023


This will be updated to remove XE_QUERY_CONFIG_NUM_PARAM from the
uAPI but to keep num_params in order to make it easier for UMDs
to verify info[] index is in range when using an older kernel.

Francois

On Fri, Nov 03, 2023 at 02:34:13PM +0000, Francois Dugast wrote:
> num_params is only used to represent the number of query types.
> Removing it as it is useless and should not be used.
> 
> Signed-off-by: Francois Dugast <francois.dugast at intel.com>
> ---
>  drivers/gpu/drm/xe/xe_query.c | 6 +++---
>  include/uapi/drm/xe_drm.h     | 7 -------
>  2 files changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_query.c b/drivers/gpu/drm/xe/xe_query.c
> index a7f34669bb9a..0dc72668f560 100644
> --- a/drivers/gpu/drm/xe/xe_query.c
> +++ b/drivers/gpu/drm/xe/xe_query.c
> @@ -305,9 +305,10 @@ static int query_memory_usage(struct xe_device *xe,
>  
>  static int query_config(struct xe_device *xe, struct drm_xe_device_query *query)
>  {
> -	u32 num_params = XE_QUERY_CONFIG_NUM_PARAM;
> +#define XE_QUERY_CONFIG_NUM_PARAM	(XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY + 1)
>  	size_t size =
> -		sizeof(struct drm_xe_query_config) + num_params * sizeof(u64);
> +		sizeof(struct drm_xe_query_config)
> +		+ XE_QUERY_CONFIG_NUM_PARAM * sizeof(u64);
>  	struct drm_xe_query_config __user *query_ptr =
>  		u64_to_user_ptr(query->data);
>  	struct drm_xe_query_config *config;
> @@ -323,7 +324,6 @@ static int query_config(struct xe_device *xe, struct drm_xe_device_query *query)
>  	if (!config)
>  		return -ENOMEM;
>  
> -	config->num_params = num_params;
>  	config->info[XE_QUERY_CONFIG_REV_AND_DEVICE_ID] =
>  		xe->info.devid | (xe->info.revid << 16);
>  	if (xe_device_get_root_tile(xe)->mem.vram.usable_size)
> diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h
> index 67f96d44d509..0c106043827c 100644
> --- a/include/uapi/drm/xe_drm.h
> +++ b/include/uapi/drm/xe_drm.h
> @@ -315,9 +315,6 @@ struct drm_xe_query_mem_usage {
>   * struct drm_xe_query_config in .data.
>   */
>  struct drm_xe_query_config {
> -	/** @num_params: number of parameters returned in info */
> -	__u32 num_params;
> -
>  	/** @pad: MBZ */
>  	__u32 pad;
>  
> @@ -355,10 +352,6 @@ struct drm_xe_query_config {
>  	 * Value of the highest available exec queue priority
>  	 */
>  #define XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY	6
> -	/*
> -	 * Number of elements in the info array
> -	 */
> -#define XE_QUERY_CONFIG_NUM_PARAM		(XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY + 1)
>  	/** @info: array of elements containing the config info */
>  	__u64 info[];
>  };
> -- 
> 2.34.1
> 


More information about the Intel-xe mailing list