Hi Jens,
On Wed, 2016-07-13 at 09:38:36 +0200, Jens Wiklander wrote:
Hi Sören,
On Wed, Jul 13, 2016 at 1:24 AM, Sören Brinkmann soren.brinkmann@xilinx.com wrote:
Hi,
I am playing with OP-TEE on ZynqMP and am working on a proof of concept for programming the FPGA from Linux through a TA in OP-TEE.
The first questions I had where regarding how to access the necessary HW and I found: https://github.com/OP-TEE/optee_os/issues/404 https://lists.linaro.org/pipermail/tee-dev/2015-August/000160.html
I guess a user-TA memory is completely isolated and hence the pointer to use a static TA?
I actually got that part working and added a static TA that takes a temporal memref from the normal world. I.e. the flow is like this:
- user space app opens bitstream file and does any kind of pre-processing that may be required
- user-space application mmaps the bitstream file
- user-space app populates a TEEC_Operation struct with a TEEC_TEMP_INPUT argument that holds the mmap address and the size of the file
- user-space invokes TA
I guess you've noticed it but as part of TEEC_InvokeCommand() some shared memory is allocated and the supplied memrefs (i.e. the mmaped part of the file above) are copied into this shared memory (which is physically contiguous).
I noticed the copying part, but wasn't sure about the rest.
- TA does some sanity checking, ...
- TA looks up the physical address of the bitstream and flushes the cache
- TA programs a DMA to transfer the bitstream into the FPGA
This process does actually work, but I'm not sure how much luck is involved. The bitstream file for the device I'm working with is ca. 10MB large and for the DMA to work it needs to be present in memory in a physically contiguous address range (it could probably be programmed in chunks, but if not necessary I'd avoid going there). That rose the question: Is the data the TA works with guaranteed to be present in a physically continuous block? And if not, was there an easy way to achieve that?
Currently it's guaranteed to be physically contiguous memory as we only support mapping that kind of arguments. At some point we'll support physically non-contiguous memory as well, but let's deal with that then.
Sounds good.
Kind of related follow up: I started out with the TA hello world example which had TA and user-space app in one repo, but then moved to a static TA as I need to access some devices from my TA. Is there an easy way to export the TA header that has the UUID, commands etc. to the TA devkit?
Thanks, Sören