Lines Matching refs:mgr
141 struct amdgpu_device *adev = ctx->mgr->adev; in amdgpu_ctx_get_hw_prio()
208 struct amdgpu_device *adev = ctx->mgr->adev; in amdgpu_ctx_init_entity()
295 struct amdgpu_device *adev = ctx->mgr->adev; in amdgpu_ctx_get_stable_pstate()
320 static int amdgpu_ctx_init(struct amdgpu_ctx_mgr *mgr, int32_t priority, in amdgpu_ctx_init() argument
334 ctx->mgr = mgr; in amdgpu_ctx_init()
337 ctx->reset_counter = atomic_read(&mgr->adev->gpu_reset_counter); in amdgpu_ctx_init()
339 ctx->generation = amdgpu_vm_generation(mgr->adev, &fpriv->vm); in amdgpu_ctx_init()
347 if (mgr->adev->pm.stable_pstate_ctx) in amdgpu_ctx_init()
348 ctx->stable_pstate = mgr->adev->pm.stable_pstate_ctx->stable_pstate; in amdgpu_ctx_init()
359 struct amdgpu_device *adev = ctx->mgr->adev; in amdgpu_ctx_set_stable_pstate()
410 struct amdgpu_ctx_mgr *mgr = ctx->mgr; in amdgpu_ctx_fini() local
411 struct amdgpu_device *adev = mgr->adev; in amdgpu_ctx_fini()
422 atomic64_add(ktime_to_ns(spend), &mgr->time_spend[i]); in amdgpu_ctx_fini()
479 struct amdgpu_ctx_mgr *mgr = &fpriv->ctx_mgr; in amdgpu_ctx_alloc() local
487 mutex_lock(&mgr->lock); in amdgpu_ctx_alloc()
488 r = idr_alloc(&mgr->ctx_handles, ctx, 1, AMDGPU_VM_MAX_NUM_CTX, GFP_KERNEL); in amdgpu_ctx_alloc()
490 mutex_unlock(&mgr->lock); in amdgpu_ctx_alloc()
496 r = amdgpu_ctx_init(mgr, priority, filp, ctx); in amdgpu_ctx_alloc()
498 idr_remove(&mgr->ctx_handles, *id); in amdgpu_ctx_alloc()
502 mutex_unlock(&mgr->lock); in amdgpu_ctx_alloc()
526 struct amdgpu_ctx_mgr *mgr = &fpriv->ctx_mgr; in amdgpu_ctx_free() local
529 mutex_lock(&mgr->lock); in amdgpu_ctx_free()
530 ctx = idr_remove(&mgr->ctx_handles, id); in amdgpu_ctx_free()
533 mutex_unlock(&mgr->lock); in amdgpu_ctx_free()
542 struct amdgpu_ctx_mgr *mgr; in amdgpu_ctx_query() local
548 mgr = &fpriv->ctx_mgr; in amdgpu_ctx_query()
549 mutex_lock(&mgr->lock); in amdgpu_ctx_query()
550 ctx = idr_find(&mgr->ctx_handles, id); in amdgpu_ctx_query()
552 mutex_unlock(&mgr->lock); in amdgpu_ctx_query()
569 mutex_unlock(&mgr->lock); in amdgpu_ctx_query()
581 struct amdgpu_ctx_mgr *mgr; in amdgpu_ctx_query2() local
586 mgr = &fpriv->ctx_mgr; in amdgpu_ctx_query2()
587 mutex_lock(&mgr->lock); in amdgpu_ctx_query2()
588 ctx = idr_find(&mgr->ctx_handles, id); in amdgpu_ctx_query2()
590 mutex_unlock(&mgr->lock); in amdgpu_ctx_query2()
633 mutex_unlock(&mgr->lock); in amdgpu_ctx_query2()
642 struct amdgpu_ctx_mgr *mgr; in amdgpu_ctx_stable_pstate() local
648 mgr = &fpriv->ctx_mgr; in amdgpu_ctx_stable_pstate()
649 mutex_lock(&mgr->lock); in amdgpu_ctx_stable_pstate()
650 ctx = idr_find(&mgr->ctx_handles, id); in amdgpu_ctx_stable_pstate()
652 mutex_unlock(&mgr->lock); in amdgpu_ctx_stable_pstate()
661 mutex_unlock(&mgr->lock); in amdgpu_ctx_stable_pstate()
733 struct amdgpu_ctx_mgr *mgr; in amdgpu_ctx_get() local
738 mgr = &fpriv->ctx_mgr; in amdgpu_ctx_get()
740 mutex_lock(&mgr->lock); in amdgpu_ctx_get()
741 ctx = idr_find(&mgr->ctx_handles, id); in amdgpu_ctx_get()
744 mutex_unlock(&mgr->lock); in amdgpu_ctx_get()
778 &ctx->mgr->time_spend[centity->hw_ip]); in amdgpu_ctx_add_fence()
818 struct amdgpu_device *adev = ctx->mgr->adev; in amdgpu_ctx_set_entity_priority()
883 void amdgpu_ctx_mgr_init(struct amdgpu_ctx_mgr *mgr, in amdgpu_ctx_mgr_init() argument
888 mgr->adev = adev; in amdgpu_ctx_mgr_init()
889 mutex_init(&mgr->lock); in amdgpu_ctx_mgr_init()
890 idr_init_base(&mgr->ctx_handles, 1); in amdgpu_ctx_mgr_init()
893 atomic64_set(&mgr->time_spend[i], 0); in amdgpu_ctx_mgr_init()
896 long amdgpu_ctx_mgr_entity_flush(struct amdgpu_ctx_mgr *mgr, long timeout) in amdgpu_ctx_mgr_entity_flush() argument
902 idp = &mgr->ctx_handles; in amdgpu_ctx_mgr_entity_flush()
904 mutex_lock(&mgr->lock); in amdgpu_ctx_mgr_entity_flush()
918 mutex_unlock(&mgr->lock); in amdgpu_ctx_mgr_entity_flush()
922 static void amdgpu_ctx_mgr_entity_fini(struct amdgpu_ctx_mgr *mgr) in amdgpu_ctx_mgr_entity_fini() argument
928 idp = &mgr->ctx_handles; in amdgpu_ctx_mgr_entity_fini()
951 void amdgpu_ctx_mgr_fini(struct amdgpu_ctx_mgr *mgr) in amdgpu_ctx_mgr_fini() argument
953 amdgpu_ctx_mgr_entity_fini(mgr); in amdgpu_ctx_mgr_fini()
954 idr_destroy(&mgr->ctx_handles); in amdgpu_ctx_mgr_fini()
955 mutex_destroy(&mgr->lock); in amdgpu_ctx_mgr_fini()
958 void amdgpu_ctx_mgr_usage(struct amdgpu_ctx_mgr *mgr, in amdgpu_ctx_mgr_usage() argument
970 mutex_lock(&mgr->lock); in amdgpu_ctx_mgr_usage()
972 uint64_t ns = atomic64_read(&mgr->time_spend[hw_ip]); in amdgpu_ctx_mgr_usage()
977 idr_for_each_entry(&mgr->ctx_handles, ctx, id) { in amdgpu_ctx_mgr_usage()
991 mutex_unlock(&mgr->lock); in amdgpu_ctx_mgr_usage()