Lines Matching refs:eng_grp
30 struct otx2_cpt_eng_grp_info *eng_grp) in get_cores_bmap() argument
36 if (eng_grp->g->engs_num < 0 || in get_cores_bmap()
37 eng_grp->g->engs_num > OTX2_CPT_MAX_ENGINES) { in get_cores_bmap()
39 eng_grp->g->engs_num); in get_cores_bmap()
44 if (eng_grp->engs[i].type) { in get_cores_bmap()
46 eng_grp->engs[i].bmap, in get_cores_bmap()
47 eng_grp->g->engs_num); in get_cores_bmap()
48 bmap.size = eng_grp->g->engs_num; in get_cores_bmap()
55 eng_grp->idx); in get_cores_bmap()
64 static int is_2nd_ucode_used(struct otx2_cpt_eng_grp_info *eng_grp) in is_2nd_ucode_used() argument
66 if (eng_grp->ucode[1].type) in is_2nd_ucode_used()
168 static int cptx_set_ucode_base(struct otx2_cpt_eng_grp_info *eng_grp, in cptx_set_ucode_base() argument
183 engs = &eng_grp->engs[i]; in cptx_set_ucode_base()
193 for_each_set_bit(bit, engs->bmap, eng_grp->g->engs_num) in cptx_set_ucode_base()
194 if (!eng_grp->g->eng_ref_cnt[bit]) { in cptx_set_ucode_base()
204 static int cpt_set_ucode_base(struct otx2_cpt_eng_grp_info *eng_grp, void *obj) in cpt_set_ucode_base() argument
210 ret = cptx_set_ucode_base(eng_grp, cptpf, BLKADDR_CPT1); in cpt_set_ucode_base()
214 return cptx_set_ucode_base(eng_grp, cptpf, BLKADDR_CPT0); in cpt_set_ucode_base()
217 static int cptx_detach_and_disable_cores(struct otx2_cpt_eng_grp_info *eng_grp, in cptx_detach_and_disable_cores() argument
233 if (reg & (1ull << eng_grp->idx)) { in cptx_detach_and_disable_cores()
234 eng_grp->g->eng_ref_cnt[i]--; in cptx_detach_and_disable_cores()
235 reg &= ~(1ull << eng_grp->idx); in cptx_detach_and_disable_cores()
270 if (!eng_grp->g->eng_ref_cnt[i]) { in cptx_detach_and_disable_cores()
283 static int cpt_detach_and_disable_cores(struct otx2_cpt_eng_grp_info *eng_grp, in cpt_detach_and_disable_cores() argument
290 bmap = get_cores_bmap(&cptpf->pdev->dev, eng_grp); in cpt_detach_and_disable_cores()
295 ret = cptx_detach_and_disable_cores(eng_grp, cptpf, bmap, in cpt_detach_and_disable_cores()
300 return cptx_detach_and_disable_cores(eng_grp, cptpf, bmap, in cpt_detach_and_disable_cores()
304 static int cptx_attach_and_enable_cores(struct otx2_cpt_eng_grp_info *eng_grp, in cptx_attach_and_enable_cores() argument
319 if (!(reg & (1ull << eng_grp->idx))) { in cptx_attach_and_enable_cores()
320 eng_grp->g->eng_ref_cnt[i]++; in cptx_attach_and_enable_cores()
321 reg |= 1ull << eng_grp->idx; in cptx_attach_and_enable_cores()
343 static int cpt_attach_and_enable_cores(struct otx2_cpt_eng_grp_info *eng_grp, in cpt_attach_and_enable_cores() argument
350 bmap = get_cores_bmap(&cptpf->pdev->dev, eng_grp); in cpt_attach_and_enable_cores()
355 ret = cptx_attach_and_enable_cores(eng_grp, cptpf, bmap, in cpt_attach_and_enable_cores()
360 return cptx_attach_and_enable_cores(eng_grp, cptpf, bmap, BLKADDR_CPT0); in cpt_attach_and_enable_cores()
484 struct otx2_cpt_eng_grp_info *eng_grp, in find_engines_by_type() argument
490 if (!eng_grp->engs[i].type) in find_engines_by_type()
493 if (eng_grp->engs[i].type == eng_type) in find_engines_by_type()
494 return &eng_grp->engs[i]; in find_engines_by_type()
499 static int eng_grp_has_eng_type(struct otx2_cpt_eng_grp_info *eng_grp, in eng_grp_has_eng_type() argument
504 engs = find_engines_by_type(eng_grp, eng_type); in eng_grp_has_eng_type()
713 static int enable_eng_grp(struct otx2_cpt_eng_grp_info *eng_grp, in enable_eng_grp() argument
719 ret = cpt_set_ucode_base(eng_grp, obj); in enable_eng_grp()
724 ret = cpt_attach_and_enable_cores(eng_grp, obj); in enable_eng_grp()
730 struct otx2_cpt_eng_grp_info *eng_grp, in disable_eng_grp() argument
736 ret = cpt_detach_and_disable_cores(eng_grp, obj); in disable_eng_grp()
741 ucode_unload(dev, &eng_grp->ucode[0]); in disable_eng_grp()
742 ucode_unload(dev, &eng_grp->ucode[1]); in disable_eng_grp()
745 if (!eng_grp->engs[i].type) in disable_eng_grp()
748 eng_grp->engs[i].ucode = &eng_grp->ucode[0]; in disable_eng_grp()
752 ret = cpt_set_ucode_base(eng_grp, obj); in disable_eng_grp()
852 struct otx2_cpt_eng_grp_info *eng_grp) in eng_grp_update_masks() argument
860 engs = &eng_grp->engs[i]; in eng_grp_update_masks()
868 max_cnt = eng_grp->g->avail.max_se_cnt; in eng_grp_update_masks()
872 max_cnt = eng_grp->g->avail.max_ie_cnt; in eng_grp_update_masks()
876 max_cnt = eng_grp->g->avail.max_ae_cnt; in eng_grp_update_masks()
886 bitmap_zero(tmp_bmap.bits, eng_grp->g->engs_num); in eng_grp_update_masks()
888 if (!eng_grp->g->eng_ref_cnt[j]) { in eng_grp_update_masks()
899 bitmap_copy(engs->bmap, tmp_bmap.bits, eng_grp->g->engs_num); in eng_grp_update_masks()
902 if (!eng_grp->mirror.is_ena) in eng_grp_update_masks()
906 engs = &eng_grp->engs[i]; in eng_grp_update_masks()
911 &eng_grp->g->grp[eng_grp->mirror.idx], in eng_grp_update_masks()
918 eng_grp->g->engs_num); in eng_grp_update_masks()
921 eng_grp->g->engs_num); in eng_grp_update_masks()
925 eng_grp->g->engs_num); in eng_grp_update_masks()
931 struct otx2_cpt_eng_grp_info *eng_grp) in delete_engine_group() argument
935 if (!eng_grp->is_enabled) in delete_engine_group()
938 if (eng_grp->mirror.ref_count) in delete_engine_group()
942 remove_eng_grp_mirroring(eng_grp); in delete_engine_group()
945 ret = disable_eng_grp(dev, eng_grp, eng_grp->g->obj); in delete_engine_group()
950 ret = release_engines(dev, eng_grp); in delete_engine_group()
954 eng_grp->is_enabled = false; in delete_engine_group()
959 static void update_ucode_ptrs(struct otx2_cpt_eng_grp_info *eng_grp) in update_ucode_ptrs() argument
963 if (eng_grp->mirror.is_ena) in update_ucode_ptrs()
964 ucode = &eng_grp->g->grp[eng_grp->mirror.idx].ucode[0]; in update_ucode_ptrs()
966 ucode = &eng_grp->ucode[0]; in update_ucode_ptrs()
967 WARN_ON(!eng_grp->engs[0].type); in update_ucode_ptrs()
968 eng_grp->engs[0].ucode = ucode; in update_ucode_ptrs()
970 if (eng_grp->engs[1].type) { in update_ucode_ptrs()
971 if (is_2nd_ucode_used(eng_grp)) in update_ucode_ptrs()
972 eng_grp->engs[1].ucode = &eng_grp->ucode[1]; in update_ucode_ptrs()
974 eng_grp->engs[1].ucode = ucode; in update_ucode_ptrs()
984 struct otx2_cpt_eng_grp_info *eng_grp; in create_engine_group() local
989 eng_grp = find_unused_eng_grp(eng_grps); in create_engine_group()
990 if (!eng_grp) { in create_engine_group()
997 eng_grp->ucode[i] = uc_info->ucode; in create_engine_group()
998 ret = copy_ucode_to_dma_mem(dev, &eng_grp->ucode[i], in create_engine_group()
1005 mirrored_eng_grp = find_mirrored_eng_grp(eng_grp); in create_engine_group()
1008 setup_eng_grp_mirroring(eng_grp, mirrored_eng_grp); in create_engine_group()
1016 ret = reserve_engines(dev, eng_grp, engs, ucodes_cnt); in create_engine_group()
1021 update_ucode_ptrs(eng_grp); in create_engine_group()
1024 ret = eng_grp_update_masks(dev, eng_grp); in create_engine_group()
1029 ret = enable_eng_grp(eng_grp, eng_grps->obj); in create_engine_group()
1038 if (eng_grp->mirror.is_ena) in create_engine_group()
1039 ucode_unload(dev, &eng_grp->ucode[0]); in create_engine_group()
1041 eng_grp->is_enabled = true; in create_engine_group()
1049 eng_grp->idx, mirrored_eng_grp->ucode[0].ver_str, in create_engine_group()
1053 eng_grp->idx, eng_grp->ucode[0].ver_str); in create_engine_group()
1054 if (is_2nd_ucode_used(eng_grp)) in create_engine_group()
1056 eng_grp->idx, eng_grp->ucode[1].ver_str); in create_engine_group()
1061 release_engines(dev, eng_grp); in create_engine_group()
1063 ucode_unload(dev, &eng_grp->ucode[0]); in create_engine_group()
1064 ucode_unload(dev, &eng_grp->ucode[1]); in create_engine_group()
1778 static void get_engs_info(struct otx2_cpt_eng_grp_info *eng_grp, char *buf, in get_engs_info() argument
1787 engs = &eng_grp->engs[i]; in get_engs_info()
1793 if (eng_grp->mirror.is_ena) in get_engs_info()
1795 &eng_grp->g->grp[eng_grp->mirror.idx], in get_engs_info()
1814 eng_grp->mirror.idx); in get_engs_info()