Hi Jens
On 2015-06-24 17:34, Jens Wiklander wrote:
The proposed api in tee.h doesn't cover memory that isn't represented by a file descriptor. A memref is represented as: struct tee_ioctl_param_memref { __u64 shm_offs; __u64 size; __s64 shm_fd; };
I see two options here: a) We add a way to represent registered shared memory with a file descriptor b) We add another parameter type, regmem
In a) we can then map this memory into another process (having tee-supplicant in mind) if needed. In b) there's no easy way of mapping the memory into another process, but perhaps easier to implement if this isn't a problem.
Either case is out of scope for patch v4, but we shouldn't make it hard to add it to tee.h later.
A) would mean one more TEE_IOC_XXX while b) would need some more bits in TEE_IOCTL_PARAMS_ATTR_TYPE_XXX. Changing TEE_IOCTL_PARAM_ATTR_TYPE_MASK to 0xff would guarantee room for all future parameter types. Another bit from the TEE_GEN_CAP_XXX bits can be used to indicate if registered shared memory is supported by a specific driver.
In the use-case I was thinking about there wasn't a need to map the memory with a third party because it could potentially generate some strange side effects: since the maps can only be done in 4k increments, too much memory would be shared from one process to the other. For me at least option b) fits much better.
Regards, Valentin