plat-stm: fix parallel build error

Generation of out/arm32-plat-stm/core/tz.lds may occur when the directory
out/arm32-plat-stm/core does not exist yet. The command should therefore
create it.
Note: plat-vexpress is correct.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Pascal Brand <pascal.brand@linaro.org>
OP-TEE design document

- Adds documentation covering platform initalization, SMC handling, TEE
  SMC Interface, thread handling and MMU.
- Adds empty sections showing what we intend to add to the
  documentation.
- Adds yEd (http://www.yworks.com/) files and the images generated by
  the tool.

Signed-off-by: Joakim Bech <joakim.bech@linaro.org>
Reviewed-by: Pascal Brand <pascal.brand@linaro.org>
Use bn_free to free big numbers

At some places of the code, some big numbers, allocated through
bn_alloc_max(), were freed using free().
They are now free using bn_free()

Signed-off-by: Pascal Brand <pascal.brand@st.com>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Pascal Brand <pascal.brand@linaro.org>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
Tested-by: Pascal Brand <pascal.brand@linaro.org> (STM platform)
Clean cache_l1 and cache_l2 maintenance

L1 cache maintenance is using Virtual Memory, whereas cache L2 maintenance
uses Physical Memory

Signed-off-by: Pascal Brand <pascal.brand@st.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Tested-by: Pascal Brand <pascal.brand@linaro.org> (STM platform)
TEE_MACCompareFinal(): use buf_compare_ct(), don't clear stack on exit

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (QEMU virt platform)
Reviewed-by: Pascal Brand <pascal.brand@linaro.org>
Tested-by: Pascal Brand <pascal.brand@linaro.org> (STM platform)
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
optee_design.md: add picture to MMU section

xlat_table.png is generated with the command:
    dot -Tpng xlat_table.dot > xlat_table.png

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
Reviewed-by: Pascal Brand <pascal.brand@linaro.org>
Fixes in trace refactoring

- Deprecates ATAMSG
- trace_ext.c is arm32 specific
- tee_kta_trace.h and trace_ta.h are generic
- Default level is now 1 (was 2)

Signed-off-by: Pascal Brand <pascal.brand@st.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Make function tee_cryp_init() generic

Signed-off-by: Pascal Brand <pascal.brand@st.com>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Move bget to libutils replacing dlmalloc

* Moves bget to libutils replacing dlmalloc as kernel memory allocator
* Restores the code formatting of bget.{c,h} to the original state as
  parts of the current code was unreadable
* Adds malloc_add_pool() to make use of previously unused memory
* Moves call to malloc_init() into platform specific code
* Restores MDBG into working condition
* Adds memalign function to bget.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Tested-by: Jens Wiklander <jens.wiklander@linaro.org> (QEMU virt platform)
Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (FVP)
Reviewed-by: Etienne Carriere <etienne.carriere@st.com>
Tested-by: Pascal Brand <pascal.brand@linaro.org> (STM platform)
travis: Add CFG_TEE_FW_DEBUG=1 to qemu_virt

Adds CFG_TEE_FW_DEBUG=1 compilation for PLATFORM=vexpress-qemu_virt

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>