The TEE subsystem allows session-based access to trusted services, requiring a session to be established to receive a service. This is not suitable for an environment that represents services as objects. An object supports various operations that a client can invoke, potentially generating a result or a new object that can be invoked independently of the original object. Add TEE_IOCTL_PARAM_ATTR_TYPE_OBJREF_INPUT/OUTPUT/INOUT to represent an object. Objects may reside in either TEE or userspace. To invoke an object in TEE, introduce a new ioctl. Use the existing SUPPL_RECV and SUPPL_SEND to invoke an object in userspace.
Showing the changes to include/uapi (1 of 4 files). Show all
Unified · Split
| @@ -48,8 +48,10 @@ · 47 unmodified lines | |||
| 48 | #define TEE_GEN_CAP_PRIVILEGED (1 << 1)/* Privileged device (for supplicant) */ | 48 | #define TEE_GEN_CAP_PRIVILEGED (1 << 1)/* Privileged device (for supplicant) */ |
| 49 | #define TEE_GEN_CAP_REG_MEM (1 << 2)/* Supports registering shared memory */ | 49 | #define TEE_GEN_CAP_REG_MEM (1 << 2)/* Supports registering shared memory */ |
| 50 | #define TEE_GEN_CAP_MEMREF_NULL (1 << 3)/* NULL MemRef support */ | 50 | #define TEE_GEN_CAP_MEMREF_NULL (1 << 3)/* NULL MemRef support */ |
| 51 | #define TEE_GEN_CAP_OBJREF (1 << 4)/* Supports generic object reference */ | ||
| 51 | 52 | ||
| 52 | #define TEE_MEMREF_NULL (__u64)(-1) /* NULL MemRef Buffer */ | 53 | #define TEE_MEMREF_NULL ((__u64)(-1)) /* NULL MemRef Buffer */ |
| 54 | #define TEE_OBJREF_NULL ((__u64)(-1)) /* NULL ObjRef Object */ | ||
| 53 | 55 | ||
| 54 | /* | 56 | /* |
| 55 | * TEE Implementation ID | 57 | * TEE Implementation ID |
| @@ -158,6 +160,13 @@ struct tee_ioctl_buf_data { · 102 unmodified lines | |||
| 158 | #define TEE_IOCTL_PARAM_ATTR_TYPE_UBUF_OUTPUT 9 | 160 | #define TEE_IOCTL_PARAM_ATTR_TYPE_UBUF_OUTPUT 9 |
| 159 | #define TEE_IOCTL_PARAM_ATTR_TYPE_UBUF_INOUT 10 /* input and output */ | 161 | #define TEE_IOCTL_PARAM_ATTR_TYPE_UBUF_INOUT 10 /* input and output */ |
| 160 | 162 | ||
| 163 | /* | ||
| 164 | * These defines object reference parameters. | ||
| 165 | */ | ||
| 166 | #define TEE_IOCTL_PARAM_ATTR_TYPE_OBJREF_INPUT 11 | ||
| 167 | #define TEE_IOCTL_PARAM_ATTR_TYPE_OBJREF_OUTPUT 12 | ||
| 168 | #define TEE_IOCTL_PARAM_ATTR_TYPE_OBJREF_INOUT 13 | ||
| 169 | |||
| 161 | /* | 170 | /* |
| 162 | * Mask for the type part of the attribute, leaves room for more types | 171 | * Mask for the type part of the attribute, leaves room for more types |
| 163 | */ | 172 | */ |
| @@ -195,15 +204,16 @@ struct tee_ioctl_buf_data { · 31 unmodified lines | |||
| 195 | * @attr: attributes | 204 | * @attr: attributes |
| 196 | * @a: if a memref, offset into the shared memory object, | 205 | * @a: if a memref, offset into the shared memory object, |
| 197 | * else if a ubuf, address of the user buffer, | 206 | * else if a ubuf, address of the user buffer, |
| 198 | * else a value parameter | 207 | * else if an objref, object identifier, else a value parameter |
| 199 | * @b: if a memref or ubuf, size of the buffer, else a value parameter | 208 | * @b: if a memref or ubuf, size of the buffer, |
| 209 | * else if objref, flags for the object, else a value parameter | ||
| 200 | * @c: if a memref, shared memory identifier, else a value parameter | 210 | * @c: if a memref, shared memory identifier, else a value parameter |
| 201 | * | 211 | * |
| 202 | * @attr & TEE_PARAM_ATTR_TYPE_MASK indicates if memref, ubuf, or value is | 212 | * @attr & TEE_PARAM_ATTR_TYPE_MASK indicates if memref, ubuf, or value is |
| 203 | * used in the union. TEE_PARAM_ATTR_TYPE_VALUE_* indicates value, | 213 | * used in the union. TEE_PARAM_ATTR_TYPE_VALUE_* indicates value, |
| 204 | * TEE_PARAM_ATTR_TYPE_MEMREF_* indicates memref, and TEE_PARAM_ATTR_TYPE_UBUF_* | 214 | * TEE_PARAM_ATTR_TYPE_MEMREF_* indicates memref, TEE_PARAM_ATTR_TYPE_UBUF_* |
| 205 | * indicates ubuf. TEE_PARAM_ATTR_TYPE_NONE indicates that none of the members | 215 | * indicates ubuf, and TEE_PARAM_ATTR_TYPE_OBJREF_* indicates objref. |
| 206 | * are used. | 216 | * TEE_PARAM_ATTR_TYPE_NONE indicates that none of the members are used. |
| 207 | * | 217 | * |
| 208 | * Shared memory is allocated with TEE_IOC_SHM_ALLOC which returns an | 218 | * Shared memory is allocated with TEE_IOC_SHM_ALLOC which returns an |
| 209 | * identifier representing the shared memory object. A memref can reference | 219 | * identifier representing the shared memory object. A memref can reference |
| @@ -442,4 +452,23 @@ struct tee_ioctl_shm_register_fd_data { · 232 unmodified lines | |||
| 442 | * munmap(): unmaps previously shared memory | 452 | * munmap(): unmaps previously shared memory |
| 443 | */ | 453 | */ |
| 444 | 454 | ||
| 455 | /** | ||
| 456 | * struct tee_ioctl_invoke_func_arg - Invokes an object in a Trusted Application | ||
| 457 | * @id: [in] Object id | ||
| 458 | * @op: [in] Object operation, specific to the object | ||
| 459 | * @ret: [out] return value | ||
| 460 | * @num_params: [in] number of parameters following this struct | ||
| 461 | */ | ||
| 462 | struct tee_ioctl_object_invoke_arg { | ||
| 463 | __u64 id; | ||
| 464 | __u32 op; | ||
| 465 | __u32 ret; | ||
| 466 | __u32 num_params; | ||
| 467 | /* num_params tells the actual number of element in params */ | ||
| 468 | struct tee_ioctl_param params[]; | ||
| 469 | }; | ||
| 470 | |||
| 471 | #define TEE_IOC_OBJECT_INVOKE _IOR(TEE_IOC_MAGIC, TEE_IOC_BASE + 10, \ | ||
| 472 | struct tee_ioctl_buf_data) | ||
| 473 | |||
| 445 | #endif /*__TEE_H*/ | 474 | #endif /*__TEE_H*/ |