Lines Matching refs:teedev
73 static void tee_shm_release(struct tee_device *teedev, struct tee_shm *shm) in tee_shm_release() argument
76 teedev->pool->ops->free(teedev->pool, shm); in tee_shm_release()
78 int rc = teedev->desc->ops->shm_unregister(shm->ctx, shm); in tee_shm_release()
81 dev_err(teedev->dev.parent, in tee_shm_release()
91 tee_device_put(teedev); in tee_shm_release()
97 struct tee_device *teedev = ctx->teedev; in shm_alloc_helper() local
102 if (!tee_device_get(teedev)) in shm_alloc_helper()
105 if (!teedev->pool) { in shm_alloc_helper()
129 rc = teedev->pool->ops->alloc(teedev->pool, shm, size, align); in shm_alloc_helper()
140 tee_device_put(teedev); in shm_alloc_helper()
159 struct tee_device *teedev = ctx->teedev; in tee_shm_alloc_user_buf() local
164 mutex_lock(&teedev->mutex); in tee_shm_alloc_user_buf()
165 id = idr_alloc(&teedev->idr, NULL, 1, 0, GFP_KERNEL); in tee_shm_alloc_user_buf()
166 mutex_unlock(&teedev->mutex); in tee_shm_alloc_user_buf()
172 mutex_lock(&teedev->mutex); in tee_shm_alloc_user_buf()
173 idr_remove(&teedev->idr, id); in tee_shm_alloc_user_buf()
174 mutex_unlock(&teedev->mutex); in tee_shm_alloc_user_buf()
178 mutex_lock(&teedev->mutex); in tee_shm_alloc_user_buf()
179 ret = idr_replace(&teedev->idr, shm, id); in tee_shm_alloc_user_buf()
180 mutex_unlock(&teedev->mutex); in tee_shm_alloc_user_buf()
237 struct tee_device *teedev = ctx->teedev; in register_shm_helper() local
244 if (!tee_device_get(teedev)) in register_shm_helper()
247 if (!teedev->desc->ops->shm_register || in register_shm_helper()
248 !teedev->desc->ops->shm_unregister) { in register_shm_helper()
290 rc = teedev->desc->ops->shm_register(ctx, shm, shm->pages, in register_shm_helper()
309 tee_device_put(teedev); in register_shm_helper()
325 struct tee_device *teedev = ctx->teedev; in tee_shm_register_user_buf() local
333 mutex_lock(&teedev->mutex); in tee_shm_register_user_buf()
334 id = idr_alloc(&teedev->idr, NULL, 1, 0, GFP_KERNEL); in tee_shm_register_user_buf()
335 mutex_unlock(&teedev->mutex); in tee_shm_register_user_buf()
341 mutex_lock(&teedev->mutex); in tee_shm_register_user_buf()
342 idr_remove(&teedev->idr, id); in tee_shm_register_user_buf()
343 mutex_unlock(&teedev->mutex); in tee_shm_register_user_buf()
347 mutex_lock(&teedev->mutex); in tee_shm_register_user_buf()
348 ret = idr_replace(&teedev->idr, shm, id); in tee_shm_register_user_buf()
349 mutex_unlock(&teedev->mutex); in tee_shm_register_user_buf()
480 struct tee_device *teedev; in tee_shm_get_from_id() local
486 teedev = ctx->teedev; in tee_shm_get_from_id()
487 mutex_lock(&teedev->mutex); in tee_shm_get_from_id()
488 shm = idr_find(&teedev->idr, id); in tee_shm_get_from_id()
498 mutex_unlock(&teedev->mutex); in tee_shm_get_from_id()
509 struct tee_device *teedev = shm->ctx->teedev; in tee_shm_put() local
512 mutex_lock(&teedev->mutex); in tee_shm_put()
521 idr_remove(&teedev->idr, shm->id); in tee_shm_put()
524 mutex_unlock(&teedev->mutex); in tee_shm_put()
527 tee_shm_release(teedev, shm); in tee_shm_put()