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()
294 struct amdgpu_device *adev = ctx->mgr->adev; in amdgpu_ctx_get_stable_pstate()
319 static int amdgpu_ctx_init(struct amdgpu_ctx_mgr *mgr, int32_t priority, in amdgpu_ctx_init() argument
333 ctx->mgr = mgr; in amdgpu_ctx_init()
336 ctx->reset_counter = atomic_read(&mgr->adev->gpu_reset_counter); in amdgpu_ctx_init()
338 ctx->generation = amdgpu_vm_generation(mgr->adev, &fpriv->vm); in amdgpu_ctx_init()
346 if (mgr->adev->pm.stable_pstate_ctx) in amdgpu_ctx_init()
347 ctx->stable_pstate = mgr->adev->pm.stable_pstate_ctx->stable_pstate; in amdgpu_ctx_init()
358 struct amdgpu_device *adev = ctx->mgr->adev; in amdgpu_ctx_set_stable_pstate()
409 struct amdgpu_ctx_mgr *mgr = ctx->mgr; in amdgpu_ctx_fini() local
410 struct amdgpu_device *adev = mgr->adev; in amdgpu_ctx_fini()
421 atomic64_add(ktime_to_ns(spend), &mgr->time_spend[i]); in amdgpu_ctx_fini()
440 drm_err(adev_to_drm(ctx->mgr->adev), in amdgpu_ctx_get_entity()
447 drm_dbg(adev_to_drm(ctx->mgr->adev), in amdgpu_ctx_get_entity()
453 drm_dbg(adev_to_drm(ctx->mgr->adev), in amdgpu_ctx_get_entity()
481 struct amdgpu_ctx_mgr *mgr = &fpriv->ctx_mgr; in amdgpu_ctx_alloc() local
489 mutex_lock(&mgr->lock); in amdgpu_ctx_alloc()
490 r = idr_alloc(&mgr->ctx_handles, ctx, 1, AMDGPU_VM_MAX_NUM_CTX, GFP_KERNEL); in amdgpu_ctx_alloc()
492 mutex_unlock(&mgr->lock); in amdgpu_ctx_alloc()
498 r = amdgpu_ctx_init(mgr, priority, filp, ctx); in amdgpu_ctx_alloc()
500 idr_remove(&mgr->ctx_handles, *id); in amdgpu_ctx_alloc()
504 mutex_unlock(&mgr->lock); in amdgpu_ctx_alloc()
528 struct amdgpu_ctx_mgr *mgr = &fpriv->ctx_mgr; in amdgpu_ctx_free() local
531 mutex_lock(&mgr->lock); in amdgpu_ctx_free()
532 ctx = idr_remove(&mgr->ctx_handles, id); in amdgpu_ctx_free()
535 mutex_unlock(&mgr->lock); in amdgpu_ctx_free()
544 struct amdgpu_ctx_mgr *mgr; in amdgpu_ctx_query() local
550 mgr = &fpriv->ctx_mgr; in amdgpu_ctx_query()
551 mutex_lock(&mgr->lock); in amdgpu_ctx_query()
552 ctx = idr_find(&mgr->ctx_handles, id); in amdgpu_ctx_query()
554 mutex_unlock(&mgr->lock); in amdgpu_ctx_query()
571 mutex_unlock(&mgr->lock); in amdgpu_ctx_query()
583 struct amdgpu_ctx_mgr *mgr; in amdgpu_ctx_query2() local
588 mgr = &fpriv->ctx_mgr; in amdgpu_ctx_query2()
589 mutex_lock(&mgr->lock); in amdgpu_ctx_query2()
590 ctx = idr_find(&mgr->ctx_handles, id); in amdgpu_ctx_query2()
592 mutex_unlock(&mgr->lock); in amdgpu_ctx_query2()
635 mutex_unlock(&mgr->lock); in amdgpu_ctx_query2()
644 struct amdgpu_ctx_mgr *mgr; in amdgpu_ctx_stable_pstate() local
650 mgr = &fpriv->ctx_mgr; in amdgpu_ctx_stable_pstate()
651 mutex_lock(&mgr->lock); in amdgpu_ctx_stable_pstate()
652 ctx = idr_find(&mgr->ctx_handles, id); in amdgpu_ctx_stable_pstate()
654 mutex_unlock(&mgr->lock); in amdgpu_ctx_stable_pstate()
663 mutex_unlock(&mgr->lock); in amdgpu_ctx_stable_pstate()
735 struct amdgpu_ctx_mgr *mgr; in amdgpu_ctx_get() local
740 mgr = &fpriv->ctx_mgr; in amdgpu_ctx_get()
742 mutex_lock(&mgr->lock); in amdgpu_ctx_get()
743 ctx = idr_find(&mgr->ctx_handles, id); in amdgpu_ctx_get()
746 mutex_unlock(&mgr->lock); in amdgpu_ctx_get()
780 &ctx->mgr->time_spend[centity->hw_ip]); in amdgpu_ctx_add_fence()
820 struct amdgpu_device *adev = ctx->mgr->adev; in amdgpu_ctx_set_entity_priority()
879 drm_err(adev_to_drm(ctx->mgr->adev), in amdgpu_ctx_wait_prev_fence()
886 void amdgpu_ctx_mgr_init(struct amdgpu_ctx_mgr *mgr, in amdgpu_ctx_mgr_init() argument
891 mgr->adev = adev; in amdgpu_ctx_mgr_init()
892 mutex_init(&mgr->lock); in amdgpu_ctx_mgr_init()
893 idr_init_base(&mgr->ctx_handles, 1); in amdgpu_ctx_mgr_init()
896 atomic64_set(&mgr->time_spend[i], 0); in amdgpu_ctx_mgr_init()
899 long amdgpu_ctx_mgr_entity_flush(struct amdgpu_ctx_mgr *mgr, long timeout) in amdgpu_ctx_mgr_entity_flush() argument
905 idp = &mgr->ctx_handles; in amdgpu_ctx_mgr_entity_flush()
907 mutex_lock(&mgr->lock); in amdgpu_ctx_mgr_entity_flush()
921 mutex_unlock(&mgr->lock); in amdgpu_ctx_mgr_entity_flush()
925 static void amdgpu_ctx_mgr_entity_fini(struct amdgpu_ctx_mgr *mgr) in amdgpu_ctx_mgr_entity_fini() argument
931 idp = &mgr->ctx_handles; in amdgpu_ctx_mgr_entity_fini()
935 drm_err(adev_to_drm(mgr->adev), "ctx %p is still alive\n", ctx); in amdgpu_ctx_mgr_entity_fini()
954 void amdgpu_ctx_mgr_fini(struct amdgpu_ctx_mgr *mgr) in amdgpu_ctx_mgr_fini() argument
956 amdgpu_ctx_mgr_entity_fini(mgr); in amdgpu_ctx_mgr_fini()
957 idr_destroy(&mgr->ctx_handles); in amdgpu_ctx_mgr_fini()
958 mutex_destroy(&mgr->lock); in amdgpu_ctx_mgr_fini()
961 void amdgpu_ctx_mgr_usage(struct amdgpu_ctx_mgr *mgr, in amdgpu_ctx_mgr_usage() argument
973 mutex_lock(&mgr->lock); in amdgpu_ctx_mgr_usage()
975 uint64_t ns = atomic64_read(&mgr->time_spend[hw_ip]); in amdgpu_ctx_mgr_usage()
980 idr_for_each_entry(&mgr->ctx_handles, ctx, id) { in amdgpu_ctx_mgr_usage()
994 mutex_unlock(&mgr->lock); in amdgpu_ctx_mgr_usage()