[Intel-xe] [PATCH v4 29/31] drm/xe: Update query uapi to support standalone media

Welty, Brian brian.welty at intel.com
Thu Jun 1 00:34:48 UTC 2023



On 5/31/2023 5:04 PM, Matt Roper wrote:
> Now that a higher GT count can result from either multiple tiles (with
> one GT each) or an extra media GT within the root tile, we need to
> update the query code slightly to stop looking at tile_count.
> 
> FIXME: As noted previously, we need to decide on a formal direction for
> exposing tiles and/or GTs to userspace.
> 
> v2:
>   - Drop num_gt() function in favor of stored xe->info.gt_count.  (Brian)
> 
> Cc: Brian Welty <brian.welty at intel.com>
> Signed-off-by: Matt Roper <matthew.d.roper at intel.com>
> ---
>   drivers/gpu/drm/xe/xe_query.c | 14 ++++++--------
>   1 file changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_query.c b/drivers/gpu/drm/xe/xe_query.c
> index 8087c94dd782..a47b0da5ef5c 100644
> --- a/drivers/gpu/drm/xe/xe_query.c
> +++ b/drivers/gpu/drm/xe/xe_query.c
> @@ -192,7 +192,7 @@ static int query_config(struct xe_device *xe, struct drm_xe_device_query *query)
>   		xe->info.vram_flags & XE_VRAM_FLAGS_NEED64K ? SZ_64K : SZ_4K;
>   	config->info[XE_QUERY_CONFIG_VA_BITS] = 12 +
>   		(9 * (xe->info.vm_max_level + 1));
> -	config->info[XE_QUERY_CONFIG_GT_COUNT] = xe->info.tile_count;
> +	config->info[XE_QUERY_CONFIG_GT_COUNT] = xe->info.gt_count;
>   	config->info[XE_QUERY_CONFIG_MEM_REGION_COUNT] =
>   		hweight_long(xe->info.mem_region_mask);
>   	config->info[XE_QUERY_CONFIG_MAX_ENGINE_PRIORITY] =
> @@ -211,7 +211,7 @@ static int query_gts(struct xe_device *xe, struct drm_xe_device_query *query)
>   {
>   	struct xe_gt *gt;
>   	size_t size = sizeof(struct drm_xe_query_gts) +
> -		xe->info.tile_count * sizeof(struct drm_xe_query_gt);
> +		xe->info.gt_count * sizeof(struct drm_xe_query_gt);
>   	struct drm_xe_query_gts __user *query_ptr =
>   		u64_to_user_ptr(query->data);
>   	struct drm_xe_query_gts *gts;
> @@ -228,14 +228,12 @@ static int query_gts(struct xe_device *xe, struct drm_xe_device_query *query)
>   	if (XE_IOCTL_ERR(xe, !gts))
>   		return -ENOMEM;
>   
> -	gts->num_gt = xe->info.tile_count;
> +	gts->num_gt = xe->info.gt_count;
>   	for_each_gt(gt, xe, id) {
> -		if (id == 0)
> -			gts->gts[id].type = XE_QUERY_GT_TYPE_MAIN;
> -		else if (xe_gt_is_media_type(gt))
> +		if (xe_gt_is_media_type(gt))
>   			gts->gts[id].type = XE_QUERY_GT_TYPE_MEDIA;
>   		else
> -			gts->gts[id].type = XE_QUERY_GT_TYPE_REMOTE;
> +			gts->gts[id].type = XE_QUERY_GT_TYPE_MAIN;

For multi-tile device:
It seems before GT_TYPE_MAIN was set for root_tile, and GT_TYPE_REMOTE
for second tile.  Is it okay to now set both to TYPE_MAIN?
Was it important to differentiate these before?  I don't know the 
history here.

At least should mention in commit message that XE_QUERY_GT_TYPE_REMOTE 
is no longer used.

Or maybe you should include pruning this out of the query api in your 
earlier patch:
"drm/xe: Drop extra_gts[] declarations and XE_GT_TYPE_REMOTE"  ?

-Brian

>   		gts->gts[id].instance = id;
>   		gts->gts[id].clock_freq = gt->info.clock_freq;
>   		if (!IS_DGFX(xe))
> @@ -290,7 +288,7 @@ static int query_hwconfig(struct xe_device *xe,
>   
>   static size_t calc_topo_query_size(struct xe_device *xe)
>   {
> -	return xe->info.tile_count *
> +	return xe->info.gt_count *
>   		(3 * sizeof(struct drm_xe_query_topology_mask) +
>   		 sizeof_field(struct xe_gt, fuse_topo.g_dss_mask) +
>   		 sizeof_field(struct xe_gt, fuse_topo.c_dss_mask) +


More information about the Intel-xe mailing list