History log of /optee_os/lib/libutils/ext/trace.c (Results 1 – 25 of 26)
Revision Date Author Comments
# 17a66904 10-Nov-2023 Jens Wiklander <jens.wiklander@linaro.org>

core: print current guest ID in logs

If CFG_NS_VIRTUALIZATION is enabled include the current guest ID on each
log line. A number is added before the core number identifying the
currently set guest I

core: print current guest ID in logs

If CFG_NS_VIRTUALIZATION is enabled include the current guest ID on each
log line. A number is added before the core number identifying the
currently set guest ID, for example:
D/TC:2 0 0 call_initcalls:40 level 1 teecore_init_pub_ram()

Where the "2" indicates that this is done with guest ID 2 active.

Update the symbolize.py script accordingly to recognize and ignore an
eventual guest ID in a log entry.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>

show more ...


# d31aa877 14-Dec-2021 Marouene Boubakri <marouene.boubakri@nxp.com>

lib: libutils: trace.c: make print_core_id() architecture-independent

The function print_core_id() in is calling architecture-specific routines
to retrieve the core id. It is more relevant to create

lib: libutils: trace.c: make print_core_id() architecture-independent

The function print_core_id() in is calling architecture-specific routines
to retrieve the core id. It is more relevant to create a new abstract
function trace_ext_get_core_id() in lib/libutee/trace_ext.c that needs to
be implemented in the architecture-specific code. This is similar to
print_thread_id() which calls trace_ext_get_thread_id() implemented in
core/arch/arm/kernel/trace_ext.c

Signed-off-by: Marouene Boubakri <marouene.boubakri@nxp.com>
Reviewed-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# 72b4db64 08-Dec-2021 Jerome Forissier <jerome@forissier.org>

libutils: trace: support more than 100 threads and cores

Add code to support printing thread and core number on 3 digits when
needed.

Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed

libutils: trace: support more than 100 threads and cores

Add code to support printing thread and core number on 3 digits when
needed.

Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>

show more ...


# 6327913c 08-Dec-2021 Jerome Forissier <jerome@forissier.org>

libutils: trace: fix off-by-one when switching to 2 digits for thread id

Threads are numbered starting from zero so when CFG_NUM_THREADS == 10
the number still fits on one digit. Fix the conditional

libutils: trace: fix off-by-one when switching to 2 digits for thread id

Threads are numbered starting from zero so when CFG_NUM_THREADS == 10
the number still fits on one digit. Fix the conditional in
print_thread_id().

Signed-off-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>

show more ...


# 3dd0e94e 18-Jun-2019 Jens Wiklander <jens.wiklander@linaro.org>

libutils: add trace_vprintf()

Adds the trace_vprintf() helper function.

Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>


# b0d497fa 20-Dec-2018 Jerome Forissier <jerome.forissier@linaro.org>

libutils: export PRIxVA_WIDTH and add PRIxPA_WIDTH

Export two macros that are useful to print virtual or physical addresses
with the full width required by the native type, that is, 0x + 8
character

libutils: export PRIxVA_WIDTH and add PRIxPA_WIDTH

Export two macros that are useful to print virtual or physical addresses
with the full width required by the native type, that is, 0x + 8
characters when the pointer size is 32 bits, and 0x + 16 characters when
it is 64 bits.

Example:

vaddr_t va = 0x1234;

DMSG("va=0x%0*" PRIxVA, PRIxVA_WIDTH, va);

The above code will print "va=0x00001234" if vaddr_t is 32 bits, and
"va=0x0000000000001234" if vaddr_t is 64 bits.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# b6bc49ca 17-Jan-2019 Sumit Garg <sumit.garg@linaro.org>

trace: fix core id print if in non-atomic context

Make "?" print repetitive equivalent to number of digits needed to display
core id rather than extra spaces as it causes symbolize.py script parsing

trace: fix core id print if in non-atomic context

Make "?" print repetitive equivalent to number of digits needed to display
core id rather than extra spaces as it causes symbolize.py script parsing
failure for call stack addresses in case number of cores is greater than
10.

Also change symbolize.py to detect repetitive "?".

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# 3f58e4ec 05-Nov-2018 Ovidiu Mihalachi <ovidiu_mihalachi@mentor.com>

trace levels: Redefine TRACE_MIN level to 0

The global `trace_level` session-wise indicator which is set by
`trace_set_level()` [1], could get a wrong value in case of an
input `level` set to 0, mea

trace levels: Redefine TRACE_MIN level to 0

The global `trace_level` session-wise indicator which is set by
`trace_set_level()` [1], could get a wrong value in case of an
input `level` set to 0, meaning that all logs need to be disabled
by user define `CFG_TEE_TA_LOG_LEVEL=0` when building TA applications.

This inconsistency is caused by a rather wrong value of `TRACE_MIN`
low boundary value set to 1. According to [1] `trace level` will be
set to `TRACE_MAX` (4) in case input level is smaller than `TRACE_MIN`
and larger than `TRACE_MAX`.
In the scenario when the needed log level is 0, `trace level` would be
set to `TRACE_MAX` and will cause a lot of flow log level information
dumped by trace functions/macros that are using `trace_printf()`
primitive.

This patch sets the `TRACE_MIN` to 0 in order to assure a proper trace
level setting and completely disable all logs in case
`CFG_TEE_TA_LOG_LEVEL=0`.

[1]
void trace_set_level(int level)
{
if (((int)level >= TRACE_MIN) && (level <= TRACE_MAX))
trace_level = level;
else
trace_level = TRACE_MAX;
}

Acked-by: Christoph Gellner <cgellner@de.adit-jv.com>
Signed-off-by: Ovidiu Mihalachi <ovidiu_mihalachi@mentor.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>

show more ...


# 0fe671d3 24-May-2018 Volodymyr Babchuk <vlad.babchuk@gmail.com>

trace: get thread_id right in print_thread_id()

Signed-off-by: Volodymyr Babchuk <vlad.babchuk@gmail.com>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>


# a920a741 24-May-2018 Volodymyr Babchuk <vlad.babchuk@gmail.com>

trace: check for CFG_MSG_LONG_PREFIX_MASK only once per message

There is no need for repeated checks for every portion of
extended prefix.

Signed-off-by: Volodymyr Babchuk <vlad.babchuk@gmail.com>

trace: check for CFG_MSG_LONG_PREFIX_MASK only once per message

There is no need for repeated checks for every portion of
extended prefix.

Signed-off-by: Volodymyr Babchuk <vlad.babchuk@gmail.com>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>

show more ...


# 64fad262 23-May-2018 Volodymyr Babchuk <vlad.babchuk@gmail.com>

trace: print core id if in atomic context

If (D|E|I|F)MSG is called with foreign interrupts masked
we can report core ID. "?" will be printed instead, if
foreign interrupts aren't masked.

With this

trace: print core id if in atomic context

If (D|E|I|F)MSG is called with foreign interrupts masked
we can report core ID. "?" will be printed instead, if
foreign interrupts aren't masked.

With this patch log looks like this:

D/TC:2 0 core_mmu_set_user_map:940 0xe181b88 0xeee8003
D/TC:? 0 __wq_rpc:40 wake thread 1 0xe16f028 -3
D/TC:1 thread_handle_std_smc:612 a7: 2
D/TC:3 0 core_mmu_set_user_map:940 0x0 0x0

Where first digit shows core id and second - thread id.

Signed-off-by: Volodymyr Babchuk <vlad.babchuk@gmail.com>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>

show more ...


# dc0f4ec2 16-May-2018 Etienne Carriere <etienne.carriere@st.com>

Remove license notice from STMicroelectronics files

Since a while the source files license info are defined by SPDX
identifiers. We can safely remove the verbose license text from the
files that are

Remove license notice from STMicroelectronics files

Since a while the source files license info are defined by SPDX
identifiers. We can safely remove the verbose license text from the
files that are owned by either only STMicroelectronics or only both
Linaro and STMicroelectronics.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# 1bb92983 15-Dec-2017 Jerome Forissier <jerome.forissier@linaro.org>

Add SPDX license identifiers

Adds one SPDX-License-Identifier line [1] to each source files that
contains license text.

Generated by [2]:
spdxify.py --add-spdx optee_os/

The scancode tool [3] wa

Add SPDX license identifiers

Adds one SPDX-License-Identifier line [1] to each source files that
contains license text.

Generated by [2]:
spdxify.py --add-spdx optee_os/

The scancode tool [3] was used to double check the license matching
code in the Python script. All the licenses detected by scancode are
either detected by spdxify.py, or have no SPDX identifier, or are false
matches.

Link: [1] https://spdx.org/licenses/
Link: [2] https://github.com/jforissier/misc/blob/f7b56c8/spdxify.py
Link: [3] https://github.com/nexB/scancode-toolkit
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Acked-by: Joakim Bech <joakim.bech@linaro.org>

show more ...


# 546291f4 15-Dec-2017 Joakim Bech <joakim.bech@linaro.org>

trace: make output more compact

The new format for traces are:
<type>/<where>:<thread_id> [<func:line>] <message>

<type>:
D = DEBUG
E = ERROR
I = INFO
F = FLOW

<where>:
TA = Trusted Ap

trace: make output more compact

The new format for traces are:
<type>/<where>:<thread_id> [<func:line>] <message>

<type>:
D = DEBUG
E = ERROR
I = INFO
F = FLOW

<where>:
TA = Trusted Application
TC = TEE Core

I.e, it outputs messages like this:
D/TC:00 ta_load:316 ELF load address 0x101000
etc

Thread ID will either take a single or two digits depending on the
number of threads in use.

Signed-off-by: Joakim Bech <joakim.bech@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>

show more ...


# 2bfab756 13-Jun-2017 Jerome Forissier <jerome.forissier@linaro.org>

trace.c: show file/line info for flow, debug and error messages

Since commit f4aa5b11f9a3 ("Update trace format to be less verbose in
INFO and ERROR levels"), INFO and ERROR messages don't show sour

trace.c: show file/line info for flow, debug and error messages

Since commit f4aa5b11f9a3 ("Update trace format to be less verbose in
INFO and ERROR levels"), INFO and ERROR messages don't show source file
and line information by default, while message with lower severity
(DEBUG and FLOW) do contain such information. While it is OK for INFO,
it turns out to be inconvenient for ERRORs during development, because
one typically wants to be able to quickly locate the source of errors.
This patch fixes the problem by introducing a mask rather than a level
to control the long output format. This allows individual selection of
which level should use a long vs. short format.
The compile-time setting CFG_MSG_LONG_PREFIX_THRESHOLD is replaced by
CFG_MSG_LONG_PREFIX_MASK with default value 0x1a (= BIT(TRACE_ERROR) |
BIT(TRACE_DEBUG) | BIT(TRACE_FLOW)).

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# 0b647977 16-Mar-2016 Jerome Forissier <jerome.forissier@linaro.org>

Make sure trace_printf() terminates the string with one unique \n

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

Make sure trace_printf() terminates the string with one unique \n

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Pascal Brand <pascal.brand@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# f4aa5b11 12-May-2015 Jerome Forissier <jerome.forissier@linaro.org>

Update trace format to be less verbose in INFO and ERROR levels

- By default, traces of severity TRACE_INFO or lower will not print
the thread ID, function name or line number. Can be controlled by

Update trace format to be less verbose in INFO and ERROR levels

- By default, traces of severity TRACE_INFO or lower will not print
the thread ID, function name or line number. Can be controlled by
CFG_MSG_LONG_PREFIX_THRESHOLD (see mk/config.mk).
- The trace level string is updated ("DEBUG", "INFO" etc. instead of
"DBG", "INF" etc.) for consistency with ARM Trusted Firmware.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Pascal Brand <pascal.brand@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# 91845199 22-Feb-2016 Joakim Bech <joakim.bech@linaro.org>

Fixes buffer overflow in trace_printf

Fixes issue https://github.com/OP-TEE/optee_os/issues/660

Signed-off-by: Joakim Bech <joakim.bech@linaro.org>
Tested-by: Joakim Bech <joakim.bech@linaro.org> (

Fixes buffer overflow in trace_printf

Fixes issue https://github.com/OP-TEE/optee_os/issues/660

Signed-off-by: Joakim Bech <joakim.bech@linaro.org>
Tested-by: Joakim Bech <joakim.bech@linaro.org> (QEMU)
Reviewed-by: Pascal Brand <pascal.brand@linaro.org>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>

show more ...


# fe3ccf24 30-Nov-2015 Jerome Forissier <jerome.forissier@linaro.org>

libutils: add %pUl format for UUIDs

The debug traces in tee_ta_manager.c do not show the last 8 bytes of
the TA UUIDs, which makes the output confusing sometimes.
This commit adds support for a new

libutils: add %pUl format for UUIDs

The debug traces in tee_ta_manager.c do not show the last 8 bytes of
the TA UUIDs, which makes the output confusing sometimes.
This commit adds support for a new printf format for little-endian
encoded UUIDs: %pUl, and uses it in tee_ta_manager.c. For example:

TEE_UUID uuid;
DMSG("UUID: %pUl", (void *)&uuid);

...will print something like:

[...] UUID: cb3e5ba0-adf1-11e0-998b0002a5d5c51b

The new format is available when using the trace macros or the new
functions: snprintk(), vsnprintk() declared in <printk.h>.
But, snprintf() and vsnprintf() are not modified in order not to break
standard compliance.

This format is taken from the Linux kernel [1].

[1] https://www.kernel.org/doc/Documentation/printk-formats.txt

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Pascal Brand <pascal.brand@linaro.org>

show more ...


# bf50df8b 04-Nov-2015 Jerome Forissier <jerome.forissier@linaro.org>

DHEXDUMP(): prefix each line with the current address in the buffer

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by:

DHEXDUMP(): prefix each line with the current address in the buffer

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>

show more ...


# bfc6487b 10-Sep-2015 Jerome Forissier <jerome.forissier@linaro.org>

Flush traces synchronously

Avoids random mixing of secure world traces with ones from the normal
world (assuming the normal world also flushes its debug traces
synchronously).

The 'sync' parameter

Flush traces synchronously

Avoids random mixing of secure world traces with ones from the normal
world (assuming the normal world also flushes its debug traces
synchronously).

The 'sync' parameter to the trace_printf() and trace_ext_puts() function
is removed because there seems to be no sensible use case mandating
sync == false.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Pascal Brand <pascal.brand@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# 8a1e7b89 30-Mar-2015 Jerome Forissier <jerome.forissier@linaro.org>

Rename CFG_TRACE_LEVEL to TRACE_LEVEL

The trace level macro is not meant to be configured directly, it takes its
value from CFG_TEE_CORE_LOG_LEVEL (when the TEE core is compiled) or from
CFG_TEE_TA_

Rename CFG_TRACE_LEVEL to TRACE_LEVEL

The trace level macro is not meant to be configured directly, it takes its
value from CFG_TEE_CORE_LOG_LEVEL (when the TEE core is compiled) or from
CFG_TEE_TA_LOG_LEVEL (when user libraries are compiled). Therefore it should
not have a CFG_ prefix.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>

show more ...


# 0e91d797 30-Jan-2015 Jean-Michel Delorme <jean-michel.delorme@st.com>

Fix user TA trace issue

Definition of the global "trace_level" variable has been
moved from the libutil to a TA file (user_ta_header.c).
This allows to initialize it with the correct value/level
CFG

Fix user TA trace issue

Definition of the global "trace_level" variable has been
moved from the libutil to a TA file (user_ta_header.c).
This allows to initialize it with the correct value/level
CFG_TEE_TA_LOG_LEVEL when the TA code is compiled.
Same trace level is now applied at all TA code and associated
libraries: libutee/libutils/libmpa.

Change-Id: Id6bda7f0611f78fe7ad3ee6b61193f4b80aba94d
Signed-off-by: Jean-Michel Delorme <jean-michel.delorme@st.com>
Reviewed-on: https://gerrit.st.com/22472
Reviewed-by: Emmanuel MICHEL <emmanuel.michel@st.com>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Tested-by: Pascal Brand <pascal.brand@linaro.org> (STM platform)

show more ...


# e5dc28cc 28-Nov-2014 Pascal Brand <pascal.brand@st.com>

Keep binary compatilities TEECore <--> TA

In case the core is compiled with
CFG_TEE_TA_LOG_LEVEL=0
then TA cannot be compiled with CFG_TEE_TA_LOG_LEVEL!=0 because of the trace
function.

This pa

Keep binary compatilities TEECore <--> TA

In case the core is compiled with
CFG_TEE_TA_LOG_LEVEL=0
then TA cannot be compiled with CFG_TEE_TA_LOG_LEVEL!=0 because of the trace
function.

This patch implements stub trace functions in case of unsufficient trace level.
It also check
- TRACE_LEVEL < 0 instead of TRACE_LEVEL == 0
- TRACE_LEVEL >= 0 instead of TRACE_LEVEL != 0
to take into account negative trae levels

Change-Id: I7b4d2d576c50e103d9cf6f5b22f9f99a1ab96d6a
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>

show more ...


# 44202a48 26-Nov-2014 Pascal Brand <pascal.brand@st.com>

Add MSG() macro for traces

MSG() and MSG_RAW() macros are added.
They are the same as xMSG() and xMSG_RAW() existing macros, but are not
subject to dynamic trace level

Note that when the core trace

Add MSG() macro for traces

MSG() and MSG_RAW() macros are added.
They are the same as xMSG() and xMSG_RAW() existing macros, but are not
subject to dynamic trace level

Note that when the core trace level is 0, these macros are void.

This patch also fixes an issue with "printf" level.

Change-Id: Ibff6058d7e35d728a46878b345b6e0833c18aec1
Reviewed-on: https://gerrit.st.com/18102
Reviewed-by: Emmanuel MICHEL <emmanuel.michel@st.com>
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>

show more ...


12