optee_open_session()c
| 2024-12-1
本文字數 188閱讀時長 1 分鐘
  • optee_open_session()
    • Call optee_get_msg_arg() to allocate the shared memory for the message arg (struct optee_msg_arg).
    • Call tee_session_calc_client_uuid() to create Linux environment client UUID from the session arg.
    • Initialize message arg and add the meta parameters needed when opening a session with the session arg and Linux environment client UUID.
    • Call optee->ops->to_msg_param() to convert the passed-in struct tee_param to OPTEE_MSG parameters (struct optee_msg_arg). Save the converted OPTEE_MSG parameters to message arg.
      • E.g. optee_to_msg_param()
    • Call optee->ops->do_call_with_arg() with the command: OPTEE_MSG_CMD_OPEN_SESSION to enter OP-TEE in secure world with the message arg.
      • E.g. optee_smc_do_call_with_arg()
      • OP-TEE will call entry_open_session() to open the session based on the UUID (tee_ioctl_open_session_arg->uuid, e.g. PTA UUID) passed from Linux. The UUID is used to look up or initialize the TA with the same UUID. The opened session ID is saved to the message arg and passed back to Linux.
    • If optee_smc_do_call_with_arg() returns success, add the session to the sessions list (ctxdata->sess_list)
      • Call optee->ops->from_msg_param() to convert the returned session OPTEE_MSG parameters to struct tee_param. Update the results to session arg.
        • E.g. optee_from_msg_param()
          • Store the open session ID to struct tee_ioctl_open_session_arg->session.
        • If conversion fails, call optee_close_session() to close the session.
    • Call optee_free_msg_arg() to free the allocated message arg.
Loading...
目錄