optee_probe()
sbi_mpxy_tee_probe()
- Get invoke function.
- E.g.
optee_smccc_smc()
- P.S. SMCCC = SMC Calling Convention, defined by ARM.
optee_msg_api_uid_is_optee_api()
- Check UUID:
- Call the invoke function, e.g.
optee_smccc_smc()
with function ID:OPTEE_SMC_CALLS_UID
to retrieve the UUID. - OP-TEE will return UUID. Return
true
if the returned UUID isOPTEE_MSG_UID
(384fb3e0-e7f8-11e3-af63-0002a5d5c51b
),false
otherwise. optee_msg_get_os_revision()
- Get OS revision
- Call the invoke function, e.g.
optee_smccc_smc()
with function ID:OPTEE_SMC_CALL_GET_OS_REVISION
to get OS version. - OP-TEE will return the OS revision.
optee_msg_api_revision_is_compatible()
- Check whether the API revision is compatible:
- Call the invoke function, e.g.
optee_smccc_smc()
with function ID:OPTEE_SMC_CALLS_REVISION
to retrieve the API revision. - OP-TEE will return the API revision. Return
true
if the returned API revision isOPTEE_MSG_REVISION
(2.0
),false
otherwise. optee_msg_get_thread_count()
- Get OP-TEE thread count:
- Call the invoke function, e.g.
optee_smccc_smc()
with function ID:OPTEE_SMC_GET_THREAD_COUNT
to get the OP-TEE thread count. optee_msg_exchange_capabilities()
- Exchange capabilities between Linux and OP-TEE:
- Linux sets:
- If UP,
OPTEE_SMC_NSEC_CAP_UNIPROCESSOR
. - Call the invoke function, e.g.
optee_smccc_smc()
with function ID:OPTEE_SMC_EXCHANGE_CAPABILITIES
to exchange the capabilities between Linux and OP-TEE. - OP-TEE sets:
- If reserved shared memory is enabled in secure world:
OPTEE_ABI_SEC_CAP_HAVE_RESERVED_SHM
. - If dynamic shared memory is enabled in secure world:
OPTEE_ABI_SEC_CAP_DYNAMIC_SHM
. - If virtualization is enabled in secure world:
OPTEE_ABI_SEC_CAP_VIRTUALIZATION
. - Shared memory with a NULL reference is supported in secure world:
OPTEE_ABI_SEC_CAP_MEMREF_NULL
. - If asynchronous notification of normal world is supported in secure world:
OPTEE_ABI_SEC_CAP_ASYNC_NOTIF
. - Pre-allocating RPC arg struct is supported in secure world:
OPTEE_ABI_SEC_CAP_RPC_ARG
. - If the capabilities has
OPTEE_ABI_SEC_CAP_DYNAMIC_SHM
, create page-based allocator pool based onalloc_pages()
. - If the capabilities has
OPTEE_ABI_SEC_CAP_HAVE_RESERVED_SHM
, use the static memory pool. - Call the invoke function, e.g.
optee_smccc_smc()
with function ID:OPTEE_SMC_GET_SHM_CONFIG
to get the base address and the size of the static memory pool allocated by OP-TEE. - OP-TEE returns
default_nsec_shm_paddr
anddefault_nsec_shm_size
indicating the physical base address and the size of the non-secure shared memory initialized inteecore_init_pub_ram()
. - Non-secured shared memory is declared statically in OP-TEE:
teecore_init_pub_ram()
is declared withearly_init()
whenCFG_CORE_RESERVED_SHM
is defined.- Allocate
struct optee
: optee->ops = &optee_ops
- Call
tee_device_alloc()
to allocate a newstruct tee_device
instance for TEE client device:optee-clnt
withoptee_clnt_desc
.struct optee
is passed asdriver_data
. - The allocated TEE client device is assigned to
optee->teedev
. - Call
tee_device_alloc()
to allocate a newstruct tee_device
instance for TEE supplicant device:optee-supp
withoptee_supp_desc
.struct optee
is passed asdriver_data
. - The allocated TEE supplicant device is assigned to
optee->supp_teedev
. - Call
tee_device_register()
to registeroptee-clnt
device. - Call
tee_device_register()
to registeroptee-supp
device. - Call
platform_set_drvdata()
to setoptee
device driver data to:struct optee
. - Open OP-TEE client device (
optee->teedev
): tee_open()
- This will call
optee_clnt_desc->open()
: optee_smc_open()
- If
OPTEE_SMC_SEC_CAP_ASYNC_NOTIF
capability is supported: - Call
platform_get_irq()
to get (non-secure) IRQ 0. - Call
optee_smc_notif_init_irq()
to request IRQ. - If
irq_is_percpu_devid()
: init_pcpu_irq()
request_percpu_irq()
- IRQ handler:
notif_pcpu_irq_handler()
irq_handler()
- Init work:
optee->smc.notif_pcpu_work
: - Handler:
notif_pcpu_irq_work_fn()
- Create work queue:
optee->smc.notif_pcpu_wq
optee->smc.notif_pcpu_work
is queued intooptee->scm.notif_pcpu_wq
innotif_pcpu_irq_handler()
- Otherwise:
init_irq()
request_threaded_irq()
- IRQ handler:
notif_irq_handler()
irq_handler()
- Handler thread:
notif_irq_thread_fn()
- Call
optee_enumerate_devices()
to enumerate PTA devices (PTA_CMD_GET_DEVICES
).
optee_probe()c
Loading...