tee: new ioctl to a register tee_shm from a dmabuf file descriptor
authorEtienne Carriere <etienne.carriere@linaro.org>
Thu, 27 Oct 2016 21:18:35 +0000 (23:18 +0200)
committerLeonard Crestez <leonard.crestez@nxp.com>
Wed, 17 Apr 2019 23:51:34 +0000 (02:51 +0300)
commitcf2ea7c7b563842ce6dfa3fc8c8fafdbdc5ef7c8
tree8c5a126372c29d91f23f28e0a495a0237168f23d
parent90d512cf0abbcc1550bcbdc36f6bebc7c71aa141
tee: new ioctl to a register tee_shm from a dmabuf file descriptor

This change allows userland to create a tee_shm object that refers
to a dmabuf reference.

Userland provides a dmabuf file descriptor as buffer reference.
The created tee_shm object exported as a brand new dmabuf reference
used to provide a clean fd to userland. Userland shall closed this new
fd to release the tee_shm object resources. The initial dmabuf resources
are tracked independently through original dmabuf file descriptor.

Once the buffer is registered and until it is released, TEE driver
keeps a refcount on the registered dmabuf structure.

This change only support dmabuf references that relates to physically
contiguous memory buffers.

New tee_shm flag to identify tee_shm objects built from a registered
dmabuf: TEE_SHM_EXT_DMA_BUF. Such tee_shm structures are flagged both
TEE_SHM_DMA_BUF and TEE_SHM_EXT_DMA_BUF.

Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
From: https://github.com/linaro-swg/linux.git
(cherry picked from commit 41e21e5c405530590dc2dd10b2a8dbe64589840f)

(Vipul: Fixed merge conflicts)
Conflicts:
drivers/tee/tee_core.c
drivers/tee/tee_shm.c
include/linux/tee_drv.h
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
drivers/tee/tee_core.c
drivers/tee/tee_shm.c
include/linux/tee_drv.h
include/uapi/linux/tee.h