Lines Matching +full:0 +full:xe
43 static size_t calc_hw_engine_info_size(struct xe_device *xe) in calc_hw_engine_info_size() argument
49 int i = 0; in calc_hw_engine_info_size()
51 for_each_gt(gt, xe, gt_id) in calc_hw_engine_info_size()
94 u32 upper, lower, old_upper, loop = 0; in __read_timestamps()
110 query_engine_cycles(struct xe_device *xe, in query_engine_cycles() argument
121 if (query->size == 0) { in query_engine_cycles()
123 return 0; in query_engine_cycles()
124 } else if (XE_IOCTL_DBG(xe, query->size != size)) { in query_engine_cycles()
140 gt = xe_device_get_gt(xe, eci->gt_id); in query_engine_cycles()
165 if (GRAPHICS_VER(xe) >= 20) in query_engine_cycles()
183 return 0; in query_engine_cycles()
186 static int query_engines(struct xe_device *xe, in query_engines() argument
189 size_t size = calc_hw_engine_info_size(xe); in query_engines()
197 int i = 0; in query_engines()
199 if (query->size == 0) { in query_engines()
201 return 0; in query_engines()
202 } else if (XE_IOCTL_DBG(xe, query->size != size)) { in query_engines()
210 for_each_gt(gt, xe, gt_id) in query_engines()
232 return 0; in query_engines()
235 static size_t calc_mem_regions_size(struct xe_device *xe) in calc_mem_regions_size() argument
241 if (ttm_manager_type(&xe->ttm, i)) in calc_mem_regions_size()
247 static int query_mem_regions(struct xe_device *xe, in query_mem_regions() argument
250 size_t size = calc_mem_regions_size(xe); in query_mem_regions()
257 if (query->size == 0) { in query_mem_regions()
259 return 0; in query_mem_regions()
260 } else if (XE_IOCTL_DBG(xe, query->size != size)) { in query_mem_regions()
265 if (XE_IOCTL_DBG(xe, !mem_regions)) in query_mem_regions()
268 man = ttm_manager_type(&xe->ttm, XE_PL_TT); in query_mem_regions()
269 mem_regions->mem_regions[0].mem_class = DRM_XE_MEM_REGION_CLASS_SYSMEM; in query_mem_regions()
275 mem_regions->mem_regions[0].instance = 0; in query_mem_regions()
276 mem_regions->mem_regions[0].min_page_size = PAGE_SIZE; in query_mem_regions()
277 mem_regions->mem_regions[0].total_size = man->size << PAGE_SHIFT; in query_mem_regions()
279 mem_regions->mem_regions[0].used = ttm_resource_manager_usage(man); in query_mem_regions()
283 man = ttm_manager_type(&xe->ttm, i); in query_mem_regions()
290 xe->info.vram_flags & XE_VRAM_FLAGS_NEED64K ? in query_mem_regions()
310 ret = 0; in query_mem_regions()
318 static int query_config(struct xe_device *xe, struct drm_xe_device_query *query) in query_config() argument
327 if (query->size == 0) { in query_config()
329 return 0; in query_config()
330 } else if (XE_IOCTL_DBG(xe, query->size != size)) { in query_config()
340 xe->info.devid | (xe->info.revid << 16); in query_config()
341 if (xe_device_get_root_tile(xe)->mem.vram.usable_size) in query_config()
345 xe->info.vram_flags & XE_VRAM_FLAGS_NEED64K ? SZ_64K : SZ_4K; in query_config()
346 config->info[DRM_XE_QUERY_CONFIG_VA_BITS] = xe->info.va_bits; in query_config()
348 xe_exec_queue_device_get_max_priority(xe); in query_config()
356 return 0; in query_config()
359 static int query_gt_list(struct xe_device *xe, struct drm_xe_device_query *query) in query_gt_list() argument
363 xe->info.gt_count * sizeof(struct drm_xe_gt); in query_gt_list()
369 if (query->size == 0) { in query_gt_list()
371 return 0; in query_gt_list()
372 } else if (XE_IOCTL_DBG(xe, query->size != size)) { in query_gt_list()
380 gt_list->num_gt = xe->info.gt_count; in query_gt_list()
382 for_each_gt(gt, xe, id) { in query_gt_list()
397 * Bit 0 -> System Memory in query_gt_list()
404 if (!IS_DGFX(xe)) in query_gt_list()
405 gt_list->gt_list[id].near_mem_regions = 0x1; in query_gt_list()
409 gt_list->gt_list[id].far_mem_regions = xe->info.mem_region_mask ^ in query_gt_list()
426 return 0; in query_gt_list()
429 static int query_hwconfig(struct xe_device *xe, in query_hwconfig() argument
432 struct xe_gt *gt = xe_root_mmio_gt(xe); in query_hwconfig()
437 if (query->size == 0) { in query_hwconfig()
439 return 0; in query_hwconfig()
440 } else if (XE_IOCTL_DBG(xe, query->size != size)) { in query_hwconfig()
456 return 0; in query_hwconfig()
459 static size_t calc_topo_query_size(struct xe_device *xe) in calc_topo_query_size() argument
461 return xe->info.gt_count * in calc_topo_query_size()
483 return 0; in copy_mask()
486 static int query_gt_topology(struct xe_device *xe, in query_gt_topology() argument
490 size_t size = calc_topo_query_size(xe); in query_gt_topology()
495 if (query->size == 0) { in query_gt_topology()
497 return 0; in query_gt_topology()
498 } else if (XE_IOCTL_DBG(xe, query->size != size)) { in query_gt_topology()
502 for_each_gt(gt, xe, id) { in query_gt_topology()
535 return 0; in query_gt_topology()
539 query_uc_fw_version(struct xe_device *xe, struct drm_xe_device_query *query) in query_uc_fw_version() argument
546 if (query->size == 0) { in query_uc_fw_version()
548 return 0; in query_uc_fw_version()
549 } else if (XE_IOCTL_DBG(xe, query->size != size)) { in query_uc_fw_version()
556 if (XE_IOCTL_DBG(xe, resp.pad || resp.pad2 || resp.reserved)) in query_uc_fw_version()
561 struct xe_guc *guc = &xe->tiles[0].primary_gt->uc.guc; in query_uc_fw_version()
570 if (MEDIA_VER(xe) >= 13) { in query_uc_fw_version()
574 for_each_tile(tile, xe, gt_id) { in query_uc_fw_version()
581 media_gt = xe->tiles[0].primary_gt; in query_uc_fw_version()
597 resp.branch_ver = 0; in query_uc_fw_version()
608 return 0; in query_uc_fw_version()
611 static size_t calc_oa_unit_query_size(struct xe_device *xe) in calc_oa_unit_query_size() argument
617 for_each_gt(gt, xe, id) { in calc_oa_unit_query_size()
618 for (i = 0; i < gt->oa.num_oa_units; i++) { in calc_oa_unit_query_size()
628 static int query_oa_units(struct xe_device *xe, in query_oa_units() argument
632 size_t size = calc_oa_unit_query_size(xe); in query_oa_units()
642 if (query->size == 0) { in query_oa_units()
644 return 0; in query_oa_units()
645 } else if (XE_IOCTL_DBG(xe, query->size != size)) { in query_oa_units()
653 pdu = (u8 *)&qoa->oa_units[0]; in query_oa_units()
654 for_each_gt(gt, xe, gt_id) { in query_oa_units()
655 for (i = 0; i < gt->oa.num_oa_units; i++) { in query_oa_units()
664 j = 0; in query_oa_units()
676 pdu += sizeof(*du) + j * sizeof(du->eci[0]); in query_oa_units()
684 return ret ? -EFAULT : 0; in query_oa_units()
687 static int (* const xe_query_funcs[])(struct xe_device *xe,
702 struct xe_device *xe = to_xe_device(dev); in xe_query_ioctl() local
706 if (XE_IOCTL_DBG(xe, query->extensions) || in xe_query_ioctl()
707 XE_IOCTL_DBG(xe, query->reserved[0] || query->reserved[1])) in xe_query_ioctl()
710 if (XE_IOCTL_DBG(xe, query->query >= ARRAY_SIZE(xe_query_funcs))) in xe_query_ioctl()
714 if (XE_IOCTL_DBG(xe, !xe_query_funcs[idx])) in xe_query_ioctl()
717 return xe_query_funcs[idx](xe, query); in xe_query_ioctl()