Lines Matching refs:teedev
46 static void tee_shm_release(struct tee_device *teedev, struct tee_shm *shm) in tee_shm_release() argument
49 teedev->pool->ops->free(teedev->pool, shm); in tee_shm_release()
51 int rc = teedev->desc->ops->shm_unregister(shm->ctx, shm); in tee_shm_release()
54 dev_err(teedev->dev.parent, in tee_shm_release()
64 tee_device_put(teedev); in tee_shm_release()
70 struct tee_device *teedev = ctx->teedev; in shm_alloc_helper() local
75 if (!tee_device_get(teedev)) in shm_alloc_helper()
78 if (!teedev->pool) { in shm_alloc_helper()
102 rc = teedev->pool->ops->alloc(teedev->pool, shm, size, align); in shm_alloc_helper()
113 tee_device_put(teedev); in shm_alloc_helper()
132 struct tee_device *teedev = ctx->teedev; in tee_shm_alloc_user_buf() local
137 mutex_lock(&teedev->mutex); in tee_shm_alloc_user_buf()
138 id = idr_alloc(&teedev->idr, NULL, 1, 0, GFP_KERNEL); in tee_shm_alloc_user_buf()
139 mutex_unlock(&teedev->mutex); in tee_shm_alloc_user_buf()
145 mutex_lock(&teedev->mutex); in tee_shm_alloc_user_buf()
146 idr_remove(&teedev->idr, id); in tee_shm_alloc_user_buf()
147 mutex_unlock(&teedev->mutex); in tee_shm_alloc_user_buf()
151 mutex_lock(&teedev->mutex); in tee_shm_alloc_user_buf()
152 ret = idr_replace(&teedev->idr, shm, id); in tee_shm_alloc_user_buf()
153 mutex_unlock(&teedev->mutex); in tee_shm_alloc_user_buf()
274 struct tee_device *teedev = ctx->teedev; in register_shm_helper() local
282 if (!tee_device_get(teedev)) in register_shm_helper()
285 if (!teedev->desc->ops->shm_register || in register_shm_helper()
286 !teedev->desc->ops->shm_unregister) { in register_shm_helper()
335 rc = teedev->desc->ops->shm_register(ctx, shm, shm->pages, in register_shm_helper()
355 tee_device_put(teedev); in register_shm_helper()
371 struct tee_device *teedev = ctx->teedev; in tee_shm_register_user_buf() local
380 mutex_lock(&teedev->mutex); in tee_shm_register_user_buf()
381 id = idr_alloc(&teedev->idr, NULL, 1, 0, GFP_KERNEL); in tee_shm_register_user_buf()
382 mutex_unlock(&teedev->mutex); in tee_shm_register_user_buf()
389 mutex_lock(&teedev->mutex); in tee_shm_register_user_buf()
390 idr_remove(&teedev->idr, id); in tee_shm_register_user_buf()
391 mutex_unlock(&teedev->mutex); in tee_shm_register_user_buf()
395 mutex_lock(&teedev->mutex); in tee_shm_register_user_buf()
396 ret = idr_replace(&teedev->idr, shm, id); in tee_shm_register_user_buf()
397 mutex_unlock(&teedev->mutex); in tee_shm_register_user_buf()
534 struct tee_device *teedev; in tee_shm_get_from_id() local
540 teedev = ctx->teedev; in tee_shm_get_from_id()
541 mutex_lock(&teedev->mutex); in tee_shm_get_from_id()
542 shm = idr_find(&teedev->idr, id); in tee_shm_get_from_id()
552 mutex_unlock(&teedev->mutex); in tee_shm_get_from_id()
563 struct tee_device *teedev = shm->ctx->teedev; in tee_shm_put() local
566 mutex_lock(&teedev->mutex); in tee_shm_put()
575 idr_remove(&teedev->idr, shm->id); in tee_shm_put()
578 mutex_unlock(&teedev->mutex); in tee_shm_put()
581 tee_shm_release(teedev, shm); in tee_shm_put()