| ce0d8e2d | 22-May-2017 |
Jens Wiklander <jens.wiklander@linaro.org> |
util: add macros for arithmetics with overflow checking
Compiler builtin support for checking overflow of addition, subtraction and multiplication is used if available. If unavailable a fallback imp
util: add macros for arithmetics with overflow checking
Compiler builtin support for checking overflow of addition, subtraction and multiplication is used if available. If unavailable a fallback implementation using macros is used instead.
Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (HiKey 32/64) Tested-by: Jens Wiklander <jens.wiklander@linaro.org> (QEMU) Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 31a29642 | 11-May-2017 |
Jerome Forissier <jerome.forissier@linaro.org> |
core: dump call stack of user TAs on abort
Update the abort handling code in the TEE core to support unwinding the user mode stack in addition to the kernel stack. unwind_arm32.c is modified slightl
core: dump call stack of user TAs on abort
Update the abort handling code in the TEE core to support unwinding the user mode stack in addition to the kernel stack. unwind_arm32.c is modified slightly so that it can be built for AArch64. This allows a 64-bit TEE core to dump both 32- and 64-bit TAs.
Paged TAs (CFG_PAGED_USER_TA=y) cannot currently be unwound, because the code is not ready to handle the page faults that might occur as the unwinding tables are accessed.
CFG_CORE_UNWIND is renamed to CFG_UNWIND since it enables both the kernel and user TA stack dumps. It is still set automatically when CFG_TEE_CORE_DEBUG=y.
32-bit user TAs have to be compiled with `-funwind-tables`, otherwise the call stack can't be unwound and the abort reports will not show a call stack .The TA dev kit takes care of adding this flag automatically when CFG_UNWIND=y.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (HiKey) Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 63988d7c | 09-May-2017 |
Jens Wiklander <jens.wiklander@linaro.org> |
Fix ROUNDUP()/ROUNDDOWN() macros
Fixes the ROUNDUP()/ROUNDDOWN() macros to mask internally with a bitmask that is of the same size as the value that is to be rounded. Without this patch the mask use
Fix ROUNDUP()/ROUNDDOWN() macros
Fixes the ROUNDUP()/ROUNDDOWN() macros to mask internally with a bitmask that is of the same size as the value that is to be rounded. Without this patch the mask uses the size of the type of the @size parameter, which can differ and give wrong result.
Reported-by: Zhizhou Zhang <zhizhouzhang@asrmicro.com> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 40ea51de | 15-Feb-2017 |
Volodymyr Babchuk <vlad.babchuk@gmail.com> |
spinlock: add cpu_spin_lock_xsave()/xrestore() functions
These are functions like spin_lock_irqsave() functions in linux kernel. They should replace xxx_lock() functions in different modules.
Signe
spinlock: add cpu_spin_lock_xsave()/xrestore() functions
These are functions like spin_lock_irqsave() functions in linux kernel. They should replace xxx_lock() functions in different modules.
Signed-off-by: Volodymyr Babchuk <vlad.babchuk@gmail.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| 5acb1bc6 | 12-Dec-2016 |
David Wang <david.wang@arm.com> |
Rename the secure and non-secure interrupts
Currently, the secure interrupts are named as FIQ and the non-secure interrupts are named as IRQ.
In GICv3 mode, the FIQ and IRQ have different definitio
Rename the secure and non-secure interrupts
Currently, the secure interrupts are named as FIQ and the non-secure interrupts are named as IRQ.
In GICv3 mode, the FIQ and IRQ have different definitions. * Secure Group 0 interrupts: Handled by EL3 and triggered by FIQ when running at Secure EL0/1. * Secure Group 1 interrupts: Handled by optee_os and triggered by IRQ when running at Secure EL0/1. * Non-secure Group1 interrupts: Handled by the rich os and triggered by FIQ when running at Secure EL0/1.
The "Secure Group 1" interrupts are the "native" interrupts handled by optee_os. They are same as the "secure" interrupts used in optee_os for now. But they are triggered by FIQ in GICv2 mode while by IRQ in GICv3 mode.
The "Secure Group 0" and "Non-secure Group1" interrupts are the "foreign" interrupts that will cause the exiting of optee_os. (e.g. switch back to normal world) The "Non-secure Group1" interrupts are same as the "non-secure"interrupts used in optee_os for now. But they are triggered by IRQ in GICv2 mode while by FIQ in GICv3 mode.
This patch renames these interrupts to the generic names - "Foreign interrupts" and "Native interrupts". For the support of GICv3 mode in the future, we can redefine the macros of "native interrupt" and "foreign interrupt" to IRQ and FIQ.
Signed-off-by: David Wang <david.wang@arm.com> Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Tested-by: Etienne Carriere <etienne.carriere@linaro.org> (b2260)
show more ...
|
| 933a11e0 | 19-Dec-2016 |
Andrew F. Davis <afd@ti.com> |
libutils: Add GENMASK_{32,64} helper macros
Allow defining a bitmask using first and last bits.
Signed-off-by: Andrew F. Davis <afd@ti.com> Reviewed-by: Joakim Bech <joakim.bech@linaro.org> |
| 883c4be3 | 13-Oct-2016 |
Jerome Forissier <jerome.forissier@linaro.org> |
Add support for user TA profiling with gprof (-pg)
Adds the infrastructure to collect profiling information from Trusted Applications running in user mode and instrumented with -pg. Enable with: CFG
Add support for user TA profiling with gprof (-pg)
Adds the infrastructure to collect profiling information from Trusted Applications running in user mode and instrumented with -pg. Enable with: CFG_TA_GPROF_SUPPORT=y.
Profiling support in itself adds no significant performance overhead. Instrumented applications however may run 1.3x - 2x slower, and have a larger .bss section (+1.36 times .text size for 32-bit TAs, +1.77 times .text size for 64-bit ones).
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (D02 64-bit) Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (QEMU 32-bit) Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| f3bb2312 | 13-Oct-2016 |
Jerome Forissier <jerome.forissier@linaro.org> |
Add options to build user libraries with profiling enabled (-pg)
Set CFG_TA_GPROF=y to build libutee and the user-mode versions of libutils and libmpa with the -pg flag (gprof profiling). This featu
Add options to build user libraries with profiling enabled (-pg)
Set CFG_TA_GPROF=y to build libutee and the user-mode versions of libutils and libmpa with the -pg flag (gprof profiling). This feature depends on TA profiling support in OP-TEE core which will be introduced in a later commit.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| c8abbbdb | 06-Dec-2016 |
Volodymyr Babchuk <vlad.babchuk@gmail.com> |
stdint.h: add UINTPTR_C macro
This macro can be used when we want to present value that boths acceptable by C compiller and by ld.
Signed-off-by: Volodymyr Babchuk <vlad.babchuk@gmail.com> Reviewed
stdint.h: add UINTPTR_C macro
This macro can be used when we want to present value that boths acceptable by C compiller and by ld.
Signed-off-by: Volodymyr Babchuk <vlad.babchuk@gmail.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 82c9f597 | 11-Nov-2016 |
Volodymyr Babchuk <vlad.babchuk@gmail.com> |
malloc: use spinlock instead of mutex
Allocation functions are atomic (like linux kernel atomic context), so mutexes are overkill for them. This change will allow use to use allocator in atomic cont
malloc: use spinlock instead of mutex
Allocation functions are atomic (like linux kernel atomic context), so mutexes are overkill for them. This change will allow use to use allocator in atomic contexts like fast SMC calls or IRQ handlers.
Signed-off-by: Volodymyr Babchuk <vlad.babchuk@gmail.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 59c2b6bf | 08-Dec-2016 |
Jens Wiklander <jens.wiklander@linaro.org> |
Format UUID strings correctly
Prior to this patch although GlobalPlatform specifies that TAs and such are identified with UUIDs, we don't format them quite right when turning them into strings. Per
Format UUID strings correctly
Prior to this patch although GlobalPlatform specifies that TAs and such are identified with UUIDs, we don't format them quite right when turning them into strings. Per https://www.ietf.org/rfc/rfc4122.txt, there should be another hyphen after the first two bytes of clockSeqAndNode.
Unfortunately, fixing this breaks compatibility between how TAs are built, and when the OS loads them.
With this patch UUID string are formated with the additional hyphen as for instance: f81d4fae-7dec-11d0-a765-00a0c91e6bf6
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Fixes: https://github.com/OP-TEE/optee_os/issues/857 Tested-by: Jens Wiklander <jens.wiklander@linaro.org> (QEMU) Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 2ffdd194 | 26-Oct-2016 |
Jens Wiklander <jens.wiklander@linaro.org> |
Remove legacy tee_common_unpg.h
Removes legacy file core/include/kernel/tee_common_unpg.h and updates with new types etc as needed.
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Teste
Remove legacy tee_common_unpg.h
Removes legacy file core/include/kernel/tee_common_unpg.h and updates with new types etc as needed.
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Tested-by: Etienne Carriere <etienne.carriere@linaro.org> (b2260) Tested-by: Jens Wiklander <jens.wiklander@linaro.org> (QEMU) Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 52f8b816 | 01-Sep-2016 |
Jerome Forissier <jerome.forissier@linaro.org> |
core: add heap allocation failure statistics
Adds the following statistics to the heap allocator and export then via the static TA `core/arch/arm/sta/stats.c` (all of them can be reset):
- num_all
core: add heap allocation failure statistics
Adds the following statistics to the heap allocator and export then via the static TA `core/arch/arm/sta/stats.c` (all of them can be reset):
- num_alloc_fail: number of calls to malloc()/calloc()/realloc() that returned NULL - biggest_alloc_fail: the size in bytes of the largest allocation request that resulted in a failure - biggest_alloc_fail_used: the number of bytes that were allocated at that time
Depends on CFG_WITH_STATS=y.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 1d171f95 | 30-Aug-2016 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: add support for kernel address sanitizer
Adds support for kernel address sanitizer. Currently only for plat-vexpress-qemu_virt.
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Tes
core: add support for kernel address sanitizer
Adds support for kernel address sanitizer. Currently only for plat-vexpress-qemu_virt.
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Tested-by: Jens Wiklander <jens.wiklander@linaro.org> (QEMU v7) Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| b18dfc62 | 30-Aug-2016 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: add .early_bss section
Adds .early_bss to be used for variables that would normally land in .bss, but must not since they are updated before .bss is cleared. This section replaces earlier work
core: add .early_bss section
Adds .early_bss to be used for variables that would normally land in .bss, but must not since they are updated before .bss is cleared. This section replaces earlier workarounds using __data for such variables.
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| a681faba | 02-Sep-2016 |
Jerome Forissier <jerome.forissier@linaro.org> |
trace.h: add macros to unwind and print the call stack (kernel only)
Adds [EIDF]PRINT_STACK() for debugging purposes. Depends on CFG_CORE_UNWIND=y. As a side-effect, also adds a few things that may
trace.h: add macros to unwind and print the call stack (kernel only)
Adds [EIDF]PRINT_STACK() for debugging purposes. Depends on CFG_CORE_UNWIND=y. As a side-effect, also adds a few things that may be useful on their own: __always_inline, read_pc(), read_fp(), read_lr().
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 086a6557 | 30-Aug-2016 |
Jerome Forissier <jerome.forissier@linaro.org> |
libutils: promote mdbg_check() messages to TRACE_INFO from TRACE_DEBUG
The memory tracing feature enabled by CFG_TEE_CORE_MALLOC_DEBUG=y or CFG_TEE_TA_MALLOC_DEBUG=y is quite convenient to track mem
libutils: promote mdbg_check() messages to TRACE_INFO from TRACE_DEBUG
The memory tracing feature enabled by CFG_TEE_CORE_MALLOC_DEBUG=y or CFG_TEE_TA_MALLOC_DEBUG=y is quite convenient to track memory leaks or other shortages. Unfortunately, the allocation summary is dumped with the TRACE_DEBUG severity so it is easily burried in lots of debug output. In addition, tracking memory leaks frequently involves running code in a loop, so that the leak better stands out from other allocations. Doing so with debug logs enabled tends to slow things down more than necessary.
Therefore this commit promotes the mdbg_check() message to TRACE_INFO.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 351ecd11 | 30-Aug-2016 |
Jerome Forissier <jerome.forissier@linaro.org> |
core: fix compile error when CFG_TEE_CORE_MALLOC_DEBUG=y
When CFG_TEE_CORE_MALLOC_DEBUG is enabled, but CFG_TEE_CORE_DEBUG is not, the compiler complains about unused parameters/functions. Fix them
core: fix compile error when CFG_TEE_CORE_MALLOC_DEBUG=y
When CFG_TEE_CORE_MALLOC_DEBUG is enabled, but CFG_TEE_CORE_DEBUG is not, the compiler complains about unused parameters/functions. Fix them by adding __maybe_unused qualifiers.
lib/libutils/isoc/bget_malloc.c: In function ‘assert_header’: lib/libutils/isoc/bget_malloc.c:688:44: error: unused parameter ‘hdr’ [-Werror=unused-parameter] static void assert_header(struct mdbg_hdr *hdr) ^ lib/libutils/isoc/bget_malloc.c: At top level: lib/libutils/isoc/bget_malloc.c:595:16: error: ‘bget_buf_size’ defined but not used [-Werror=unused-function] static bufsize bget_buf_size(void *buf) ^ cc1: all warnings being treated as errors
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 8c9d9445 | 23-Jul-2016 |
Etienne Carriere <etienne.carriere@linaro.org> |
core: review assert and panic traces
Replace few "{ EMSG(...); panic(); }" with "panic(...);".
Disable file/line/func debug traces in panic() logs when CFG_TEE_CORE_DEBUG is disable.
Change __asse
core: review assert and panic traces
Replace few "{ EMSG(...); panic(); }" with "panic(...);".
Disable file/line/func debug traces in panic() logs when CFG_TEE_CORE_DEBUG is disable.
Change __assert_log() uses EMSG_RAW() to no pollute trace with __assert_log() internals (duplicated file/line/func traces).
Change assert() to use a low/high verbosity mode upon CFG_TEE_CORE_DEBUG as panic() does.
Change assert() to also trace the C function where assertion failed.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jen.wiklander@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Tested-by: Etienne Carriere <etienne.carriere@linaro.org> (QEMU)
show more ...
|
| a8f34e0c | 23-Jul-2016 |
Etienne Carriere <etienne.carriere@linaro.org> |
assert: honor NDEBUG
Macro assert() expands to a no-op when NDEBUG is defined.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jen.wiklander@linaro.org> R
assert: honor NDEBUG
Macro assert() expands to a no-op when NDEBUG is defined.
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jen.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Tested-by: Etienne Carriere <etienne.carriere@linaro.org> (QEMU)
show more ...
|
| 5e7638a8 | 29-Jun-2016 |
Jens Wiklander <jens.wiklander@linaro.org> |
libutils: malloc: skip adding too small pools
Malloc skips adding pools that are too small to initialize with.
Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Tested-by: Jens Wiklander <jens.wikl
libutils: malloc: skip adding too small pools
Malloc skips adding pools that are too small to initialize with.
Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Tested-by: Jens Wiklander <jens.wiklander@linaro.org> (QEMU) Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 51932e38 | 26-May-2016 |
Jens Wiklander <jens.wiklander@linaro.org> |
libutils/newlib: clean sub.mk
As most newlib source files needs more or less the same flags to compile, apply the flags with cflags-y and clags-remove-y instead of individual flags for each file.
R
libutils/newlib: clean sub.mk
As most newlib source files needs more or less the same flags to compile, apply the flags with cflags-y and clags-remove-y instead of individual flags for each file.
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| f46a4a4a | 25-May-2016 |
Jens Wiklander <jens.wiklander@linaro.org> |
libutils: add strchr()
Imports strchr() from newlib.
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> |
| 385e3901 | 16-May-2016 |
Jens Wiklander <jens.wiklander@linaro.org> |
libutils: add BIT and SHIFT macros
* Adds BIT32(nr) and BIT64(nr) macros to set a bit in a 32-bit or 64-bit unsigned integer. * Adds SHIFT_U32(v, shift) and SHIFT_U64(v, shift) macros to shift a v
libutils: add BIT and SHIFT macros
* Adds BIT32(nr) and BIT64(nr) macros to set a bit in a 32-bit or 64-bit unsigned integer. * Adds SHIFT_U32(v, shift) and SHIFT_U64(v, shift) macros to shift a value resulting in a 32-bit or 64-bit unsigned integer.
Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| ce72d0c6 | 11-Mar-2016 |
Victor Chong <victor.chong@linaro.org> |
drivers: add gpio framework and pl061 driver
Suggested-by: Haojian Zhuang <haojian.zhuang@linaro.org> Signed-off-by: Victor Chong <victor.chong@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklande
drivers: add gpio framework and pl061 driver
Suggested-by: Haojian Zhuang <haojian.zhuang@linaro.org> Signed-off-by: Victor Chong <victor.chong@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Pascal Brand <pascal.brand@linaro.org>
show more ...
|