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)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:55:38 +0000 (15:55 -0500)
commit14b2a8348106c90cb8e08345082a90563b5d9345
tree4f86d34d36fa789e0fdbb3b04cec5230912c7f6e
parentf1636cd2c9357549841c9560a9c11476373cc3bc
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)
drivers/tee/tee_core.c
drivers/tee/tee_shm.c
include/linux/tee_drv.h
include/uapi/linux/tee.h