AMDTEE add return origin to load TA command

-----BEGIN PGP SIGNATURE-----
 
 iQJOBAABCgA4FiEEFV+gSSXZJY9ZyuB5LinzTIcAHJcFAmR+4agaHGplbnMud2lr
 bGFuZGVyQGxpbmFyby5vcmcACgkQLinzTIcAHJe8Jw//ccNGhzOrZrDHgHc/nx19
 PitJyk1eaGNIwMzKx/ZqP7mj2JlnQMuylPWGvxQYmzLYwNupraWJfK2El+mysAnS
 yMqXo51jKkiYS+z4MugctZClbr8BuAwHfCvRbvJjOTIuUEh1ba2lF4+r4+IyVDtW
 GS6psA85XkCpklkss21UOylpQHTECMFwH66CVTepzE6p4Lw8lNvSJObH03ssMpx3
 +z0E5FuQITs/BeCJTLB8spl+KFCnvSUp8hmVpUzAMoIWhs0339GjxsQvFF6CYcId
 OQrJCJ40nmrXWkkbaonPJswIjEblB1op5Oq5+anY+2pZuOwcJAGi/nTaomL892nE
 KSY5sGYB/4q1fXkHSESc/53xsjz2YPl+2iaViaZjMzPXt4bXs8c1bYRn4RQnRoFB
 ITfGXx1nWwMWC895Mf+ffB1ZP+k9Be6YLtcnaHCGI2FKVL7kPUuyv7afYCL1/ppe
 UduI+aI507C6K67VvOpymxx76fcZU0T4J6JOf/cVz208qOiIDALCkfMgMoCsArLP
 VH+zXOX8UzBWEGGnREIHuzu2bXR4TwvYx1E07mGEwO/8FUTI/pQlfSEH6ehlmzHA
 QxGBHmeoj3IVhUBg2d6S8UtU3DumCZMNl4R1GSTpfLdQQvAIi49bRzoV5AZzFKd9
 VUlXTD8/SOPkD6Z8G66XC7k=
 =d2FU
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmSAYs4ACgkQYKtH/8kJ
 Uie7Yw//Qy8kBBpxx6hZiDY+MMq46vjkBvhP0i17llsQ0RVP/Xq6C9JD+E/u/KEq
 i6D53KVEpfb1K6/28SvyzXgiJ1rVuDNV3BO4KmB+ov+vZ6drSZS8jhnNRzK/7dbH
 LIfic0zxQS7SKEe95DC0z0/GoferaMvUkmrUbVXsSb32I0Ry0dA2zwkpo9Xo/YOI
 6nSwefurovppSrMZ3EChDSYqHrktzkdkdeKHFa0+Hr7cbgTibISn1JGcXztjARa0
 Sy8F6e/h4r8wQOy3yJEzKvEeSsE7BJT9NRK4BspVicMWcReioENl1e3flfCwzTa+
 ewz4TzWP9DWaXL9oJT16kzjbrlWPkfjNU1Mqn/vl1+dbYApyLLN3Ai2ivoC0Fciw
 7yZoNcMPws3l0xECNTxXIMuLBcRGpdbTof8fFwn++ckNoybFJmPe4LzLgiKJ+B72
 glnsKdUglIOcZea4WUIp/ya3CkgUHbAGhy42P5Tbd5hJBCnNZ+hheFDbrUCc9/K/
 xOZswe+DKstPB2KOMxJgkjH8zQv5Ua959zy8Jfg8uq5MsHUV0PVxc03rp4FjDdD8
 gaENrW7GQzxAStb/+YrBYoeMIFr9f9zA0yv0y92G3gBERupOc0VcFNopPFnHxvn+
 +pum0SVSsqU1o9dwT9pchjwX7TQr/yKJvejvGFEoC4vSVgytdso=
 =8LYO
 -----END PGP SIGNATURE-----

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:
Arnd Bergmann 2023-06-07 12:58:22 +02:00
commit abd649fdf9
2 changed files with 22 additions and 16 deletions

View File

@ -118,16 +118,18 @@ struct tee_cmd_unmap_shared_mem {
/**
* 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
* @hi_addr: [in] bits [63:32] of the physical address of the TA binary
* @size: [in] size of TA binary in bytes
* @ta_handle: [out] return handle of the loaded TA
* @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
* @size: [in] size of TA binary in bytes
* @ta_handle: [out] return handle of the loaded TA
* @return_origin: [out] origin of return code after TEE processing
*/
struct tee_cmd_load_ta {
u32 low_addr;
u32 hi_addr;
u32 size;
u32 ta_handle;
u32 return_origin;
};
/**

View File

@ -423,19 +423,23 @@ int handle_load_ta(void *data, u32 size, struct tee_ioctl_open_session_arg *arg)
if (ret) {
arg->ret_origin = TEEC_ORIGIN_COMMS;
arg->ret = TEEC_ERROR_COMMUNICATION;
} else if (arg->ret == TEEC_SUCCESS) {
ret = get_ta_refcount(load_cmd.ta_handle);
if (!ret) {
arg->ret_origin = TEEC_ORIGIN_COMMS;
arg->ret = TEEC_ERROR_OUT_OF_MEMORY;
} else {
arg->ret_origin = load_cmd.return_origin;
/* 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);
if (arg->ret == TEEC_SUCCESS) {
ret = get_ta_refcount(load_cmd.ta_handle);
if (!ret) {
arg->ret_origin = TEEC_ORIGIN_COMMS;
arg->ret = TEEC_ERROR_OUT_OF_MEMORY;
/* 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);