Lines Matching refs:eng_grp

58 					   struct otx_cpt_eng_grp_info *eng_grp)  in get_cores_bmap()  argument
64 if (eng_grp->g->engs_num > OTX_CPT_MAX_ENGINES) { in get_cores_bmap()
66 eng_grp->g->engs_num); in get_cores_bmap()
71 if (eng_grp->engs[i].type) { in get_cores_bmap()
73 eng_grp->engs[i].bmap, in get_cores_bmap()
74 eng_grp->g->engs_num); in get_cores_bmap()
75 bmap.size = eng_grp->g->engs_num; in get_cores_bmap()
82 eng_grp->idx); in get_cores_bmap()
175 static int cpt_set_ucode_base(struct otx_cpt_eng_grp_info *eng_grp, void *obj) in cpt_set_ucode_base() argument
182 bmap = get_cores_bmap(&cpt->pdev->dev, eng_grp); in cpt_set_ucode_base()
186 if (eng_grp->mirror.is_ena) in cpt_set_ucode_base()
188 eng_grp->g->grp[eng_grp->mirror.idx].ucode[0].align_dma; in cpt_set_ucode_base()
190 dma_addr = eng_grp->ucode[0].align_dma; in cpt_set_ucode_base()
197 if (!eng_grp->g->eng_ref_cnt[i]) in cpt_set_ucode_base()
203 static int cpt_detach_and_disable_cores(struct otx_cpt_eng_grp_info *eng_grp, in cpt_detach_and_disable_cores() argument
212 bmap = get_cores_bmap(&cpt->pdev->dev, eng_grp); in cpt_detach_and_disable_cores()
217 reg = readq(cpt->reg_base + OTX_CPT_PF_GX_EN(eng_grp->idx)); in cpt_detach_and_disable_cores()
220 eng_grp->g->eng_ref_cnt[i]--; in cpt_detach_and_disable_cores()
224 writeq(reg, cpt->reg_base + OTX_CPT_PF_GX_EN(eng_grp->idx)); in cpt_detach_and_disable_cores()
244 if (!eng_grp->g->eng_ref_cnt[i]) in cpt_detach_and_disable_cores()
251 static int cpt_attach_and_enable_cores(struct otx_cpt_eng_grp_info *eng_grp, in cpt_attach_and_enable_cores() argument
259 bmap = get_cores_bmap(&cpt->pdev->dev, eng_grp); in cpt_attach_and_enable_cores()
264 reg = readq(cpt->reg_base + OTX_CPT_PF_GX_EN(eng_grp->idx)); in cpt_attach_and_enable_cores()
267 eng_grp->g->eng_ref_cnt[i]++; in cpt_attach_and_enable_cores()
271 writeq(reg, cpt->reg_base + OTX_CPT_PF_GX_EN(eng_grp->idx)); in cpt_attach_and_enable_cores()
487 struct otx_cpt_eng_grp_info *eng_grp, in find_engines_by_type() argument
493 if (!eng_grp->engs[i].type) in find_engines_by_type()
496 if (eng_grp->engs[i].type == eng_type) in find_engines_by_type()
497 return &eng_grp->engs[i]; in find_engines_by_type()
508 int otx_cpt_eng_grp_has_eng_type(struct otx_cpt_eng_grp_info *eng_grp, in otx_cpt_eng_grp_has_eng_type() argument
513 engs = find_engines_by_type(eng_grp, eng_type); in otx_cpt_eng_grp_has_eng_type()
519 static void print_ucode_info(struct otx_cpt_eng_grp_info *eng_grp, in print_ucode_info() argument
522 if (eng_grp->mirror.is_ena) { in print_ucode_info()
524 eng_grp->g->grp[eng_grp->mirror.idx].ucode[0].ver_str, in print_ucode_info()
525 eng_grp->mirror.idx); in print_ucode_info()
527 scnprintf(buf, size, "%s", eng_grp->ucode[0].ver_str); in print_ucode_info()
531 static void print_engs_info(struct otx_cpt_eng_grp_info *eng_grp, in print_engs_info() argument
540 engs = &eng_grp->engs[i]; in print_engs_info()
546 if (eng_grp->mirror.is_ena) in print_engs_info()
548 &eng_grp->g->grp[eng_grp->mirror.idx], in print_engs_info()
565 eng_grp->mirror.idx); in print_engs_info()
582 static void cpt_print_engines_mask(struct otx_cpt_eng_grp_info *eng_grp, in cpt_print_engines_mask() argument
588 bmap = get_cores_bmap(dev, eng_grp); in cpt_print_engines_mask()
812 struct otx_cpt_eng_grp_info *eng_grp; in eng_grp_info_show() local
815 eng_grp = container_of(attr, struct otx_cpt_eng_grp_info, info_attr); in eng_grp_info_show()
816 mutex_lock(&eng_grp->g->lock); in eng_grp_info_show()
818 print_engs_info(eng_grp, engs_info, 2*OTX_CPT_UCODE_NAME_LENGTH, -1); in eng_grp_info_show()
819 print_ucode_info(eng_grp, ucode_info, 2*OTX_CPT_UCODE_NAME_LENGTH); in eng_grp_info_show()
820 cpt_print_engines_mask(eng_grp, dev, engs_mask, in eng_grp_info_show()
826 mutex_unlock(&eng_grp->g->lock); in eng_grp_info_show()
831 struct otx_cpt_eng_grp_info *eng_grp) in create_sysfs_eng_grps_info() argument
833 eng_grp->info_attr.show = eng_grp_info_show; in create_sysfs_eng_grps_info()
834 eng_grp->info_attr.store = NULL; in create_sysfs_eng_grps_info()
835 eng_grp->info_attr.attr.name = eng_grp->sysfs_info_name; in create_sysfs_eng_grps_info()
836 eng_grp->info_attr.attr.mode = 0440; in create_sysfs_eng_grps_info()
837 sysfs_attr_init(&eng_grp->info_attr.attr); in create_sysfs_eng_grps_info()
838 return device_create_file(dev, &eng_grp->info_attr); in create_sysfs_eng_grps_info()
937 static int enable_eng_grp(struct otx_cpt_eng_grp_info *eng_grp, in enable_eng_grp() argument
942 ret = cpt_set_ucode_base(eng_grp, obj); in enable_eng_grp()
946 ret = cpt_attach_and_enable_cores(eng_grp, obj); in enable_eng_grp()
951 struct otx_cpt_eng_grp_info *eng_grp, in disable_eng_grp() argument
956 ret = cpt_detach_and_disable_cores(eng_grp, obj); in disable_eng_grp()
961 ucode_unload(dev, &eng_grp->ucode[0]); in disable_eng_grp()
964 if (!eng_grp->engs[i].type) in disable_eng_grp()
967 eng_grp->engs[i].ucode = &eng_grp->ucode[0]; in disable_eng_grp()
970 ret = cpt_set_ucode_base(eng_grp, obj); in disable_eng_grp()
1069 struct otx_cpt_eng_grp_info *eng_grp) in eng_grp_update_masks() argument
1077 engs = &eng_grp->engs[i]; in eng_grp_update_masks()
1085 max_cnt = eng_grp->g->avail.max_se_cnt; in eng_grp_update_masks()
1089 max_cnt = eng_grp->g->avail.max_ae_cnt; in eng_grp_update_masks()
1099 bitmap_zero(tmp_bmap.bits, eng_grp->g->engs_num); in eng_grp_update_masks()
1101 if (!eng_grp->g->eng_ref_cnt[j]) { in eng_grp_update_masks()
1112 bitmap_copy(engs->bmap, tmp_bmap.bits, eng_grp->g->engs_num); in eng_grp_update_masks()
1115 if (!eng_grp->mirror.is_ena) in eng_grp_update_masks()
1119 engs = &eng_grp->engs[i]; in eng_grp_update_masks()
1124 &eng_grp->g->grp[eng_grp->mirror.idx], in eng_grp_update_masks()
1131 eng_grp->g->engs_num); in eng_grp_update_masks()
1134 eng_grp->g->engs_num); in eng_grp_update_masks()
1138 eng_grp->g->engs_num); in eng_grp_update_masks()
1144 struct otx_cpt_eng_grp_info *eng_grp) in delete_engine_group() argument
1148 if (!eng_grp->is_enabled) in delete_engine_group()
1151 if (eng_grp->mirror.ref_count) { in delete_engine_group()
1153 eng_grp->idx); in delete_engine_group()
1155 if (eng_grp->g->grp[i].mirror.is_ena && in delete_engine_group()
1156 eng_grp->g->grp[i].mirror.idx == eng_grp->idx) in delete_engine_group()
1164 remove_eng_grp_mirroring(eng_grp); in delete_engine_group()
1167 ret = disable_eng_grp(dev, eng_grp, eng_grp->g->obj); in delete_engine_group()
1172 ret = release_engines(dev, eng_grp); in delete_engine_group()
1176 device_remove_file(dev, &eng_grp->info_attr); in delete_engine_group()
1177 eng_grp->is_enabled = false; in delete_engine_group()
1183 struct otx_cpt_eng_grp_info *eng_grp, in validate_1_ucode_scenario() argument
1190 if (!otx_cpt_uc_supports_eng_type(&eng_grp->ucode[0], in validate_1_ucode_scenario()
1194 eng_grp->ucode[0].filename, in validate_1_ucode_scenario()
1202 static void update_ucode_ptrs(struct otx_cpt_eng_grp_info *eng_grp) in update_ucode_ptrs() argument
1206 if (eng_grp->mirror.is_ena) in update_ucode_ptrs()
1207 ucode = &eng_grp->g->grp[eng_grp->mirror.idx].ucode[0]; in update_ucode_ptrs()
1209 ucode = &eng_grp->ucode[0]; in update_ucode_ptrs()
1210 WARN_ON(!eng_grp->engs[0].type); in update_ucode_ptrs()
1211 eng_grp->engs[0].ucode = ucode; in update_ucode_ptrs()
1222 struct otx_cpt_eng_grp_info *eng_grp; in create_engine_group() local
1237 eng_grp = find_unused_eng_grp(eng_grps); in create_engine_group()
1238 if (!eng_grp) { in create_engine_group()
1247 eng_grp->ucode[i] = tar_info->ucode; in create_engine_group()
1248 ret = copy_ucode_to_dma_mem(dev, &eng_grp->ucode[i], in create_engine_group()
1251 ret = ucode_load(dev, &eng_grp->ucode[i], in create_engine_group()
1258 ret = validate_1_ucode_scenario(dev, eng_grp, engs, engs_cnt); in create_engine_group()
1263 mirrored_eng_grp = find_mirrored_eng_grp(eng_grp); in create_engine_group()
1266 setup_eng_grp_mirroring(eng_grp, mirrored_eng_grp); in create_engine_group()
1276 ret = reserve_engines(dev, eng_grp, engs, engs_cnt); in create_engine_group()
1281 update_ucode_ptrs(eng_grp); in create_engine_group()
1284 ret = eng_grp_update_masks(dev, eng_grp); in create_engine_group()
1289 ret = create_sysfs_eng_grps_info(dev, eng_grp); in create_engine_group()
1294 ret = enable_eng_grp(eng_grp, eng_grps->obj); in create_engine_group()
1303 if (eng_grp->mirror.is_ena) in create_engine_group()
1304 ucode_unload(dev, &eng_grp->ucode[0]); in create_engine_group()
1306 eng_grp->is_enabled = true; in create_engine_group()
1307 if (eng_grp->mirror.is_ena) in create_engine_group()
1310 eng_grp->idx, mirrored_eng_grp->ucode[0].ver_str, in create_engine_group()
1314 eng_grp->idx, eng_grp->ucode[0].ver_str); in create_engine_group()
1319 release_engines(dev, eng_grp); in create_engine_group()
1321 ucode_unload(dev, &eng_grp->ucode[0]); in create_engine_group()