tee: add kernel internal client interface
Adds a kernel internal TEE client interface to be used by other drivers. Reviewed-by: Sumit Garg <sumit.garg@linaro.org> Tested-by: Sumit Garg <sumit.garg@linaro.org> Tested-by: Zeng Tao <prime.zeng@hisilicon.com> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
This commit is contained in:
@@ -453,6 +453,79 @@ static inline int tee_shm_get_id(struct tee_shm *shm)
|
||||
*/
|
||||
struct tee_shm *tee_shm_get_from_id(struct tee_context *ctx, int id);
|
||||
|
||||
/**
|
||||
* tee_client_open_context() - Open a TEE context
|
||||
* @start: if not NULL, continue search after this context
|
||||
* @match: function to check TEE device
|
||||
* @data: data for match function
|
||||
* @vers: if not NULL, version data of TEE device of the context returned
|
||||
*
|
||||
* This function does an operation similar to open("/dev/teeX") in user space.
|
||||
* A returned context must be released with tee_client_close_context().
|
||||
*
|
||||
* Returns a TEE context of the first TEE device matched by the match()
|
||||
* callback or an ERR_PTR.
|
||||
*/
|
||||
struct tee_context *
|
||||
tee_client_open_context(struct tee_context *start,
|
||||
int (*match)(struct tee_ioctl_version_data *,
|
||||
const void *),
|
||||
const void *data, struct tee_ioctl_version_data *vers);
|
||||
|
||||
/**
|
||||
* tee_client_close_context() - Close a TEE context
|
||||
* @ctx: TEE context to close
|
||||
*
|
||||
* Note that all sessions previously opened with this context will be
|
||||
* closed when this function is called.
|
||||
*/
|
||||
void tee_client_close_context(struct tee_context *ctx);
|
||||
|
||||
/**
|
||||
* tee_client_get_version() - Query version of TEE
|
||||
* @ctx: TEE context to TEE to query
|
||||
* @vers: Pointer to version data
|
||||
*/
|
||||
void tee_client_get_version(struct tee_context *ctx,
|
||||
struct tee_ioctl_version_data *vers);
|
||||
|
||||
/**
|
||||
* tee_client_open_session() - Open a session to a Trusted Application
|
||||
* @ctx: TEE context
|
||||
* @arg: Open session arguments, see description of
|
||||
* struct tee_ioctl_open_session_arg
|
||||
* @param: Parameters passed to the Trusted Application
|
||||
*
|
||||
* Returns < 0 on error else see @arg->ret for result. If @arg->ret
|
||||
* is TEEC_SUCCESS the session identifier is available in @arg->session.
|
||||
*/
|
||||
int tee_client_open_session(struct tee_context *ctx,
|
||||
struct tee_ioctl_open_session_arg *arg,
|
||||
struct tee_param *param);
|
||||
|
||||
/**
|
||||
* tee_client_close_session() - Close a session to a Trusted Application
|
||||
* @ctx: TEE Context
|
||||
* @session: Session id
|
||||
*
|
||||
* Return < 0 on error else 0, regardless the session will not be
|
||||
* valid after this function has returned.
|
||||
*/
|
||||
int tee_client_close_session(struct tee_context *ctx, u32 session);
|
||||
|
||||
/**
|
||||
* tee_client_invoke_func() - Invoke a function in a Trusted Application
|
||||
* @ctx: TEE Context
|
||||
* @arg: Invoke arguments, see description of
|
||||
* struct tee_ioctl_invoke_arg
|
||||
* @param: Parameters passed to the Trusted Application
|
||||
*
|
||||
* Returns < 0 on error else see @arg->ret for result.
|
||||
*/
|
||||
int tee_client_invoke_func(struct tee_context *ctx,
|
||||
struct tee_ioctl_invoke_arg *arg,
|
||||
struct tee_param *param);
|
||||
|
||||
static inline bool tee_param_is_memref(struct tee_param *param)
|
||||
{
|
||||
switch (param->attr & TEE_IOCTL_PARAM_ATTR_TYPE_MASK) {
|
||||
|
Reference in New Issue
Block a user