type
status
date
slug
summary
tags
category
icon
password
The code is based on: https://gitlab.com/riseproject/riscv-optee/linux/-/tree/dev-optee-mpxy
Commit ID:
df5dc01764820f113312f7a39f221b49985bbd7a- Kernel provides a TEE bus infrastructure where a Trusted Application is represented as a device identified via Universally Unique Identifier (UUID) and client drivers register a table of supported device UUIDs.
do_initcalls()
tee_init()- Call
class_register()to registertee_class. - Call
alloc_chrdev_region()to register a range of char device numbers for TEE devices. - 0 ~
TEE_NUM_DEVICES. - Call
bus_register()to registertee_bus_type.
tee_device_register()- Call
cdev_device_add()to add the TEE character device to the system.
tee_open()teedev_open()- Assign
filp->private_datato the allocatedstruct tee_context.
teedev_open()- Allocate
struct tee_contextfor the TEE device. - Assign
tee_context->teedevto TEE device. - Call
teedev->desc->ops->open(). - E.g.
optee_smc_open()
tee_client_open_context()- Call
class_find_device()to look up the TEE devices that match with passed inmatch()(e.g.optee_ctx_match()) under TEE class (tee_class), then callteedev_open()to open the TEE devices.
tee_client_open_session()- Call
ctx->teedev->desc->ops->open_session(). - E.g.
optee_open_session()
tee_client_invoke_func()- Call
teedev->desc->ops->invoke_func() - E.g.
optee_invoke_func()
tee_ioctl()- If
cmd: TEE_IOC_OPEN_SESSION:- …
TEE_IOC_SUPPL_RECV:TEE_IOC_SUPPL_SEND:
tee_ioctl_open_session()- Call
ctx->teedev->desc->ops->open_session(). - E.g.
optee_open_session()
tee_ioctl_supp_recv()- Call
ctx->teedev->desc->ops->supp_recv().
tee_ioctl_supp_send()- Call
ctx->teedev->desc->ops->supp_send().