Lines Matching refs:gang

254 static void aff_merge_remaining_ctxs(struct spu_gang *gang)  in aff_merge_remaining_ctxs()  argument
258 list_for_each_entry(ctx, &gang->aff_list_head, aff_list) { in aff_merge_remaining_ctxs()
260 list_add(&ctx->aff_list, &gang->aff_list_head); in aff_merge_remaining_ctxs()
262 gang->aff_flags |= AFF_MERGED; in aff_merge_remaining_ctxs()
265 static void aff_set_offsets(struct spu_gang *gang) in aff_set_offsets() argument
271 list_for_each_entry_reverse(ctx, &gang->aff_ref_ctx->aff_list, in aff_set_offsets()
273 if (&ctx->aff_list == &gang->aff_list_head) in aff_set_offsets()
279 list_for_each_entry(ctx, gang->aff_ref_ctx->aff_list.prev, aff_list) { in aff_set_offsets()
280 if (&ctx->aff_list == &gang->aff_list_head) in aff_set_offsets()
285 gang->aff_flags |= AFF_OFFSETS_SET; in aff_set_offsets()
318 if (spu->ctx && spu->ctx->gang && !spu->ctx->aff_offset in aff_ref_location()
319 && spu->ctx->gang->aff_ref_spu) in aff_ref_location()
320 available_spus -= spu->ctx->gang->contexts; in aff_ref_location()
323 if (available_spus < ctx->gang->contexts) { in aff_ref_location()
340 static void aff_set_ref_point_location(struct spu_gang *gang) in aff_set_ref_point_location() argument
345 mem_aff = gang->aff_ref_ctx->flags & SPU_CREATE_AFFINITY_MEM; in aff_set_ref_point_location()
349 list_for_each_entry(tmp, &gang->aff_list_head, aff_list) in aff_set_ref_point_location()
352 list_for_each_entry_reverse(ctx, &gang->aff_ref_ctx->aff_list, in aff_set_ref_point_location()
354 if (&ctx->aff_list == &gang->aff_list_head) in aff_set_ref_point_location()
359 gang->aff_ref_spu = aff_ref_location(gang->aff_ref_ctx, mem_aff, gs, in aff_set_ref_point_location()
395 struct spu_gang *gang = ctx->gang; in has_affinity() local
400 if (atomic_read(&ctx->gang->aff_sched_count) == 0) in has_affinity()
401 ctx->gang->aff_ref_spu = NULL; in has_affinity()
403 if (!gang->aff_ref_spu) { in has_affinity()
404 if (!(gang->aff_flags & AFF_MERGED)) in has_affinity()
405 aff_merge_remaining_ctxs(gang); in has_affinity()
406 if (!(gang->aff_flags & AFF_OFFSETS_SET)) in has_affinity()
407 aff_set_offsets(gang); in has_affinity()
408 aff_set_ref_point_location(gang); in has_affinity()
411 return gang->aff_ref_spu != NULL; in has_affinity()
430 if (ctx->gang) in spu_unbind_context()
436 atomic_dec_if_positive(&ctx->gang->aff_sched_count); in spu_unbind_context()
560 if (ctx->gang) { in spu_get_idle()
561 mutex_lock(&ctx->gang->aff_mutex); in spu_get_idle()
563 aff_ref_spu = ctx->gang->aff_ref_spu; in spu_get_idle()
564 atomic_inc(&ctx->gang->aff_sched_count); in spu_get_idle()
565 mutex_unlock(&ctx->gang->aff_mutex); in spu_get_idle()
574 atomic_dec(&ctx->gang->aff_sched_count); in spu_get_idle()
577 mutex_unlock(&ctx->gang->aff_mutex); in spu_get_idle()