if (ttm_manager_type(&xe->ttm, i))
num_managers++;
- return offsetof(struct drm_xe_query_mem_regions, regions[num_managers]);
+ return offsetof(struct drm_xe_query_mem_regions, mem_regions[num_managers]);
}
static int query_mem_regions(struct xe_device *xe,
- struct drm_xe_device_query *query)
+ struct drm_xe_device_query *query)
{
size_t size = calc_mem_regions_size(xe);
- struct drm_xe_query_mem_regions *usage;
+ struct drm_xe_query_mem_regions *mem_regions;
struct drm_xe_query_mem_regions __user *query_ptr =
u64_to_user_ptr(query->data);
struct ttm_resource_manager *man;
return -EINVAL;
}
- usage = kzalloc(size, GFP_KERNEL);
- if (XE_IOCTL_DBG(xe, !usage))
+ mem_regions = kzalloc(size, GFP_KERNEL);
+ if (XE_IOCTL_DBG(xe, !mem_regions))
return -ENOMEM;
man = ttm_manager_type(&xe->ttm, XE_PL_TT);
- usage->regions[0].mem_class = DRM_XE_MEM_REGION_CLASS_SYSMEM;
- usage->regions[0].instance = 0;
- usage->regions[0].min_page_size = PAGE_SIZE;
- usage->regions[0].total_size = man->size << PAGE_SHIFT;
+ mem_regions->mem_regions[0].mem_class = DRM_XE_MEM_REGION_CLASS_SYSMEM;
+ mem_regions->mem_regions[0].instance = 0;
+ mem_regions->mem_regions[0].min_page_size = PAGE_SIZE;
+ mem_regions->mem_regions[0].total_size = man->size << PAGE_SHIFT;
if (perfmon_capable())
- usage->regions[0].used = ttm_resource_manager_usage(man);
- usage->num_regions = 1;
+ mem_regions->mem_regions[0].used = ttm_resource_manager_usage(man);
+ mem_regions->num_mem_regions = 1;
for (i = XE_PL_VRAM0; i <= XE_PL_VRAM1; ++i) {
man = ttm_manager_type(&xe->ttm, i);
if (man) {
- usage->regions[usage->num_regions].mem_class =
+ mem_regions->mem_regions[mem_regions->num_mem_regions].mem_class =
DRM_XE_MEM_REGION_CLASS_VRAM;
- usage->regions[usage->num_regions].instance =
- usage->num_regions;
- usage->regions[usage->num_regions].min_page_size =
+ mem_regions->mem_regions[mem_regions->num_mem_regions].instance =
+ mem_regions->num_mem_regions;
+ mem_regions->mem_regions[mem_regions->num_mem_regions].min_page_size =
xe->info.vram_flags & XE_VRAM_FLAGS_NEED64K ?
SZ_64K : PAGE_SIZE;
- usage->regions[usage->num_regions].total_size =
+ mem_regions->mem_regions[mem_regions->num_mem_regions].total_size =
man->size;
if (perfmon_capable()) {
xe_ttm_vram_get_used(man,
- &usage->regions[usage->num_regions].used,
- &usage->regions[usage->num_regions].cpu_visible_used);
+ &mem_regions->mem_regions
+ [mem_regions->num_mem_regions].used,
+ &mem_regions->mem_regions
+ [mem_regions->num_mem_regions].cpu_visible_used);
}
- usage->regions[usage->num_regions].cpu_visible_size =
+ mem_regions->mem_regions[mem_regions->num_mem_regions].cpu_visible_size =
xe_ttm_vram_get_cpu_visible_size(man);
- usage->num_regions++;
+ mem_regions->num_mem_regions++;
}
}
- if (!copy_to_user(query_ptr, usage, size))
+ if (!copy_to_user(query_ptr, mem_regions, size))
ret = 0;
else
ret = -ENOSPC;
- kfree(usage);
+ kfree(mem_regions);
return ret;
}
};
/**
- * struct drm_xe_query_mem_region - Describes some region as known to
+ * struct drm_xe_mem_region - Describes some region as known to
* the driver.
*/
-struct drm_xe_query_mem_region {
+struct drm_xe_mem_region {
/**
* @mem_class: The memory class describing this region.
*
* struct drm_xe_query_mem_regions in .data.
*/
struct drm_xe_query_mem_regions {
- /** @num_regions: number of memory regions returned in @regions */
- __u32 num_regions;
+ /** @num_mem_regions: number of memory regions returned in @mem_regions */
+ __u32 num_mem_regions;
/** @pad: MBZ */
__u32 pad;
- /** @regions: The returned regions for this device */
- struct drm_xe_query_mem_region regions[];
+ /** @mem_regions: The returned memory regions for this device */
+ struct drm_xe_mem_region mem_regions[];
};
/**