[Intel-xe] [PATCH v1 5/8] drm/xe/uapi: Rename query's mem_usage to mem_regions

Souza, Jose jose.souza at intel.com
Thu Nov 16 15:34:29 UTC 2023


On Tue, 2023-11-14 at 13:34 +0000, Francois Dugast wrote:
> From: Rodrigo Vivi <rodrigo.vivi at intel.com>
> 
> 'Usage' gives an impression of telemetry information where someone
> would query to see how the memory is currently used and available
> size, etc. However this API is more than this. It is about a global
> view of all the memory regions available in the system and user
> space needs to have this information so they can then use the
> mem_region masks that are returned for the engine access.

Reviewed-by: José Roberto de Souza <jose.souza at intel.com>

> 
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
> Signed-off-by: Francois Dugast <francois.dugast at intel.com>
> ---
>  drivers/gpu/drm/xe/xe_query.c | 16 ++++++++--------
>  include/uapi/drm/xe_drm.h     | 14 +++++++-------
>  2 files changed, 15 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_query.c b/drivers/gpu/drm/xe/xe_query.c
> index 8b5136460ea6..d495716b2c96 100644
> --- a/drivers/gpu/drm/xe/xe_query.c
> +++ b/drivers/gpu/drm/xe/xe_query.c
> @@ -230,7 +230,7 @@ static int query_engines(struct xe_device *xe,
>  	return 0;
>  }
>  
> -static size_t calc_memory_usage_size(struct xe_device *xe)
> +static size_t calc_mem_regions_size(struct xe_device *xe)
>  {
>  	u32 num_managers = 1;
>  	int i;
> @@ -239,15 +239,15 @@ static size_t calc_memory_usage_size(struct xe_device *xe)
>  		if (ttm_manager_type(&xe->ttm, i))
>  			num_managers++;
>  
> -	return offsetof(struct drm_xe_query_mem_usage, regions[num_managers]);
> +	return offsetof(struct drm_xe_query_mem_regions, regions[num_managers]);
>  }
>  
> -static int query_memory_usage(struct xe_device *xe,
> -			      struct drm_xe_device_query *query)
> +static int query_mem_regions(struct xe_device *xe,
> +			     struct drm_xe_device_query *query)
>  {
> -	size_t size = calc_memory_usage_size(xe);
> -	struct drm_xe_query_mem_usage *usage;
> -	struct drm_xe_query_mem_usage __user *query_ptr =
> +	size_t size = calc_mem_regions_size(xe);
> +	struct drm_xe_query_mem_regions *usage;
> +	struct drm_xe_query_mem_regions __user *query_ptr =
>  		u64_to_user_ptr(query->data);
>  	struct ttm_resource_manager *man;
>  	int ret, i;
> @@ -499,7 +499,7 @@ static int query_gt_topology(struct xe_device *xe,
>  static int (* const xe_query_funcs[])(struct xe_device *xe,
>  				      struct drm_xe_device_query *query) = {
>  	query_engines,
> -	query_memory_usage,
> +	query_mem_regions,
>  	query_config,
>  	query_gt_list,
>  	query_hwconfig,
> diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h
> index fd51d4444119..c627e35bddb8 100644
> --- a/include/uapi/drm/xe_drm.h
> +++ b/include/uapi/drm/xe_drm.h
> @@ -291,13 +291,13 @@ struct drm_xe_query_engine_cycles {
>  };
>  
>  /**
> - * struct drm_xe_query_mem_usage - describe memory regions and usage
> + * struct drm_xe_query_mem_regions - describe memory regions
>   *
>   * If a query is made with a struct drm_xe_device_query where .query
> - * is equal to DRM_XE_DEVICE_QUERY_MEM_USAGE, then the reply uses
> - * struct drm_xe_query_mem_usage in .data.
> + * is equal to DRM_XE_DEVICE_QUERY_MEM_REGIONS, then the reply uses
> + * struct drm_xe_query_mem_regions in .data.
>   */
> -struct drm_xe_query_mem_usage {
> +struct drm_xe_query_mem_regions {
>  	/** @num_regions: number of memory regions returned in @regions */
>  	__u32 num_regions;
>  	/** @pad: MBZ */
> @@ -350,12 +350,12 @@ struct drm_xe_query_gt {
>  	__u32 clock_freq;
>  	/**
>  	 * @near_mem_regions: Bit mask of instances from
> -	 * drm_xe_query_mem_usage that is near the current engines of this GT.
> +	 * drm_xe_query_mem_regions that is near the current engines of this GT.
>  	 */
>  	__u64 near_mem_regions;
>  	/**
>  	 * @far_mem_regions: Bit mask of instances from
> -	 * drm_xe_query_mem_usage that is far from the engines of this GT.
> +	 * drm_xe_query_mem_regions that is far from the engines of this GT.
>  	 * In general, it has extra indirections when compared to the
>  	 * @near_mem_regions. For a discrete device this could mean system
>  	 * memory and memory living in a different Tile.
> @@ -469,7 +469,7 @@ struct drm_xe_device_query {
>  	__u64 extensions;
>  
>  #define DRM_XE_DEVICE_QUERY_ENGINES		0
> -#define DRM_XE_DEVICE_QUERY_MEM_USAGE		1
> +#define DRM_XE_DEVICE_QUERY_MEM_REGIONS		1
>  #define DRM_XE_DEVICE_QUERY_CONFIG		2
>  #define DRM_XE_DEVICE_QUERY_GT_LIST		3
>  #define DRM_XE_DEVICE_QUERY_HWCONFIG		4



More information about the Intel-xe mailing list