tee: new ioctl to a register tee_shm from a dmabuf file descriptor
authorEtienne Carriere <etienne.carriere@foss.st.com>
Wed, 13 Aug 2025 06:02:54 +0000 (08:02 +0200)
committerJens Wiklander <jens.wiklander@linaro.org>
Thu, 11 Sep 2025 09:22:29 +0000 (11:22 +0200)
commit146bf4e75ecab9759ed78c9d167e860042d627fb
tree023d452fa4e4c405f17ba1a630e039296ff6fd32
parentfdf631ac9ee671c49febdc503f8287a82497f559
tee: new ioctl to a register tee_shm from a dmabuf file descriptor

Add a userspace API to create a tee_shm object that refers to a dmabuf
reference.

Userspace registers the dmabuf file descriptor as in a tee_shm object.
The registration is completed with a tee_shm returned file descriptor.

Userspace is free to close the dmabuf file descriptor after it has been
registered since all the resources are now held via the new tee_shm
object.

Closing the tee_shm file descriptor will eventually release all
resources used by the tee_shm object when all references are released.

The new IOCTL, TEE_IOC_SHM_REGISTER_FD, supports dmabuf references to
physically contiguous memory buffers. Dmabuf references acquired from
the TEE DMA-heap can be used as protected memory for Secure Video Path
and such use cases. It depends on the TEE and the TEE driver if dmabuf
references acquired by other means can be used.

A new tee_shm flag is added to identify tee_shm objects built from a
registered dmabuf, TEE_SHM_DMA_BUF.

Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
Signed-off-by: Olivier Masse <olivier.masse@nxp.com>
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
drivers/tee/tee_core.c
drivers/tee/tee_private.h
drivers/tee/tee_shm.c
include/linux/tee_core.h
include/linux/tee_drv.h
include/uapi/linux/tee.h