mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 16:13:19 +09:00
Merge tag 'amdtee-fix-for-v6.5' of https://git.linaro.org/people/jens.wiklander/linux-tee into arm/fixes
AMDTEE add return origin to load TA command * tag 'amdtee-fix-for-v6.5' of https://git.linaro.org/people/jens.wiklander/linux-tee: tee: amdtee: Add return_origin to 'struct tee_cmd_load_ta' Link: https://lore.kernel.org/r/20230606075843.GA2792442@rayden Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
@@ -118,16 +118,18 @@ struct tee_cmd_unmap_shared_mem {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* struct tee_cmd_load_ta - load Trusted Application (TA) binary into TEE
|
* struct tee_cmd_load_ta - load Trusted Application (TA) binary into TEE
|
||||||
* @low_addr: [in] bits [31:0] of the physical address of the TA binary
|
* @low_addr: [in] bits [31:0] of the physical address of the TA binary
|
||||||
* @hi_addr: [in] bits [63:32] of the physical address of the TA binary
|
* @hi_addr: [in] bits [63:32] of the physical address of the TA binary
|
||||||
* @size: [in] size of TA binary in bytes
|
* @size: [in] size of TA binary in bytes
|
||||||
* @ta_handle: [out] return handle of the loaded TA
|
* @ta_handle: [out] return handle of the loaded TA
|
||||||
|
* @return_origin: [out] origin of return code after TEE processing
|
||||||
*/
|
*/
|
||||||
struct tee_cmd_load_ta {
|
struct tee_cmd_load_ta {
|
||||||
u32 low_addr;
|
u32 low_addr;
|
||||||
u32 hi_addr;
|
u32 hi_addr;
|
||||||
u32 size;
|
u32 size;
|
||||||
u32 ta_handle;
|
u32 ta_handle;
|
||||||
|
u32 return_origin;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -423,19 +423,23 @@ int handle_load_ta(void *data, u32 size, struct tee_ioctl_open_session_arg *arg)
|
|||||||
if (ret) {
|
if (ret) {
|
||||||
arg->ret_origin = TEEC_ORIGIN_COMMS;
|
arg->ret_origin = TEEC_ORIGIN_COMMS;
|
||||||
arg->ret = TEEC_ERROR_COMMUNICATION;
|
arg->ret = TEEC_ERROR_COMMUNICATION;
|
||||||
} else if (arg->ret == TEEC_SUCCESS) {
|
} else {
|
||||||
ret = get_ta_refcount(load_cmd.ta_handle);
|
arg->ret_origin = load_cmd.return_origin;
|
||||||
if (!ret) {
|
|
||||||
arg->ret_origin = TEEC_ORIGIN_COMMS;
|
|
||||||
arg->ret = TEEC_ERROR_OUT_OF_MEMORY;
|
|
||||||
|
|
||||||
/* Unload the TA on error */
|
if (arg->ret == TEEC_SUCCESS) {
|
||||||
unload_cmd.ta_handle = load_cmd.ta_handle;
|
ret = get_ta_refcount(load_cmd.ta_handle);
|
||||||
psp_tee_process_cmd(TEE_CMD_ID_UNLOAD_TA,
|
if (!ret) {
|
||||||
(void *)&unload_cmd,
|
arg->ret_origin = TEEC_ORIGIN_COMMS;
|
||||||
sizeof(unload_cmd), &ret);
|
arg->ret = TEEC_ERROR_OUT_OF_MEMORY;
|
||||||
} else {
|
|
||||||
set_session_id(load_cmd.ta_handle, 0, &arg->session);
|
/* Unload the TA on error */
|
||||||
|
unload_cmd.ta_handle = load_cmd.ta_handle;
|
||||||
|
psp_tee_process_cmd(TEE_CMD_ID_UNLOAD_TA,
|
||||||
|
(void *)&unload_cmd,
|
||||||
|
sizeof(unload_cmd), &ret);
|
||||||
|
} else {
|
||||||
|
set_session_id(load_cmd.ta_handle, 0, &arg->session);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mutex_unlock(&ta_refcount_mutex);
|
mutex_unlock(&ta_refcount_mutex);
|
||||||
|
|||||||
Reference in New Issue
Block a user