-
Notifications
You must be signed in to change notification settings - Fork 109
Support OP-TEE dynamic shared memory #714
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -185,13 +185,38 @@ pub fn handle_optee_smc_args( | |
| Ok(OpteeSmcResult::CallWithArg { | ||
| msg_args, | ||
| rpc_args: None, | ||
| msg_args_phys_addr: msg_args_addr as u64, | ||
| }) | ||
| } | ||
| OpteeSmcFunction::CallWithRpcArg | OpteeSmcFunction::CallWithRegdArg => { | ||
| OpteeSmcFunction::CallWithRpcArg => { | ||
| let msg_args_addr = smc.optee_msg_args_phys_addr()?; | ||
| let msg_args_addr: usize = msg_args_addr.truncate(); | ||
| let (msg_args, rpc_args) = read_optee_msg_args_from_phys(msg_args_addr, true)?; | ||
| Ok(OpteeSmcResult::CallWithArg { msg_args, rpc_args }) | ||
| Ok(OpteeSmcResult::CallWithArg { | ||
| msg_args, | ||
| rpc_args, | ||
| msg_args_phys_addr: msg_args_addr as u64, | ||
| }) | ||
| } | ||
| OpteeSmcFunction::CallWithRegdArg => { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just curios, when is this method invoked?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the VTL0 side, the optee_smc_do_call_with_arg() function will pass OPTEE_SMC_CALL_WITH_REGD_ARG if the tee shared memory was dynamically allocated |
||
| // `OpteeMsgArgs` is located at the offset specified in args[3] within the shared memory region pointed by args[1]:args[2]. | ||
| let (shm_ref, offset) = smc.optee_regd_shm_ref_and_offset()?; | ||
| let shm_info = shm_ref_map() | ||
| .get(shm_ref) | ||
| .ok_or(OpteeSmcReturnCode::EBadAddr)?; | ||
| let page_index = (shm_info.page_offset + offset) / PAGE_SIZE; | ||
| let offset_in_page = (shm_info.page_offset + offset) % PAGE_SIZE; | ||
|
Comment on lines
+207
to
+208
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it might better to do |
||
| if page_index >= shm_info.page_addrs.len() { | ||
| return Err(OpteeSmcReturnCode::EBadAddr); | ||
| } | ||
| let msg_args_addr = shm_info.page_addrs[page_index].as_usize() + offset_in_page; | ||
|
|
||
| let (msg_args, rpc_args) = read_optee_msg_args_from_phys(msg_args_addr, true)?; | ||
sangho2 marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LiteBox has |
||
| Ok(OpteeSmcResult::CallWithArg { | ||
| msg_args, | ||
| rpc_args, | ||
| msg_args_phys_addr: msg_args_addr as u64, | ||
| }) | ||
| } | ||
| OpteeSmcFunction::ExchangeCapabilities => { | ||
| // TODO: update the below when we support more features | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it require
pub?