Lines Matching refs:guc
327 struct xe_guc *guc = >->uc.guc; in xe_guc_capture_get_reg_desc_list() local
329 reglists = guc->capture->extlists; in xe_guc_capture_get_reg_desc_list()
397 static void guc_capture_alloc_steered_lists(struct xe_guc *guc) in guc_capture_alloc_steered_lists() argument
399 struct xe_gt *gt = guc_to_gt(guc); in guc_capture_alloc_steered_lists()
402 const struct __guc_mmio_reg_descr_group *lists = guc->capture->reglists; in guc_capture_alloc_steered_lists()
437 if (!list || guc->capture->extlists) in guc_capture_alloc_steered_lists()
441 guc_capture_get_steer_reg_num(guc_to_xe(guc)); in guc_capture_alloc_steered_lists()
473 xe_gt_dbg(guc_to_gt(guc), "capture found %d ext-regs.\n", total); in guc_capture_alloc_steered_lists()
474 guc->capture->extlists = extlists; in guc_capture_alloc_steered_lists()
478 guc_capture_list_init(struct xe_guc *guc, u32 owner, u32 type, in guc_capture_list_init() argument
483 const struct __guc_mmio_reg_descr_group *reglists = guc->capture->reglists; in guc_capture_list_init()
484 struct __guc_mmio_reg_descr_group *extlists = guc->capture->extlists; in guc_capture_list_init()
515 xe_gt_dbg(guc_to_gt(guc), "Got short capture reglist init: %d out-of %d.\n", in guc_capture_list_init()
522 guc_cap_list_num_regs(struct xe_guc *guc, u32 owner, u32 type, in guc_cap_list_num_regs() argument
528 match = guc_capture_get_one_list(guc->capture->reglists, owner, type, capture_class); in guc_cap_list_num_regs()
532 match = guc_capture_get_one_list(guc->capture->extlists, owner, type, capture_class); in guc_cap_list_num_regs()
546 !guc->capture->max_mmio_per_node) in guc_cap_list_num_regs()
547 num_regs += guc_capture_get_steer_reg_num(guc_to_xe(guc)) * in guc_cap_list_num_regs()
554 guc_capture_getlistsize(struct xe_guc *guc, u32 owner, u32 type, in guc_capture_getlistsize() argument
558 struct xe_guc_state_capture *gc = guc->capture; in guc_capture_getlistsize()
559 struct xe_gt *gt = guc_to_gt(guc); in guc_capture_getlistsize()
588 num_regs = guc_cap_list_num_regs(guc, owner, type, capture_class); in guc_capture_getlistsize()
614 xe_guc_capture_getlistsize(struct xe_guc *guc, u32 owner, u32 type, in xe_guc_capture_getlistsize() argument
617 return guc_capture_getlistsize(guc, owner, type, capture_class, size, false); in xe_guc_capture_getlistsize()
635 xe_guc_capture_getlist(struct xe_guc *guc, u32 owner, u32 type, in xe_guc_capture_getlist() argument
638 struct xe_guc_state_capture *gc = guc->capture; in xe_guc_capture_getlist()
653 ret = xe_guc_capture_getlistsize(guc, owner, type, capture_class, &size); in xe_guc_capture_getlist()
662 caplist = drmm_kzalloc(guc_to_drm(guc), size, GFP_KERNEL); in xe_guc_capture_getlist()
668 num_regs = guc_cap_list_num_regs(guc, owner, type, capture_class); in xe_guc_capture_getlist()
674 guc_capture_list_init(guc, owner, type, capture_class, in xe_guc_capture_getlist()
699 xe_guc_capture_getnullheader(struct xe_guc *guc, void **outptr, size_t *size) in xe_guc_capture_getnullheader() argument
701 struct xe_guc_state_capture *gc = guc->capture; in xe_guc_capture_getnullheader()
711 null_header = drmm_kzalloc(guc_to_drm(guc), tmp, GFP_KERNEL); in xe_guc_capture_getnullheader()
730 size_t xe_guc_capture_ads_input_worst_size(struct xe_guc *guc) in xe_guc_capture_ads_input_worst_size() argument
745 if (xe_guc_capture_getlistsize(guc, i, in xe_guc_capture_ads_input_worst_size()
749 if (xe_guc_capture_getlistsize(guc, i, in xe_guc_capture_ads_input_worst_size()
755 if (xe_guc_capture_getlistsize(guc, i, in xe_guc_capture_ads_input_worst_size()
765 static int guc_capture_output_size_est(struct xe_guc *guc) in guc_capture_output_size_est() argument
767 struct xe_gt *gt = guc_to_gt(guc); in guc_capture_output_size_est()
774 if (!guc->capture) in guc_capture_output_size_est()
795 if (!guc_capture_getlistsize(guc, 0, GUC_STATE_CAPTURE_TYPE_GLOBAL, in guc_capture_output_size_est()
798 if (!guc_capture_getlistsize(guc, 0, GUC_STATE_CAPTURE_TYPE_ENGINE_CLASS, in guc_capture_output_size_est()
801 if (!guc_capture_getlistsize(guc, 0, GUC_STATE_CAPTURE_TYPE_ENGINE_INSTANCE, in guc_capture_output_size_est()
815 static void check_guc_capture_size(struct xe_guc *guc) in check_guc_capture_size() argument
817 int capture_size = guc_capture_output_size_est(guc); in check_guc_capture_size()
819 u32 buffer_size = xe_guc_log_section_size_capture(&guc->log); in check_guc_capture_size()
832 xe_gt_dbg(guc_to_gt(guc), in check_guc_capture_size()
836 xe_gt_dbg(guc_to_gt(guc), "Error state capture buffer maybe small: %d < %d\n", in check_guc_capture_size()
839 xe_gt_dbg(guc_to_gt(guc), in check_guc_capture_size()
892 guc_capture_init_node(struct xe_guc *guc, struct __guc_capture_parsed_output *node) in guc_capture_init_node() argument
900 guc->capture->max_mmio_per_node); in guc_capture_init_node()
995 guc_capture_log_remove_bytes(struct xe_guc *guc, struct __guc_capture_bufstate *buf, in guc_capture_log_remove_bytes() argument
1003 xe_assert(guc_to_xe(guc), bytes_needed % sizeof(u32) == 0); in guc_capture_log_remove_bytes()
1024 xe_map_memcpy_from(guc_to_xe(guc), out + fill_size, &guc->log.bo->vmap, in guc_capture_log_remove_bytes()
1031 xe_gt_warn(guc_to_gt(guc), in guc_capture_log_remove_bytes()
1039 guc_capture_log_get_group_hdr(struct xe_guc *guc, struct __guc_capture_bufstate *buf, in guc_capture_log_get_group_hdr() argument
1044 if (guc_capture_log_remove_bytes(guc, buf, ghdr, fullsize) != fullsize) in guc_capture_log_get_group_hdr()
1050 guc_capture_log_get_data_hdr(struct xe_guc *guc, struct __guc_capture_bufstate *buf, in guc_capture_log_get_data_hdr() argument
1055 if (guc_capture_log_remove_bytes(guc, buf, hdr, fullsize) != fullsize) in guc_capture_log_get_data_hdr()
1061 guc_capture_log_get_register(struct xe_guc *guc, struct __guc_capture_bufstate *buf, in guc_capture_log_get_register() argument
1066 if (guc_capture_log_remove_bytes(guc, buf, reg, fullsize) != fullsize) in guc_capture_log_get_register()
1072 guc_capture_get_prealloc_node(struct xe_guc *guc) in guc_capture_get_prealloc_node() argument
1076 if (!list_empty(&guc->capture->cachelist)) { in guc_capture_get_prealloc_node()
1080 list_for_each_entry_safe(n, ntmp, &guc->capture->cachelist, link) { in guc_capture_get_prealloc_node()
1091 list_for_each_entry_safe_reverse(n, ntmp, &guc->capture->outlist, link) { in guc_capture_get_prealloc_node()
1098 guc_capture_init_node(guc, found); in guc_capture_get_prealloc_node()
1105 guc_capture_clone_node(struct xe_guc *guc, struct __guc_capture_parsed_output *original, in guc_capture_clone_node() argument
1111 new = guc_capture_get_prealloc_node(guc); in guc_capture_clone_node()
1123 guc->capture->max_mmio_per_node); in guc_capture_clone_node()
1145 guc_capture_extract_reglists(struct xe_guc *guc, struct __guc_capture_bufstate *buf) in guc_capture_extract_reglists() argument
1147 struct xe_gt *gt = guc_to_gt(guc); in guc_capture_extract_reglists()
1168 if (guc_capture_log_get_group_hdr(guc, buf, &ghdr)) { in guc_capture_extract_reglists()
1228 if (guc_capture_log_get_data_hdr(guc, buf, &hdr)) { in guc_capture_extract_reglists()
1239 if (guc_capture_log_get_register(guc, buf, &tmp)) { in guc_capture_extract_reglists()
1256 guc_capture_add_node_to_outlist(guc->capture, node); in guc_capture_extract_reglists()
1261 guc_capture_add_node_to_outlist(guc->capture, node); in guc_capture_extract_reglists()
1262 node = guc_capture_clone_node(guc, node, in guc_capture_extract_reglists()
1267 guc_capture_add_node_to_outlist(guc->capture, node); in guc_capture_extract_reglists()
1268 node = guc_capture_clone_node(guc, node, in guc_capture_extract_reglists()
1275 node = guc_capture_get_prealloc_node(guc); in guc_capture_extract_reglists()
1308 if (numregs > guc->capture->max_mmio_per_node) { in guc_capture_extract_reglists()
1310 numregs = guc->capture->max_mmio_per_node; in guc_capture_extract_reglists()
1316 if (guc_capture_log_get_register(guc, buf, ®s[i++])) { in guc_capture_extract_reglists()
1328 guc_capture_add_node_to_outlist(guc->capture, node); in guc_capture_extract_reglists()
1334 guc_capture_add_node_to_cachelist(guc->capture, node); in guc_capture_extract_reglists()
1339 static int __guc_capture_flushlog_complete(struct xe_guc *guc) in __guc_capture_flushlog_complete() argument
1346 return xe_guc_ct_send_g2h_handler(&guc->ct, action, ARRAY_SIZE(action)); in __guc_capture_flushlog_complete()
1349 static void __guc_capture_process_output(struct xe_guc *guc) in __guc_capture_process_output() argument
1352 struct xe_uc *uc = container_of(guc, typeof(*uc), guc); in __guc_capture_process_output()
1361 src_data_offset = xe_guc_get_log_buffer_offset(&guc->log, GUC_LOG_BUFFER_CAPTURE); in __guc_capture_process_output()
1368 xe_map_memcpy_from(guc_to_xe(guc), &log_buf_state_local, &guc->log.bo->vmap, in __guc_capture_process_output()
1371 buffer_size = xe_guc_get_log_buffer_size(&guc->log, GUC_LOG_BUFFER_CAPTURE); in __guc_capture_process_output()
1378 guc->log.stats[GUC_LOG_BUFFER_CAPTURE].flush += tmp; in __guc_capture_process_output()
1379 new_overflow = xe_guc_check_log_buf_overflow(&guc->log, GUC_LOG_BUFFER_CAPTURE, in __guc_capture_process_output()
1389 xe_gt_err(guc_to_gt(guc), in __guc_capture_process_output()
1402 if (!xe_guc_read_stopped(guc)) { in __guc_capture_process_output()
1404 ret = guc_capture_extract_reglists(guc, &buf); in __guc_capture_process_output()
1406 xe_gt_dbg(guc_to_gt(guc), "Capture extraction failed:%d\n", ret); in __guc_capture_process_output()
1411 xe_map_wr(guc_to_xe(guc), &guc->log.bo->vmap, in __guc_capture_process_output()
1421 xe_map_wr(guc_to_xe(guc), &guc->log.bo->vmap, in __guc_capture_process_output()
1424 __guc_capture_flushlog_complete(guc); in __guc_capture_process_output()
1437 void xe_guc_capture_process(struct xe_guc *guc) in xe_guc_capture_process() argument
1439 if (guc->capture) in xe_guc_capture_process()
1440 __guc_capture_process_output(guc); in xe_guc_capture_process()
1444 guc_capture_alloc_one_node(struct xe_guc *guc) in guc_capture_alloc_one_node() argument
1446 struct drm_device *drm = guc_to_drm(guc); in guc_capture_alloc_one_node()
1455 new->reginfo[i].regs = drmm_kzalloc(drm, guc->capture->max_mmio_per_node * in guc_capture_alloc_one_node()
1464 guc_capture_init_node(guc, new); in guc_capture_alloc_one_node()
1470 __guc_capture_create_prealloc_nodes(struct xe_guc *guc) in __guc_capture_create_prealloc_nodes() argument
1476 node = guc_capture_alloc_one_node(guc); in __guc_capture_create_prealloc_nodes()
1478 xe_gt_warn(guc_to_gt(guc), "Register capture pre-alloc-cache failure\n"); in __guc_capture_create_prealloc_nodes()
1482 guc_capture_add_node_to_cachelist(guc->capture, node); in __guc_capture_create_prealloc_nodes()
1487 guc_get_max_reglist_count(struct xe_guc *guc) in guc_get_max_reglist_count() argument
1500 match = guc_capture_get_one_list(guc->capture->reglists, i, j, k); in guc_get_max_reglist_count()
1504 match = guc_capture_get_one_list(guc->capture->extlists, i, j, k); in guc_get_max_reglist_count()
1520 guc_capture_create_prealloc_nodes(struct xe_guc *guc) in guc_capture_create_prealloc_nodes() argument
1523 if (guc->capture->max_mmio_per_node) in guc_capture_create_prealloc_nodes()
1526 guc->capture->max_mmio_per_node = guc_get_max_reglist_count(guc); in guc_capture_create_prealloc_nodes()
1527 __guc_capture_create_prealloc_nodes(guc); in guc_capture_create_prealloc_nodes()
1583 struct xe_guc *guc = >->uc.guc; in xe_engine_manual_capture() local
1595 new = guc_capture_get_prealloc_node(guc); in xe_engine_manual_capture()
1635 guc_id = ge->guc.id; in xe_engine_manual_capture()
1649 guc_capture_add_node_to_outlist(guc->capture, new); in xe_engine_manual_capture()
1876 struct xe_guc *guc = &q->gt->uc.guc; in xe_guc_capture_get_matching_and_lock() local
1877 u16 guc_id = q->guc->id; in xe_guc_capture_get_matching_and_lock()
1885 list_for_each_entry_safe(n, ntmp, &guc->capture->outlist, link) { in xe_guc_capture_get_matching_and_lock()
1932 struct xe_guc *guc = &q->gt->uc.guc; in xe_engine_snapshot_capture_for_queue() local
1941 guc_capture_free_outlist_node(guc->capture, in xe_engine_snapshot_capture_for_queue()
1958 void xe_guc_capture_put_matched_nodes(struct xe_guc *guc) in xe_guc_capture_put_matched_nodes() argument
1960 struct xe_device *xe = guc_to_xe(guc); in xe_guc_capture_put_matched_nodes()
1965 guc_capture_remove_stale_matches_from_list(guc->capture, n); in xe_guc_capture_put_matched_nodes()
1966 guc_capture_free_outlist_node(guc->capture, n); in xe_guc_capture_put_matched_nodes()
1977 void xe_guc_capture_steered_list_init(struct xe_guc *guc) in xe_guc_capture_steered_list_init() argument
1985 guc_capture_alloc_steered_lists(guc); in xe_guc_capture_steered_list_init()
1986 check_guc_capture_size(guc); in xe_guc_capture_steered_list_init()
1987 guc_capture_create_prealloc_nodes(guc); in xe_guc_capture_steered_list_init()
1999 int xe_guc_capture_init(struct xe_guc *guc) in xe_guc_capture_init() argument
2001 guc->capture = drmm_kzalloc(guc_to_drm(guc), sizeof(*guc->capture), GFP_KERNEL); in xe_guc_capture_init()
2002 if (!guc->capture) in xe_guc_capture_init()
2005 guc->capture->reglists = guc_capture_get_device_reglist(guc_to_xe(guc)); in xe_guc_capture_init()
2007 INIT_LIST_HEAD(&guc->capture->outlist); in xe_guc_capture_init()
2008 INIT_LIST_HEAD(&guc->capture->cachelist); in xe_guc_capture_init()