Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'tee-housekeeping-for-v5.12' of git://git.linaro.org:/people/jens.wiklander/linux-tee into arm/drivers

TEE subsystem housekeeping

- Fixes some comment typos in header files
- Updates to use flexible-array member instead of zero-length array
- Syncs internal OP-TEE headers with the ones from OP-TEE OS

* tag 'tee-housekeeping-for-v5.12' of git://git.linaro.org:/people/jens.wiklander/linux-tee:
optee: sync OP-TEE headers
tee: optee: fix 'physical' typos
drivers: optee: use flexible-array member instead of zero-length array
tee: fix some comment typos in header files

Link: https://lore.kernel.org/r/20210203120742.GA3624453@jade
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

+183 -193
+9 -149
drivers/tee/optee/optee_msg.h
··· 1 1 /* SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) */ 2 2 /* 3 - * Copyright (c) 2015-2019, Linaro Limited 3 + * Copyright (c) 2015-2021, Linaro Limited 4 4 */ 5 5 #ifndef _OPTEE_MSG_H 6 6 #define _OPTEE_MSG_H ··· 12 12 * This file defines the OP-TEE message protocol used to communicate 13 13 * with an instance of OP-TEE running in secure world. 14 14 * 15 - * This file is divided into three sections. 15 + * This file is divided into two sections. 16 16 * 1. Formatting of messages. 17 17 * 2. Requests from normal world 18 - * 3. Requests from secure world, Remote Procedure Call (RPC), handled by 19 - * tee-supplicant. 20 18 */ 21 19 22 20 /***************************************************************************** ··· 52 54 * Every entry in buffer should point to a 4k page beginning (12 least 53 55 * significant bits must be equal to zero). 54 56 * 55 - * 12 least significant bints of optee_msg_param.u.tmem.buf_ptr should hold page 56 - * offset of the user buffer. 57 + * 12 least significant bits of optee_msg_param.u.tmem.buf_ptr should hold 58 + * page offset of user buffer. 57 59 * 58 60 * So, entries should be placed like members of this structure: 59 61 * ··· 174 176 * @params: the parameters supplied to the OS Command 175 177 * 176 178 * All normal calls to Trusted OS uses this struct. If cmd requires further 177 - * information than what these field holds it can be passed as a parameter 179 + * information than what these fields hold it can be passed as a parameter 178 180 * tagged as meta (setting the OPTEE_MSG_ATTR_META bit in corresponding 179 - * attrs field). All parameters tagged as meta has to come first. 180 - * 181 - * Temp memref parameters can be fragmented if supported by the Trusted OS 182 - * (when optee_smc.h is bearer of this protocol this is indicated with 183 - * OPTEE_SMC_SEC_CAP_UNREGISTERED_SHM). If a logical memref parameter is 184 - * fragmented then has all but the last fragment the 185 - * OPTEE_MSG_ATTR_FRAGMENT bit set in attrs. Even if a memref is fragmented 186 - * it will still be presented as a single logical memref to the Trusted 187 - * Application. 181 + * attrs field). All parameters tagged as meta have to come first. 188 182 */ 189 183 struct optee_msg_arg { 190 184 u32 cmd; ··· 189 199 u32 num_params; 190 200 191 201 /* num_params tells the actual number of element in params */ 192 - struct optee_msg_param params[0]; 202 + struct optee_msg_param params[]; 193 203 }; 194 204 195 205 /** ··· 280 290 * OPTEE_MSG_CMD_REGISTER_SHM registers a shared memory reference. The 281 291 * information is passed as: 282 292 * [in] param[0].attr OPTEE_MSG_ATTR_TYPE_TMEM_INPUT 283 - * [| OPTEE_MSG_ATTR_FRAGMENT] 293 + * [| OPTEE_MSG_ATTR_NONCONTIG] 284 294 * [in] param[0].u.tmem.buf_ptr physical address (of first fragment) 285 295 * [in] param[0].u.tmem.size size (of first fragment) 286 296 * [in] param[0].u.tmem.shm_ref holds shared memory reference 287 - * ... 288 - * The shared memory can optionally be fragmented, temp memrefs can follow 289 - * each other with all but the last with the OPTEE_MSG_ATTR_FRAGMENT bit set. 290 297 * 291 - * OPTEE_MSG_CMD_UNREGISTER_SHM unregisteres a previously registered shared 298 + * OPTEE_MSG_CMD_UNREGISTER_SHM unregisters a previously registered shared 292 299 * memory reference. The information is passed as: 293 300 * [in] param[0].attr OPTEE_MSG_ATTR_TYPE_RMEM_INPUT 294 301 * [in] param[0].u.rmem.shm_ref holds shared memory reference ··· 299 312 #define OPTEE_MSG_CMD_REGISTER_SHM 4 300 313 #define OPTEE_MSG_CMD_UNREGISTER_SHM 5 301 314 #define OPTEE_MSG_FUNCID_CALL_WITH_ARG 0x0004 302 - 303 - /***************************************************************************** 304 - * Part 3 - Requests from secure world, RPC 305 - *****************************************************************************/ 306 - 307 - /* 308 - * All RPC is done with a struct optee_msg_arg as bearer of information, 309 - * struct optee_msg_arg::arg holds values defined by OPTEE_MSG_RPC_CMD_* below 310 - * 311 - * RPC communication with tee-supplicant is reversed compared to normal 312 - * client communication desribed above. The supplicant receives requests 313 - * and sends responses. 314 - */ 315 - 316 - /* 317 - * Load a TA into memory, defined in tee-supplicant 318 - */ 319 - #define OPTEE_MSG_RPC_CMD_LOAD_TA 0 320 - 321 - /* 322 - * Reserved 323 - */ 324 - #define OPTEE_MSG_RPC_CMD_RPMB 1 325 - 326 - /* 327 - * File system access, defined in tee-supplicant 328 - */ 329 - #define OPTEE_MSG_RPC_CMD_FS 2 330 - 331 - /* 332 - * Get time 333 - * 334 - * Returns number of seconds and nano seconds since the Epoch, 335 - * 1970-01-01 00:00:00 +0000 (UTC). 336 - * 337 - * [out] param[0].u.value.a Number of seconds 338 - * [out] param[0].u.value.b Number of nano seconds. 339 - */ 340 - #define OPTEE_MSG_RPC_CMD_GET_TIME 3 341 - 342 - /* 343 - * Wait queue primitive, helper for secure world to implement a wait queue. 344 - * 345 - * If secure world need to wait for a secure world mutex it issues a sleep 346 - * request instead of spinning in secure world. Conversely is a wakeup 347 - * request issued when a secure world mutex with a thread waiting thread is 348 - * unlocked. 349 - * 350 - * Waiting on a key 351 - * [in] param[0].u.value.a OPTEE_MSG_RPC_WAIT_QUEUE_SLEEP 352 - * [in] param[0].u.value.b wait key 353 - * 354 - * Waking up a key 355 - * [in] param[0].u.value.a OPTEE_MSG_RPC_WAIT_QUEUE_WAKEUP 356 - * [in] param[0].u.value.b wakeup key 357 - */ 358 - #define OPTEE_MSG_RPC_CMD_WAIT_QUEUE 4 359 - #define OPTEE_MSG_RPC_WAIT_QUEUE_SLEEP 0 360 - #define OPTEE_MSG_RPC_WAIT_QUEUE_WAKEUP 1 361 - 362 - /* 363 - * Suspend execution 364 - * 365 - * [in] param[0].value .a number of milliseconds to suspend 366 - */ 367 - #define OPTEE_MSG_RPC_CMD_SUSPEND 5 368 - 369 - /* 370 - * Allocate a piece of shared memory 371 - * 372 - * Shared memory can optionally be fragmented, to support that additional 373 - * spare param entries are allocated to make room for eventual fragments. 374 - * The spare param entries has .attr = OPTEE_MSG_ATTR_TYPE_NONE when 375 - * unused. All returned temp memrefs except the last should have the 376 - * OPTEE_MSG_ATTR_FRAGMENT bit set in the attr field. 377 - * 378 - * [in] param[0].u.value.a type of memory one of 379 - * OPTEE_MSG_RPC_SHM_TYPE_* below 380 - * [in] param[0].u.value.b requested size 381 - * [in] param[0].u.value.c required alignment 382 - * 383 - * [out] param[0].u.tmem.buf_ptr physical address (of first fragment) 384 - * [out] param[0].u.tmem.size size (of first fragment) 385 - * [out] param[0].u.tmem.shm_ref shared memory reference 386 - * ... 387 - * [out] param[n].u.tmem.buf_ptr physical address 388 - * [out] param[n].u.tmem.size size 389 - * [out] param[n].u.tmem.shm_ref shared memory reference (same value 390 - * as in param[n-1].u.tmem.shm_ref) 391 - */ 392 - #define OPTEE_MSG_RPC_CMD_SHM_ALLOC 6 393 - /* Memory that can be shared with a non-secure user space application */ 394 - #define OPTEE_MSG_RPC_SHM_TYPE_APPL 0 395 - /* Memory only shared with non-secure kernel */ 396 - #define OPTEE_MSG_RPC_SHM_TYPE_KERNEL 1 397 - 398 - /* 399 - * Free shared memory previously allocated with OPTEE_MSG_RPC_CMD_SHM_ALLOC 400 - * 401 - * [in] param[0].u.value.a type of memory one of 402 - * OPTEE_MSG_RPC_SHM_TYPE_* above 403 - * [in] param[0].u.value.b value of shared memory reference 404 - * returned in param[0].u.tmem.shm_ref 405 - * above 406 - */ 407 - #define OPTEE_MSG_RPC_CMD_SHM_FREE 7 408 - 409 - /* 410 - * Access a device on an i2c bus 411 - * 412 - * [in] param[0].u.value.a mode: RD(0), WR(1) 413 - * [in] param[0].u.value.b i2c adapter 414 - * [in] param[0].u.value.c i2c chip 415 - * 416 - * [in] param[1].u.value.a i2c control flags 417 - * 418 - * [in/out] memref[2] buffer to exchange the transfer data 419 - * with the secure world 420 - * 421 - * [out] param[3].u.value.a bytes transferred by the driver 422 - */ 423 - #define OPTEE_MSG_RPC_CMD_I2C_TRANSFER 21 424 - /* I2C master transfer modes */ 425 - #define OPTEE_MSG_RPC_CMD_I2C_TRANSFER_RD 0 426 - #define OPTEE_MSG_RPC_CMD_I2C_TRANSFER_WR 1 427 - /* I2C master control flags */ 428 - #define OPTEE_MSG_RPC_CMD_I2C_FLAGS_TEN_BIT BIT(0) 429 315 430 316 #endif /* _OPTEE_MSG_H */
+103
drivers/tee/optee/optee_rpc_cmd.h
··· 1 + /* SPDX-License-Identifier: BSD-2-Clause */ 2 + /* 3 + * Copyright (c) 2016-2021, Linaro Limited 4 + */ 5 + 6 + #ifndef __OPTEE_RPC_CMD_H 7 + #define __OPTEE_RPC_CMD_H 8 + 9 + /* 10 + * All RPC is done with a struct optee_msg_arg as bearer of information, 11 + * struct optee_msg_arg::arg holds values defined by OPTEE_RPC_CMD_* below. 12 + * Only the commands handled by the kernel driver are defined here. 13 + * 14 + * RPC communication with tee-supplicant is reversed compared to normal 15 + * client communication described above. The supplicant receives requests 16 + * and sends responses. 17 + */ 18 + 19 + /* 20 + * Get time 21 + * 22 + * Returns number of seconds and nano seconds since the Epoch, 23 + * 1970-01-01 00:00:00 +0000 (UTC). 24 + * 25 + * [out] value[0].a Number of seconds 26 + * [out] value[0].b Number of nano seconds. 27 + */ 28 + #define OPTEE_RPC_CMD_GET_TIME 3 29 + 30 + /* 31 + * Wait queue primitive, helper for secure world to implement a wait queue. 32 + * 33 + * If secure world needs to wait for a secure world mutex it issues a sleep 34 + * request instead of spinning in secure world. Conversely is a wakeup 35 + * request issued when a secure world mutex with a thread waiting thread is 36 + * unlocked. 37 + * 38 + * Waiting on a key 39 + * [in] value[0].a OPTEE_RPC_WAIT_QUEUE_SLEEP 40 + * [in] value[0].b Wait key 41 + * 42 + * Waking up a key 43 + * [in] value[0].a OPTEE_RPC_WAIT_QUEUE_WAKEUP 44 + * [in] value[0].b Wakeup key 45 + */ 46 + #define OPTEE_RPC_CMD_WAIT_QUEUE 4 47 + #define OPTEE_RPC_WAIT_QUEUE_SLEEP 0 48 + #define OPTEE_RPC_WAIT_QUEUE_WAKEUP 1 49 + 50 + /* 51 + * Suspend execution 52 + * 53 + * [in] value[0].a Number of milliseconds to suspend 54 + */ 55 + #define OPTEE_RPC_CMD_SUSPEND 5 56 + 57 + /* 58 + * Allocate a piece of shared memory 59 + * 60 + * [in] value[0].a Type of memory one of 61 + * OPTEE_RPC_SHM_TYPE_* below 62 + * [in] value[0].b Requested size 63 + * [in] value[0].c Required alignment 64 + * [out] memref[0] Buffer 65 + */ 66 + #define OPTEE_RPC_CMD_SHM_ALLOC 6 67 + /* Memory that can be shared with a non-secure user space application */ 68 + #define OPTEE_RPC_SHM_TYPE_APPL 0 69 + /* Memory only shared with non-secure kernel */ 70 + #define OPTEE_RPC_SHM_TYPE_KERNEL 1 71 + 72 + /* 73 + * Free shared memory previously allocated with OPTEE_RPC_CMD_SHM_ALLOC 74 + * 75 + * [in] value[0].a Type of memory one of 76 + * OPTEE_RPC_SHM_TYPE_* above 77 + * [in] value[0].b Value of shared memory reference or cookie 78 + */ 79 + #define OPTEE_RPC_CMD_SHM_FREE 7 80 + 81 + /* 82 + * Issue master requests (read and write operations) to an I2C chip. 83 + * 84 + * [in] value[0].a Transfer mode (OPTEE_RPC_I2C_TRANSFER_*) 85 + * [in] value[0].b The I2C bus (a.k.a adapter). 86 + * 16 bit field. 87 + * [in] value[0].c The I2C chip (a.k.a address). 88 + * 16 bit field (either 7 or 10 bit effective). 89 + * [in] value[1].a The I2C master control flags (ie, 10 bit address). 90 + * 16 bit field. 91 + * [in/out] memref[2] Buffer used for data transfers. 92 + * [out] value[3].a Number of bytes transferred by the REE. 93 + */ 94 + #define OPTEE_RPC_CMD_I2C_TRANSFER 21 95 + 96 + /* I2C master transfer modes */ 97 + #define OPTEE_RPC_I2C_TRANSFER_RD 0 98 + #define OPTEE_RPC_I2C_TRANSFER_WR 1 99 + 100 + /* I2C master control flags */ 101 + #define OPTEE_RPC_I2C_FLAGS_TEN_BIT BIT(0) 102 + 103 + #endif /*__OPTEE_RPC_CMD_H*/
+49 -23
drivers/tee/optee/optee_smc.h
··· 1 1 /* SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) */ 2 2 /* 3 - * Copyright (c) 2015-2019, Linaro Limited 3 + * Copyright (c) 2015-2021, Linaro Limited 4 4 */ 5 5 #ifndef OPTEE_SMC_H 6 6 #define OPTEE_SMC_H ··· 39 39 /* 40 40 * Function specified by SMC Calling convention 41 41 * 42 - * Return one of the following UIDs if using API specified in this file 43 - * without further extentions: 44 - * 65cb6b93-af0c-4617-8ed6-644a8d1140f8 45 - * see also OPTEE_SMC_UID_* in optee_msg.h 42 + * Return the following UID if using API specified in this file 43 + * without further extensions: 44 + * 384fb3e0-e7f8-11e3-af63-0002a5d5c51b. 45 + * see also OPTEE_MSG_UID_* in optee_msg.h 46 46 */ 47 47 #define OPTEE_SMC_FUNCID_CALLS_UID OPTEE_MSG_FUNCID_CALLS_UID 48 48 #define OPTEE_SMC_CALLS_UID \ ··· 53 53 /* 54 54 * Function specified by SMC Calling convention 55 55 * 56 - * Returns 2.0 if using API specified in this file without further extentions. 56 + * Returns 2.0 if using API specified in this file without further extensions. 57 57 * see also OPTEE_MSG_REVISION_* in optee_msg.h 58 58 */ 59 59 #define OPTEE_SMC_FUNCID_CALLS_REVISION OPTEE_MSG_FUNCID_CALLS_REVISION ··· 109 109 * 110 110 * Call register usage: 111 111 * a0 SMC Function ID, OPTEE_SMC*CALL_WITH_ARG 112 - * a1 Upper 32bit of a 64bit physical pointer to a struct optee_msg_arg 113 - * a2 Lower 32bit of a 64bit physical pointer to a struct optee_msg_arg 112 + * a1 Upper 32 bits of a 64-bit physical pointer to a struct optee_msg_arg 113 + * a2 Lower 32 bits of a 64-bit physical pointer to a struct optee_msg_arg 114 114 * a3 Cache settings, not used if physical pointer is in a predefined shared 115 115 * memory area else per OPTEE_SMC_SHM_* 116 116 * a4-6 Not used ··· 139 139 * optee_msg_arg. 140 140 * OPTEE_SMC_RETURN_ETHREAD_LIMIT Number of Trusted OS threads exceeded, 141 141 * try again later. 142 - * OPTEE_SMC_RETURN_EBADADDR Bad physcial pointer to struct 142 + * OPTEE_SMC_RETURN_EBADADDR Bad physical pointer to struct 143 143 * optee_msg_arg. 144 144 * OPTEE_SMC_RETURN_EBADCMD Bad/unknown cmd in struct optee_msg_arg 145 145 * OPTEE_SMC_RETURN_IS_RPC() Call suspended by RPC call to normal ··· 214 214 * secure world accepts command buffers located in any parts of non-secure RAM 215 215 */ 216 216 #define OPTEE_SMC_SEC_CAP_DYNAMIC_SHM BIT(2) 217 - 218 - /* Secure world supports Shared Memory with a NULL buffer reference */ 217 + /* Secure world is built with virtualization support */ 218 + #define OPTEE_SMC_SEC_CAP_VIRTUALIZATION BIT(3) 219 + /* Secure world supports Shared Memory with a NULL reference */ 219 220 #define OPTEE_SMC_SEC_CAP_MEMREF_NULL BIT(4) 220 221 221 222 #define OPTEE_SMC_FUNCID_EXCHANGE_CAPABILITIES 9 ··· 246 245 * 247 246 * Normal return register usage: 248 247 * a0 OPTEE_SMC_RETURN_OK 249 - * a1 Upper 32bit of a 64bit Shared memory cookie 250 - * a2 Lower 32bit of a 64bit Shared memory cookie 248 + * a1 Upper 32 bits of a 64-bit Shared memory cookie 249 + * a2 Lower 32 bits of a 64-bit Shared memory cookie 251 250 * a3-7 Preserved 252 251 * 253 252 * Cache empty return register usage: ··· 293 292 #define OPTEE_SMC_FUNCID_ENABLE_SHM_CACHE 11 294 293 #define OPTEE_SMC_ENABLE_SHM_CACHE \ 295 294 OPTEE_SMC_FAST_CALL_VAL(OPTEE_SMC_FUNCID_ENABLE_SHM_CACHE) 295 + 296 + /* 297 + * Query OP-TEE about number of supported threads 298 + * 299 + * Normal World OS or Hypervisor issues this call to find out how many 300 + * threads OP-TEE supports. That is how many standard calls can be issued 301 + * in parallel before OP-TEE will return OPTEE_SMC_RETURN_ETHREAD_LIMIT. 302 + * 303 + * Call requests usage: 304 + * a0 SMC Function ID, OPTEE_SMC_GET_THREAD_COUNT 305 + * a1-6 Not used 306 + * a7 Hypervisor Client ID register 307 + * 308 + * Normal return register usage: 309 + * a0 OPTEE_SMC_RETURN_OK 310 + * a1 Number of threads 311 + * a2-7 Preserved 312 + * 313 + * Error return: 314 + * a0 OPTEE_SMC_RETURN_UNKNOWN_FUNCTION Requested call is not implemented 315 + * a1-7 Preserved 316 + */ 317 + #define OPTEE_SMC_FUNCID_GET_THREAD_COUNT 15 318 + #define OPTEE_SMC_GET_THREAD_COUNT \ 319 + OPTEE_SMC_FAST_CALL_VAL(OPTEE_SMC_FUNCID_GET_THREAD_COUNT) 296 320 297 321 /* 298 322 * Resume from RPC (for example after processing a foreign interrupt) ··· 367 341 * 368 342 * "Return" register usage: 369 343 * a0 SMC Function ID, OPTEE_SMC_CALL_RETURN_FROM_RPC. 370 - * a1 Upper 32bits of 64bit physical pointer to allocated 344 + * a1 Upper 32 bits of 64-bit physical pointer to allocated 371 345 * memory, (a1 == 0 && a2 == 0) if size was 0 or if memory can't 372 346 * be allocated. 373 - * a2 Lower 32bits of 64bit physical pointer to allocated 347 + * a2 Lower 32 bits of 64-bit physical pointer to allocated 374 348 * memory, (a1 == 0 && a2 == 0) if size was 0 or if memory can't 375 349 * be allocated 376 350 * a3 Preserved 377 - * a4 Upper 32bits of 64bit Shared memory cookie used when freeing 351 + * a4 Upper 32 bits of 64-bit Shared memory cookie used when freeing 378 352 * the memory or doing an RPC 379 - * a5 Lower 32bits of 64bit Shared memory cookie used when freeing 353 + * a5 Lower 32 bits of 64-bit Shared memory cookie used when freeing 380 354 * the memory or doing an RPC 381 355 * a6-7 Preserved 382 356 */ ··· 389 363 * 390 364 * "Call" register usage: 391 365 * a0 This value, OPTEE_SMC_RETURN_RPC_FREE 392 - * a1 Upper 32bits of 64bit shared memory cookie belonging to this 366 + * a1 Upper 32 bits of 64-bit shared memory cookie belonging to this 393 367 * argument memory 394 - * a2 Lower 32bits of 64bit shared memory cookie belonging to this 368 + * a2 Lower 32 bits of 64-bit shared memory cookie belonging to this 395 369 * argument memory 396 370 * a3-7 Resume information, must be preserved 397 371 * ··· 405 379 OPTEE_SMC_RPC_VAL(OPTEE_SMC_RPC_FUNC_FREE) 406 380 407 381 /* 408 - * Deliver foreign interrupt to normal world. 382 + * Deliver a foreign interrupt in normal world. 409 383 * 410 384 * "Call" register usage: 411 385 * a0 OPTEE_SMC_RETURN_RPC_FOREIGN_INTR ··· 415 389 * a0 SMC Function ID, OPTEE_SMC_CALL_RETURN_FROM_RPC. 416 390 * a1-7 Preserved 417 391 */ 418 - #define OPTEE_SMC_RPC_FUNC_FOREIGN_INTR 4 392 + #define OPTEE_SMC_RPC_FUNC_FOREIGN_INTR 4 419 393 #define OPTEE_SMC_RETURN_RPC_FOREIGN_INTR \ 420 394 OPTEE_SMC_RPC_VAL(OPTEE_SMC_RPC_FUNC_FOREIGN_INTR) 421 395 ··· 431 405 * 432 406 * "Call" register usage: 433 407 * a0 OPTEE_SMC_RETURN_RPC_CMD 434 - * a1 Upper 32bit of a 64bit Shared memory cookie holding a 408 + * a1 Upper 32 bits of a 64-bit Shared memory cookie holding a 435 409 * struct optee_msg_arg, must be preserved, only the data should 436 410 * be updated 437 - * a2 Lower 32bit of a 64bit Shared memory cookie holding a 411 + * a2 Lower 32 bits of a 64-bit Shared memory cookie holding a 438 412 * struct optee_msg_arg, must be preserved, only the data should 439 413 * be updated 440 414 * a3-7 Resume information, must be preserved
+20 -19
drivers/tee/optee/rpc.c
··· 12 12 #include <linux/tee_drv.h> 13 13 #include "optee_private.h" 14 14 #include "optee_smc.h" 15 + #include "optee_rpc_cmd.h" 15 16 16 17 struct wq_entry { 17 18 struct list_head link; ··· 90 89 if (!client.adapter) 91 90 goto bad; 92 91 93 - if (params[1].u.value.a & OPTEE_MSG_RPC_CMD_I2C_FLAGS_TEN_BIT) { 92 + if (params[1].u.value.a & OPTEE_RPC_I2C_FLAGS_TEN_BIT) { 94 93 if (!i2c_check_functionality(client.adapter, 95 94 I2C_FUNC_10BIT_ADDR)) { 96 95 i2c_put_adapter(client.adapter); ··· 104 103 snprintf(client.name, I2C_NAME_SIZE, "i2c%d", client.adapter->nr); 105 104 106 105 switch (params[0].u.value.a) { 107 - case OPTEE_MSG_RPC_CMD_I2C_TRANSFER_RD: 106 + case OPTEE_RPC_I2C_TRANSFER_RD: 108 107 ret = i2c_master_recv(&client, params[2].u.memref.shm->kaddr, 109 108 params[2].u.memref.size); 110 109 break; 111 - case OPTEE_MSG_RPC_CMD_I2C_TRANSFER_WR: 110 + case OPTEE_RPC_I2C_TRANSFER_WR: 112 111 ret = i2c_master_send(&client, params[2].u.memref.shm->kaddr, 113 112 params[2].u.memref.size); 114 113 break; ··· 195 194 goto bad; 196 195 197 196 switch (arg->params[0].u.value.a) { 198 - case OPTEE_MSG_RPC_WAIT_QUEUE_SLEEP: 197 + case OPTEE_RPC_WAIT_QUEUE_SLEEP: 199 198 wq_sleep(&optee->wait_queue, arg->params[0].u.value.b); 200 199 break; 201 - case OPTEE_MSG_RPC_WAIT_QUEUE_WAKEUP: 200 + case OPTEE_RPC_WAIT_QUEUE_WAKEUP: 202 201 wq_wakeup(&optee->wait_queue, arg->params[0].u.value.b); 203 202 break; 204 203 default: ··· 268 267 struct tee_shm *shm; 269 268 270 269 param.attr = TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INOUT; 271 - param.u.value.a = OPTEE_MSG_RPC_SHM_TYPE_APPL; 270 + param.u.value.a = OPTEE_RPC_SHM_TYPE_APPL; 272 271 param.u.value.b = sz; 273 272 param.u.value.c = 0; 274 273 275 - ret = optee_supp_thrd_req(ctx, OPTEE_MSG_RPC_CMD_SHM_ALLOC, 1, &param); 274 + ret = optee_supp_thrd_req(ctx, OPTEE_RPC_CMD_SHM_ALLOC, 1, &param); 276 275 if (ret) 277 276 return ERR_PTR(-ENOMEM); 278 277 ··· 309 308 310 309 sz = arg->params[0].u.value.b; 311 310 switch (arg->params[0].u.value.a) { 312 - case OPTEE_MSG_RPC_SHM_TYPE_APPL: 311 + case OPTEE_RPC_SHM_TYPE_APPL: 313 312 shm = cmd_alloc_suppl(ctx, sz); 314 313 break; 315 - case OPTEE_MSG_RPC_SHM_TYPE_KERNEL: 314 + case OPTEE_RPC_SHM_TYPE_KERNEL: 316 315 shm = tee_shm_alloc(ctx, sz, TEE_SHM_MAPPED); 317 316 break; 318 317 default: ··· 384 383 struct tee_param param; 385 384 386 385 param.attr = TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INOUT; 387 - param.u.value.a = OPTEE_MSG_RPC_SHM_TYPE_APPL; 386 + param.u.value.a = OPTEE_RPC_SHM_TYPE_APPL; 388 387 param.u.value.b = tee_shm_get_id(shm); 389 388 param.u.value.c = 0; 390 389 ··· 401 400 */ 402 401 tee_shm_put(shm); 403 402 404 - optee_supp_thrd_req(ctx, OPTEE_MSG_RPC_CMD_SHM_FREE, 1, &param); 403 + optee_supp_thrd_req(ctx, OPTEE_RPC_CMD_SHM_FREE, 1, &param); 405 404 } 406 405 407 406 static void handle_rpc_func_cmd_shm_free(struct tee_context *ctx, ··· 419 418 420 419 shm = (struct tee_shm *)(unsigned long)arg->params[0].u.value.b; 421 420 switch (arg->params[0].u.value.a) { 422 - case OPTEE_MSG_RPC_SHM_TYPE_APPL: 421 + case OPTEE_RPC_SHM_TYPE_APPL: 423 422 cmd_free_suppl(ctx, shm); 424 423 break; 425 - case OPTEE_MSG_RPC_SHM_TYPE_KERNEL: 424 + case OPTEE_RPC_SHM_TYPE_KERNEL: 426 425 tee_shm_free(shm); 427 426 break; 428 427 default: ··· 459 458 } 460 459 461 460 switch (arg->cmd) { 462 - case OPTEE_MSG_RPC_CMD_GET_TIME: 461 + case OPTEE_RPC_CMD_GET_TIME: 463 462 handle_rpc_func_cmd_get_time(arg); 464 463 break; 465 - case OPTEE_MSG_RPC_CMD_WAIT_QUEUE: 464 + case OPTEE_RPC_CMD_WAIT_QUEUE: 466 465 handle_rpc_func_cmd_wq(optee, arg); 467 466 break; 468 - case OPTEE_MSG_RPC_CMD_SUSPEND: 467 + case OPTEE_RPC_CMD_SUSPEND: 469 468 handle_rpc_func_cmd_wait(arg); 470 469 break; 471 - case OPTEE_MSG_RPC_CMD_SHM_ALLOC: 470 + case OPTEE_RPC_CMD_SHM_ALLOC: 472 471 free_pages_list(call_ctx); 473 472 handle_rpc_func_cmd_shm_alloc(ctx, arg, call_ctx); 474 473 break; 475 - case OPTEE_MSG_RPC_CMD_SHM_FREE: 474 + case OPTEE_RPC_CMD_SHM_FREE: 476 475 handle_rpc_func_cmd_shm_free(ctx, arg); 477 476 break; 478 - case OPTEE_MSG_RPC_CMD_I2C_TRANSFER: 477 + case OPTEE_RPC_CMD_I2C_TRANSFER: 479 478 handle_rpc_func_cmd_i2c_transfer(ctx, arg); 480 479 break; 481 480 default:
+1 -1
include/linux/tee_drv.h
··· 88 88 * @close_session: close a session 89 89 * @invoke_func: invoke a trusted function 90 90 * @cancel_req: request cancel of an ongoing invoke or open 91 - * @supp_revc: called for supplicant to get a command 91 + * @supp_recv: called for supplicant to get a command 92 92 * @supp_send: called for supplicant to send a response 93 93 * @shm_register: register shared memory buffer in TEE 94 94 * @shm_unregister: unregister shared memory buffer in TEE
+1 -1
include/uapi/linux/tee.h
··· 355 355 }; 356 356 357 357 /** 358 - * TEE_IOC_SUPPL_SEND - Receive a request for a supplicant function 358 + * TEE_IOC_SUPPL_SEND - Send a response to a received request 359 359 * 360 360 * Takes a struct tee_ioctl_buf_data which contains a struct 361 361 * tee_iocl_supp_send_arg followed by any array of struct tee_param