Lines Matching refs:teedev
16 struct tee_device *teedev = shm->teedev; in tee_shm_release() local
18 mutex_lock(&teedev->mutex); in tee_shm_release()
19 idr_remove(&teedev->idr, shm->id); in tee_shm_release()
22 mutex_unlock(&teedev->mutex); in tee_shm_release()
28 poolm = teedev->pool->dma_buf_mgr; in tee_shm_release()
30 poolm = teedev->pool->private_mgr; in tee_shm_release()
35 int rc = teedev->desc->ops->shm_unregister(shm->ctx, shm); in tee_shm_release()
38 dev_err(teedev->dev.parent, in tee_shm_release()
52 tee_device_put(teedev); in tee_shm_release()
101 struct tee_device *teedev, in __tee_shm_alloc() argument
109 if (ctx && ctx->teedev != teedev) { in __tee_shm_alloc()
110 dev_err(teedev->dev.parent, "ctx and teedev mismatch\n"); in __tee_shm_alloc()
115 dev_err(teedev->dev.parent, in __tee_shm_alloc()
121 dev_err(teedev->dev.parent, "invalid shm flags 0x%x", flags); in __tee_shm_alloc()
125 if (!tee_device_get(teedev)) in __tee_shm_alloc()
128 if (!teedev->pool) { in __tee_shm_alloc()
141 shm->teedev = teedev; in __tee_shm_alloc()
144 poolm = teedev->pool->dma_buf_mgr; in __tee_shm_alloc()
146 poolm = teedev->pool->private_mgr; in __tee_shm_alloc()
154 mutex_lock(&teedev->mutex); in __tee_shm_alloc()
155 shm->id = idr_alloc(&teedev->idr, shm, 1, 0, GFP_KERNEL); in __tee_shm_alloc()
156 mutex_unlock(&teedev->mutex); in __tee_shm_alloc()
179 mutex_lock(&teedev->mutex); in __tee_shm_alloc()
181 mutex_unlock(&teedev->mutex); in __tee_shm_alloc()
186 mutex_lock(&teedev->mutex); in __tee_shm_alloc()
187 idr_remove(&teedev->idr, shm->id); in __tee_shm_alloc()
188 mutex_unlock(&teedev->mutex); in __tee_shm_alloc()
194 tee_device_put(teedev); in __tee_shm_alloc()
212 return __tee_shm_alloc(ctx, ctx->teedev, size, flags); in tee_shm_alloc()
216 struct tee_shm *tee_shm_priv_alloc(struct tee_device *teedev, size_t size) in tee_shm_priv_alloc() argument
218 return __tee_shm_alloc(NULL, teedev, size, TEE_SHM_MAPPED); in tee_shm_priv_alloc()
225 struct tee_device *teedev = ctx->teedev; in tee_shm_register() local
236 if (!tee_device_get(teedev)) in tee_shm_register()
239 if (!teedev->desc->ops->shm_register || in tee_shm_register()
240 !teedev->desc->ops->shm_unregister) { in tee_shm_register()
241 tee_device_put(teedev); in tee_shm_register()
254 shm->teedev = teedev; in tee_shm_register()
278 mutex_lock(&teedev->mutex); in tee_shm_register()
279 shm->id = idr_alloc(&teedev->idr, shm, 1, 0, GFP_KERNEL); in tee_shm_register()
280 mutex_unlock(&teedev->mutex); in tee_shm_register()
287 rc = teedev->desc->ops->shm_register(ctx, shm, shm->pages, in tee_shm_register()
305 teedev->desc->ops->shm_unregister(ctx, shm); in tee_shm_register()
310 mutex_lock(&teedev->mutex); in tee_shm_register()
312 mutex_unlock(&teedev->mutex); in tee_shm_register()
320 mutex_lock(&teedev->mutex); in tee_shm_register()
321 idr_remove(&teedev->idr, shm->id); in tee_shm_register()
322 mutex_unlock(&teedev->mutex); in tee_shm_register()
332 tee_device_put(teedev); in tee_shm_register()
470 struct tee_device *teedev; in tee_shm_get_from_id() local
476 teedev = ctx->teedev; in tee_shm_get_from_id()
477 mutex_lock(&teedev->mutex); in tee_shm_get_from_id()
478 shm = idr_find(&teedev->idr, id); in tee_shm_get_from_id()
483 mutex_unlock(&teedev->mutex); in tee_shm_get_from_id()