Lines Matching refs:guc

84 static u32 guc_ads_regset_size(struct intel_guc *guc)  in guc_ads_regset_size()  argument
86 GEM_BUG_ON(!guc->ads_regset_size); in guc_ads_regset_size()
87 return guc->ads_regset_size; in guc_ads_regset_size()
90 static u32 guc_ads_golden_ctxt_size(struct intel_guc *guc) in guc_ads_golden_ctxt_size() argument
92 return PAGE_ALIGN(guc->ads_golden_ctxt_size); in guc_ads_golden_ctxt_size()
95 static u32 guc_ads_waklv_size(struct intel_guc *guc) in guc_ads_waklv_size() argument
97 return PAGE_ALIGN(guc->ads_waklv_size); in guc_ads_waklv_size()
100 static u32 guc_ads_capture_size(struct intel_guc *guc) in guc_ads_capture_size() argument
102 return PAGE_ALIGN(guc->ads_capture_size); in guc_ads_capture_size()
105 static u32 guc_ads_private_data_size(struct intel_guc *guc) in guc_ads_private_data_size() argument
107 return PAGE_ALIGN(guc->fw.private_data_size); in guc_ads_private_data_size()
110 static u32 guc_ads_regset_offset(struct intel_guc *guc) in guc_ads_regset_offset() argument
115 static u32 guc_ads_golden_ctxt_offset(struct intel_guc *guc) in guc_ads_golden_ctxt_offset() argument
119 offset = guc_ads_regset_offset(guc) + in guc_ads_golden_ctxt_offset()
120 guc_ads_regset_size(guc); in guc_ads_golden_ctxt_offset()
125 static u32 guc_ads_waklv_offset(struct intel_guc *guc) in guc_ads_waklv_offset() argument
129 offset = guc_ads_golden_ctxt_offset(guc) + in guc_ads_waklv_offset()
130 guc_ads_golden_ctxt_size(guc); in guc_ads_waklv_offset()
135 static u32 guc_ads_capture_offset(struct intel_guc *guc) in guc_ads_capture_offset() argument
139 offset = guc_ads_waklv_offset(guc) + in guc_ads_capture_offset()
140 guc_ads_waklv_size(guc); in guc_ads_capture_offset()
145 static u32 guc_ads_private_data_offset(struct intel_guc *guc) in guc_ads_private_data_offset() argument
149 offset = guc_ads_capture_offset(guc) + in guc_ads_private_data_offset()
150 guc_ads_capture_size(guc); in guc_ads_private_data_offset()
155 static u32 guc_ads_blob_size(struct intel_guc *guc) in guc_ads_blob_size() argument
157 return guc_ads_private_data_offset(guc) + in guc_ads_blob_size()
158 guc_ads_private_data_size(guc); in guc_ads_blob_size()
161 static void guc_policies_init(struct intel_guc *guc) in guc_policies_init() argument
163 struct intel_gt *gt = guc_to_gt(guc); in guc_policies_init()
167 ads_blob_write(guc, policies.dpc_promote_time, in guc_policies_init()
169 ads_blob_write(guc, policies.max_num_work_items, in guc_policies_init()
175 ads_blob_write(guc, policies.global_flags, global_flags); in guc_policies_init()
176 ads_blob_write(guc, policies.is_valid, 1); in guc_policies_init()
179 void intel_guc_ads_print_policy_info(struct intel_guc *guc, in intel_guc_ads_print_policy_info() argument
182 if (unlikely(iosys_map_is_null(&guc->ads_map))) in intel_guc_ads_print_policy_info()
187 ads_blob_read(guc, policies.dpc_promote_time)); in intel_guc_ads_print_policy_info()
189 ads_blob_read(guc, policies.max_num_work_items)); in intel_guc_ads_print_policy_info()
191 ads_blob_read(guc, policies.global_flags)); in intel_guc_ads_print_policy_info()
194 static int guc_action_policies_update(struct intel_guc *guc, u32 policy_offset) in guc_action_policies_update() argument
201 return intel_guc_send_busy_loop(guc, action, ARRAY_SIZE(action), 0, true); in guc_action_policies_update()
204 int intel_guc_global_policies_update(struct intel_guc *guc) in intel_guc_global_policies_update() argument
206 struct intel_gt *gt = guc_to_gt(guc); in intel_guc_global_policies_update()
211 if (iosys_map_is_null(&guc->ads_map)) in intel_guc_global_policies_update()
214 scheduler_policies = ads_blob_read(guc, ads.scheduler_policies); in intel_guc_global_policies_update()
217 guc_policies_init(guc); in intel_guc_global_policies_update()
219 if (!intel_guc_is_ready(guc)) in intel_guc_global_policies_update()
223 ret = guc_action_policies_update(guc, scheduler_policies); in intel_guc_global_policies_update()
433 static long guc_mmio_reg_state_create(struct intel_guc *guc) in guc_mmio_reg_state_create() argument
435 struct intel_gt *gt = guc_to_gt(guc); in guc_mmio_reg_state_create()
449 guc->ads_regset_count[id] = temp_set.storage_used - used; in guc_mmio_reg_state_create()
450 total += guc->ads_regset_count[id]; in guc_mmio_reg_state_create()
453 guc->ads_regset = temp_set.storage; in guc_mmio_reg_state_create()
455 guc_dbg(guc, "Used %zu KB for temporary ADS regset\n", in guc_mmio_reg_state_create()
465 static void guc_mmio_reg_state_init(struct intel_guc *guc) in guc_mmio_reg_state_init() argument
467 struct intel_gt *gt = guc_to_gt(guc); in guc_mmio_reg_state_init()
472 offset = guc_ads_regset_offset(guc); in guc_mmio_reg_state_init()
473 addr_ggtt = intel_guc_ggtt_offset(guc, guc->ads_vma) + offset; in guc_mmio_reg_state_init()
475 iosys_map_memcpy_to(&guc->ads_map, offset, guc->ads_regset, in guc_mmio_reg_state_init()
476 guc->ads_regset_size); in guc_mmio_reg_state_init()
479 u32 count = guc->ads_regset_count[id]; in guc_mmio_reg_state_init()
488 ads_blob_write(guc, in guc_mmio_reg_state_init()
491 ads_blob_write(guc, in guc_mmio_reg_state_init()
497 ads_blob_write(guc, in guc_mmio_reg_state_init()
500 ads_blob_write(guc, in guc_mmio_reg_state_init()
529 static int guc_prep_golden_context(struct intel_guc *guc) in guc_prep_golden_context() argument
531 struct intel_gt *gt = guc_to_gt(guc); in guc_prep_golden_context()
550 if (!iosys_map_is_null(&guc->ads_map)) { in guc_prep_golden_context()
551 offset = guc_ads_golden_ctxt_offset(guc); in guc_prep_golden_context()
552 addr_ggtt = intel_guc_ggtt_offset(guc, guc->ads_vma) + offset; in guc_prep_golden_context()
553 info_map = IOSYS_MAP_INIT_OFFSET(&guc->ads_map, in guc_prep_golden_context()
571 if (iosys_map_is_null(&guc->ads_map)) in guc_prep_golden_context()
585 ads_blob_write(guc, ads.eng_state_size[guc_class], in guc_prep_golden_context()
587 ads_blob_write(guc, ads.golden_context_lrca[guc_class], in guc_prep_golden_context()
594 if (guc->ads_golden_ctxt_size) in guc_prep_golden_context()
595 GEM_BUG_ON(guc->ads_golden_ctxt_size != total_size); in guc_prep_golden_context()
618 static void guc_init_golden_context(struct intel_guc *guc) in guc_init_golden_context() argument
621 struct intel_gt *gt = guc_to_gt(guc); in guc_init_golden_context()
629 GEM_BUG_ON(iosys_map_is_null(&guc->ads_map)); in guc_init_golden_context()
635 offset = guc_ads_golden_ctxt_offset(guc); in guc_init_golden_context()
636 addr_ggtt = intel_guc_ggtt_offset(guc, guc->ads_vma) + offset; in guc_init_golden_context()
640 if (!ads_blob_read(guc, system_info.engine_enabled_masks[guc_class])) in guc_init_golden_context()
649 guc_err(guc, "No engine state recorded for class %d!\n", in guc_init_golden_context()
651 ads_blob_write(guc, ads.eng_state_size[guc_class], 0); in guc_init_golden_context()
652 ads_blob_write(guc, ads.golden_context_lrca[guc_class], 0); in guc_init_golden_context()
656 GEM_BUG_ON(ads_blob_read(guc, ads.eng_state_size[guc_class]) != in guc_init_golden_context()
658 GEM_BUG_ON(ads_blob_read(guc, ads.golden_context_lrca[guc_class]) != addr_ggtt); in guc_init_golden_context()
662 shmem_read_to_iosys_map(engine->default_state, 0, &guc->ads_map, in guc_init_golden_context()
667 GEM_BUG_ON(guc->ads_golden_ctxt_size != total_size); in guc_init_golden_context()
704 guc_capture_prep_lists(struct intel_guc *guc) in guc_capture_prep_lists() argument
706 struct intel_gt *gt = guc_to_gt(guc); in guc_capture_prep_lists()
715 ads_is_mapped = !iosys_map_is_null(&guc->ads_map); in guc_capture_prep_lists()
717 capture_offset = guc_ads_capture_offset(guc); in guc_capture_prep_lists()
718 ads_ggtt = intel_guc_ggtt_offset(guc, guc->ads_vma); in guc_capture_prep_lists()
719 info_map = IOSYS_MAP_INIT_OFFSET(&guc->ads_map, in guc_capture_prep_lists()
730 if (!intel_guc_capture_getnullheader(guc, &ptr, &size)) in guc_capture_prep_lists()
731 iosys_map_memcpy_to(&guc->ads_map, capture_offset, ptr, size); in guc_capture_prep_lists()
743 ads_blob_write(guc, ads.capture_class[i][j], null_ggtt); in guc_capture_prep_lists()
744 ads_blob_write(guc, ads.capture_instance[i][j], null_ggtt); in guc_capture_prep_lists()
748 if (intel_guc_capture_getlistsize(guc, i, in guc_capture_prep_lists()
752 ads_blob_write(guc, ads.capture_class[i][j], null_ggtt); in guc_capture_prep_lists()
757 if (total_size > guc->ads_capture_size || in guc_capture_prep_lists()
758 intel_guc_capture_getlist(guc, i, in guc_capture_prep_lists()
761 ads_blob_write(guc, ads.capture_class[i][j], null_ggtt); in guc_capture_prep_lists()
764 ads_blob_write(guc, ads.capture_class[i][j], ads_ggtt + in guc_capture_prep_lists()
766 iosys_map_memcpy_to(&guc->ads_map, capture_offset, ptr, size); in guc_capture_prep_lists()
770 if (intel_guc_capture_getlistsize(guc, i, in guc_capture_prep_lists()
774 ads_blob_write(guc, ads.capture_instance[i][j], null_ggtt); in guc_capture_prep_lists()
779 if (total_size > guc->ads_capture_size || in guc_capture_prep_lists()
780 intel_guc_capture_getlist(guc, i, in guc_capture_prep_lists()
783 ads_blob_write(guc, ads.capture_instance[i][j], null_ggtt); in guc_capture_prep_lists()
786 ads_blob_write(guc, ads.capture_instance[i][j], ads_ggtt + in guc_capture_prep_lists()
788 iosys_map_memcpy_to(&guc->ads_map, capture_offset, ptr, size); in guc_capture_prep_lists()
792 if (intel_guc_capture_getlistsize(guc, i, GUC_CAPTURE_LIST_TYPE_GLOBAL, 0, &size)) { in guc_capture_prep_lists()
794 ads_blob_write(guc, ads.capture_global[i], null_ggtt); in guc_capture_prep_lists()
799 if (total_size > guc->ads_capture_size || in guc_capture_prep_lists()
800 intel_guc_capture_getlist(guc, i, GUC_CAPTURE_LIST_TYPE_GLOBAL, 0, in guc_capture_prep_lists()
802 ads_blob_write(guc, ads.capture_global[i], null_ggtt); in guc_capture_prep_lists()
805 ads_blob_write(guc, ads.capture_global[i], ads_ggtt + capture_offset); in guc_capture_prep_lists()
806 iosys_map_memcpy_to(&guc->ads_map, capture_offset, ptr, size); in guc_capture_prep_lists()
811 if (guc->ads_capture_size && guc->ads_capture_size != PAGE_ALIGN(total_size)) in guc_capture_prep_lists()
812 guc_warn(guc, "ADS capture alloc size changed from %d to %d\n", in guc_capture_prep_lists()
813 guc->ads_capture_size, PAGE_ALIGN(total_size)); in guc_capture_prep_lists()
818 static void guc_waklv_enable_simple(struct intel_guc *guc, u32 *offset, u32 *remain, u32 klv_id) in guc_waklv_enable_simple() argument
831 iosys_map_memcpy_to(&guc->ads_map, *offset, klv_entry, size); in guc_waklv_enable_simple()
836 static void guc_waklv_init(struct intel_guc *guc) in guc_waklv_init() argument
838 struct intel_gt *gt = guc_to_gt(guc); in guc_waklv_init()
844 if (GUC_FIRMWARE_VER(guc) < MAKE_GUC_VER(70, 10, 0)) in guc_waklv_init()
847 GEM_BUG_ON(iosys_map_is_null(&guc->ads_map)); in guc_waklv_init()
848 offset = guc_ads_waklv_offset(guc); in guc_waklv_init()
849 remain = guc_ads_waklv_size(guc); in guc_waklv_init()
853 guc_waklv_enable_simple(guc, &offset, &remain, in guc_waklv_init()
855 guc_waklv_enable_simple(guc, &offset, &remain, in guc_waklv_init()
860 if ((GUC_FIRMWARE_VER(guc) >= MAKE_GUC_VER(70, 21, 1)) && in guc_waklv_init()
864 guc_waklv_enable_simple(guc, &offset, &remain, in guc_waklv_init()
867 size = guc_ads_waklv_size(guc) - remain; in guc_waklv_init()
871 offset = guc_ads_waklv_offset(guc); in guc_waklv_init()
872 addr_ggtt = intel_guc_ggtt_offset(guc, guc->ads_vma) + offset; in guc_waklv_init()
874 ads_blob_write(guc, ads.wa_klv_addr_lo, addr_ggtt); in guc_waklv_init()
875 ads_blob_write(guc, ads.wa_klv_addr_hi, 0); in guc_waklv_init()
876 ads_blob_write(guc, ads.wa_klv_size, size); in guc_waklv_init()
879 static int guc_prep_waklv(struct intel_guc *guc) in guc_prep_waklv() argument
885 static void __guc_ads_init(struct intel_guc *guc) in __guc_ads_init() argument
887 struct intel_gt *gt = guc_to_gt(guc); in __guc_ads_init()
889 struct iosys_map info_map = IOSYS_MAP_INIT_OFFSET(&guc->ads_map, in __guc_ads_init()
894 guc_policies_init(guc); in __guc_ads_init()
899 ads_blob_write(guc, system_info.generic_gt_sysinfo[GUC_GENERIC_GT_SYSINFO_SLICE_ENABLED], in __guc_ads_init()
901 ads_blob_write(guc, system_info.generic_gt_sysinfo[GUC_GENERIC_GT_SYSINFO_VDBOX_SFC_SUPPORT_MASK], in __guc_ads_init()
907 ads_blob_write(guc, in __guc_ads_init()
914 guc_prep_golden_context(guc); in __guc_ads_init()
916 guc_mapping_table_init(guc_to_gt(guc), &info_map); in __guc_ads_init()
918 base = intel_guc_ggtt_offset(guc, guc->ads_vma); in __guc_ads_init()
921 guc_capture_prep_lists(guc); in __guc_ads_init()
924 ads_blob_write(guc, ads.scheduler_policies, base + in __guc_ads_init()
926 ads_blob_write(guc, ads.gt_system_info, base + in __guc_ads_init()
930 guc_mmio_reg_state_init(guc); in __guc_ads_init()
933 guc_waklv_init(guc); in __guc_ads_init()
936 ads_blob_write(guc, ads.private_data, base + in __guc_ads_init()
937 guc_ads_private_data_offset(guc)); in __guc_ads_init()
939 i915_gem_object_flush_map(guc->ads_vma->obj); in __guc_ads_init()
949 int intel_guc_ads_create(struct intel_guc *guc) in intel_guc_ads_create() argument
955 GEM_BUG_ON(guc->ads_vma); in intel_guc_ads_create()
961 ret = guc_mmio_reg_state_create(guc); in intel_guc_ads_create()
964 guc->ads_regset_size = ret; in intel_guc_ads_create()
967 ret = guc_prep_golden_context(guc); in intel_guc_ads_create()
970 guc->ads_golden_ctxt_size = ret; in intel_guc_ads_create()
973 ret = guc_capture_prep_lists(guc); in intel_guc_ads_create()
976 guc->ads_capture_size = ret; in intel_guc_ads_create()
979 ret = guc_prep_waklv(guc); in intel_guc_ads_create()
982 guc->ads_waklv_size = ret; in intel_guc_ads_create()
985 size = guc_ads_blob_size(guc); in intel_guc_ads_create()
987 ret = intel_guc_allocate_and_map_vma(guc, size, &guc->ads_vma, in intel_guc_ads_create()
992 if (i915_gem_object_is_lmem(guc->ads_vma->obj)) in intel_guc_ads_create()
993 iosys_map_set_vaddr_iomem(&guc->ads_map, (void __iomem *)ads_blob); in intel_guc_ads_create()
995 iosys_map_set_vaddr(&guc->ads_map, ads_blob); in intel_guc_ads_create()
997 __guc_ads_init(guc); in intel_guc_ads_create()
1002 void intel_guc_ads_init_late(struct intel_guc *guc) in intel_guc_ads_init_late() argument
1011 guc_init_golden_context(guc); in intel_guc_ads_init_late()
1014 void intel_guc_ads_destroy(struct intel_guc *guc) in intel_guc_ads_destroy() argument
1016 i915_vma_unpin_and_release(&guc->ads_vma, I915_VMA_RELEASE_MAP); in intel_guc_ads_destroy()
1017 iosys_map_clear(&guc->ads_map); in intel_guc_ads_destroy()
1018 kfree(guc->ads_regset); in intel_guc_ads_destroy()
1021 static void guc_ads_private_data_reset(struct intel_guc *guc) in guc_ads_private_data_reset() argument
1025 size = guc_ads_private_data_size(guc); in guc_ads_private_data_reset()
1029 iosys_map_memset(&guc->ads_map, guc_ads_private_data_offset(guc), in guc_ads_private_data_reset()
1041 void intel_guc_ads_reset(struct intel_guc *guc) in intel_guc_ads_reset() argument
1043 if (!guc->ads_vma) in intel_guc_ads_reset()
1046 __guc_ads_init(guc); in intel_guc_ads_reset()
1048 guc_ads_private_data_reset(guc); in intel_guc_ads_reset()
1051 u32 intel_guc_engine_usage_offset(struct intel_guc *guc) in intel_guc_engine_usage_offset() argument
1053 return intel_guc_ggtt_offset(guc, guc->ads_vma) + in intel_guc_engine_usage_offset()
1059 struct intel_guc *guc = gt_to_guc(engine->gt); in intel_guc_engine_usage_record_map() local
1064 return IOSYS_MAP_INIT_OFFSET(&guc->ads_map, offset); in intel_guc_engine_usage_record_map()