Lines Matching refs:teedev
56 static void tee_shm_release(struct tee_device *teedev, struct tee_shm *shm) in tee_shm_release() argument
59 teedev->pool->ops->free(teedev->pool, shm); in tee_shm_release()
61 int rc = teedev->desc->ops->shm_unregister(shm->ctx, shm); in tee_shm_release()
64 dev_err(teedev->dev.parent, in tee_shm_release()
74 tee_device_put(teedev); in tee_shm_release()
80 struct tee_device *teedev = ctx->teedev; in shm_alloc_helper() local
85 if (!tee_device_get(teedev)) in shm_alloc_helper()
88 if (!teedev->pool) { in shm_alloc_helper()
112 rc = teedev->pool->ops->alloc(teedev->pool, shm, size, align); in shm_alloc_helper()
123 tee_device_put(teedev); in shm_alloc_helper()
142 struct tee_device *teedev = ctx->teedev; in tee_shm_alloc_user_buf() local
147 mutex_lock(&teedev->mutex); in tee_shm_alloc_user_buf()
148 id = idr_alloc(&teedev->idr, NULL, 1, 0, GFP_KERNEL); in tee_shm_alloc_user_buf()
149 mutex_unlock(&teedev->mutex); in tee_shm_alloc_user_buf()
155 mutex_lock(&teedev->mutex); in tee_shm_alloc_user_buf()
156 idr_remove(&teedev->idr, id); in tee_shm_alloc_user_buf()
157 mutex_unlock(&teedev->mutex); in tee_shm_alloc_user_buf()
161 mutex_lock(&teedev->mutex); in tee_shm_alloc_user_buf()
162 ret = idr_replace(&teedev->idr, shm, id); in tee_shm_alloc_user_buf()
163 mutex_unlock(&teedev->mutex); in tee_shm_alloc_user_buf()
220 struct tee_device *teedev = ctx->teedev; in register_shm_helper() local
227 if (!tee_device_get(teedev)) in register_shm_helper()
230 if (!teedev->desc->ops->shm_register || in register_shm_helper()
231 !teedev->desc->ops->shm_unregister) { in register_shm_helper()
273 rc = teedev->desc->ops->shm_register(ctx, shm, shm->pages, in register_shm_helper()
292 tee_device_put(teedev); in register_shm_helper()
308 struct tee_device *teedev = ctx->teedev; in tee_shm_register_user_buf() local
316 mutex_lock(&teedev->mutex); in tee_shm_register_user_buf()
317 id = idr_alloc(&teedev->idr, NULL, 1, 0, GFP_KERNEL); in tee_shm_register_user_buf()
318 mutex_unlock(&teedev->mutex); in tee_shm_register_user_buf()
324 mutex_lock(&teedev->mutex); in tee_shm_register_user_buf()
325 idr_remove(&teedev->idr, id); in tee_shm_register_user_buf()
326 mutex_unlock(&teedev->mutex); in tee_shm_register_user_buf()
330 mutex_lock(&teedev->mutex); in tee_shm_register_user_buf()
331 ret = idr_replace(&teedev->idr, shm, id); in tee_shm_register_user_buf()
332 mutex_unlock(&teedev->mutex); in tee_shm_register_user_buf()
463 struct tee_device *teedev; in tee_shm_get_from_id() local
469 teedev = ctx->teedev; in tee_shm_get_from_id()
470 mutex_lock(&teedev->mutex); in tee_shm_get_from_id()
471 shm = idr_find(&teedev->idr, id); in tee_shm_get_from_id()
481 mutex_unlock(&teedev->mutex); in tee_shm_get_from_id()
492 struct tee_device *teedev = shm->ctx->teedev; in tee_shm_put() local
495 mutex_lock(&teedev->mutex); in tee_shm_put()
504 idr_remove(&teedev->idr, shm->id); in tee_shm_put()
507 mutex_unlock(&teedev->mutex); in tee_shm_put()
510 tee_shm_release(teedev, shm); in tee_shm_put()