Lines Matching refs:mgr

138 	struct amdgpu_device *adev = ctx->mgr->adev;  in amdgpu_ctx_get_hw_prio()
205 struct amdgpu_device *adev = ctx->mgr->adev; in amdgpu_ctx_init_entity()
278 struct amdgpu_device *adev = ctx->mgr->adev; in amdgpu_ctx_get_stable_pstate()
303 static int amdgpu_ctx_init(struct amdgpu_ctx_mgr *mgr, int32_t priority, in amdgpu_ctx_init() argument
316 ctx->mgr = mgr; in amdgpu_ctx_init()
319 ctx->reset_counter = atomic_read(&mgr->adev->gpu_reset_counter); in amdgpu_ctx_init()
321 ctx->vram_lost_counter = atomic_read(&mgr->adev->vram_lost_counter); in amdgpu_ctx_init()
329 if (mgr->adev->pm.stable_pstate_ctx) in amdgpu_ctx_init()
330 ctx->stable_pstate = mgr->adev->pm.stable_pstate_ctx->stable_pstate; in amdgpu_ctx_init()
340 struct amdgpu_device *adev = ctx->mgr->adev; in amdgpu_ctx_set_stable_pstate()
391 struct amdgpu_ctx_mgr *mgr = ctx->mgr; in amdgpu_ctx_fini() local
392 struct amdgpu_device *adev = mgr->adev; in amdgpu_ctx_fini()
403 atomic64_add(ktime_to_ns(spend), &mgr->time_spend[i]); in amdgpu_ctx_fini()
452 struct amdgpu_ctx_mgr *mgr = &fpriv->ctx_mgr; in amdgpu_ctx_alloc() local
460 mutex_lock(&mgr->lock); in amdgpu_ctx_alloc()
461 r = idr_alloc(&mgr->ctx_handles, ctx, 1, AMDGPU_VM_MAX_NUM_CTX, GFP_KERNEL); in amdgpu_ctx_alloc()
463 mutex_unlock(&mgr->lock); in amdgpu_ctx_alloc()
469 r = amdgpu_ctx_init(mgr, priority, filp, ctx); in amdgpu_ctx_alloc()
471 idr_remove(&mgr->ctx_handles, *id); in amdgpu_ctx_alloc()
475 mutex_unlock(&mgr->lock); in amdgpu_ctx_alloc()
499 struct amdgpu_ctx_mgr *mgr = &fpriv->ctx_mgr; in amdgpu_ctx_free() local
502 mutex_lock(&mgr->lock); in amdgpu_ctx_free()
503 ctx = idr_remove(&mgr->ctx_handles, id); in amdgpu_ctx_free()
506 mutex_unlock(&mgr->lock); in amdgpu_ctx_free()
515 struct amdgpu_ctx_mgr *mgr; in amdgpu_ctx_query() local
521 mgr = &fpriv->ctx_mgr; in amdgpu_ctx_query()
522 mutex_lock(&mgr->lock); in amdgpu_ctx_query()
523 ctx = idr_find(&mgr->ctx_handles, id); in amdgpu_ctx_query()
525 mutex_unlock(&mgr->lock); in amdgpu_ctx_query()
542 mutex_unlock(&mgr->lock); in amdgpu_ctx_query()
554 struct amdgpu_ctx_mgr *mgr; in amdgpu_ctx_query2() local
559 mgr = &fpriv->ctx_mgr; in amdgpu_ctx_query2()
560 mutex_lock(&mgr->lock); in amdgpu_ctx_query2()
561 ctx = idr_find(&mgr->ctx_handles, id); in amdgpu_ctx_query2()
563 mutex_unlock(&mgr->lock); in amdgpu_ctx_query2()
603 mutex_unlock(&mgr->lock); in amdgpu_ctx_query2()
614 struct amdgpu_ctx_mgr *mgr; in amdgpu_ctx_stable_pstate() local
620 mgr = &fpriv->ctx_mgr; in amdgpu_ctx_stable_pstate()
621 mutex_lock(&mgr->lock); in amdgpu_ctx_stable_pstate()
622 ctx = idr_find(&mgr->ctx_handles, id); in amdgpu_ctx_stable_pstate()
624 mutex_unlock(&mgr->lock); in amdgpu_ctx_stable_pstate()
633 mutex_unlock(&mgr->lock); in amdgpu_ctx_stable_pstate()
695 struct amdgpu_ctx_mgr *mgr; in amdgpu_ctx_get() local
700 mgr = &fpriv->ctx_mgr; in amdgpu_ctx_get()
702 mutex_lock(&mgr->lock); in amdgpu_ctx_get()
703 ctx = idr_find(&mgr->ctx_handles, id); in amdgpu_ctx_get()
706 mutex_unlock(&mgr->lock); in amdgpu_ctx_get()
740 &ctx->mgr->time_spend[centity->hw_ip]); in amdgpu_ctx_add_fence()
780 struct amdgpu_device *adev = ctx->mgr->adev; in amdgpu_ctx_set_entity_priority()
845 void amdgpu_ctx_mgr_init(struct amdgpu_ctx_mgr *mgr, in amdgpu_ctx_mgr_init() argument
850 mgr->adev = adev; in amdgpu_ctx_mgr_init()
851 mutex_init(&mgr->lock); in amdgpu_ctx_mgr_init()
852 idr_init_base(&mgr->ctx_handles, 1); in amdgpu_ctx_mgr_init()
855 atomic64_set(&mgr->time_spend[i], 0); in amdgpu_ctx_mgr_init()
858 long amdgpu_ctx_mgr_entity_flush(struct amdgpu_ctx_mgr *mgr, long timeout) in amdgpu_ctx_mgr_entity_flush() argument
864 idp = &mgr->ctx_handles; in amdgpu_ctx_mgr_entity_flush()
866 mutex_lock(&mgr->lock); in amdgpu_ctx_mgr_entity_flush()
880 mutex_unlock(&mgr->lock); in amdgpu_ctx_mgr_entity_flush()
884 void amdgpu_ctx_mgr_entity_fini(struct amdgpu_ctx_mgr *mgr) in amdgpu_ctx_mgr_entity_fini() argument
890 idp = &mgr->ctx_handles; in amdgpu_ctx_mgr_entity_fini()
912 void amdgpu_ctx_mgr_fini(struct amdgpu_ctx_mgr *mgr) in amdgpu_ctx_mgr_fini() argument
918 amdgpu_ctx_mgr_entity_fini(mgr); in amdgpu_ctx_mgr_fini()
920 idp = &mgr->ctx_handles; in amdgpu_ctx_mgr_fini()
927 idr_destroy(&mgr->ctx_handles); in amdgpu_ctx_mgr_fini()
928 mutex_destroy(&mgr->lock); in amdgpu_ctx_mgr_fini()
931 void amdgpu_ctx_mgr_usage(struct amdgpu_ctx_mgr *mgr, in amdgpu_ctx_mgr_usage() argument
943 mutex_lock(&mgr->lock); in amdgpu_ctx_mgr_usage()
945 uint64_t ns = atomic64_read(&mgr->time_spend[hw_ip]); in amdgpu_ctx_mgr_usage()
950 idr_for_each_entry(&mgr->ctx_handles, ctx, id) { in amdgpu_ctx_mgr_usage()
964 mutex_unlock(&mgr->lock); in amdgpu_ctx_mgr_usage()