| 96e33b7f | 24-Jan-2025 |
Etienne Carriere <etienne.carriere@foss.st.com> |
core: dt: cached data for fdt_get_reg_props_by_index()
Factorize fdt_get_reg_props_by_index() and fdt_reg_info() to add DT cache info support to the former.
Signed-off-by: Etienne Carriere <etienne
core: dt: cached data for fdt_get_reg_props_by_index()
Factorize fdt_get_reg_props_by_index() and fdt_reg_info() to add DT cache info support to the former.
Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| bf27365d | 21-Jan-2025 |
Raymond Mao <raymond.mao@linaro.org> |
core: fix potential crash when setting transfer entry size
Fix a potential crash when the rounded up end-of-entry exceeds the boundary of the old end-of-transfer-list when setting the size of a tran
core: fix potential crash when setting transfer entry size
Fix a potential crash when the rounded up end-of-entry exceeds the boundary of the old end-of-transfer-list when setting the size of a transfer entry.
The crash happens when the specified entry is the last one in the transfer list and its rounded up end 'old_ev' exceeds the 'tl_old_ev' which is not rounded up, leading to a negative value with (tl_old_ev - old_ev).
Logically, 'tl_old_ev > old_ev' is the only case that indicates there are subsequent entries to be moved.
Signed-off-by: Raymond Mao <raymond.mao@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 09d74777 | 18-Dec-2024 |
Yuvraj Sakshith <ysakshith@gmail.com> |
core: notif_default: support ns-virtualization
Add support for CFG_NS_VIRTUALIZATION=y in the default notification implementation used with the SMC ABI.
virt_add_guest_spec_data() is used to add st
core: notif_default: support ns-virtualization
Add support for CFG_NS_VIRTUALIZATION=y in the default notification implementation used with the SMC ABI.
virt_add_guest_spec_data() is used to add struct notif_vm_bitmap for bookkeeping per guest, similarly to the implementation for the FF-A ABI.
This takes care of and removes the assert for "!guest" in notif_send_async().
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Signed-off-by: Yuvraj Sakshith <ysakshith@gmail.com> Tested-by: Yuvraj Sakshith <ysakshith@gmail.com> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 9f9c846a | 27-Dec-2024 |
Aleksandr Iashchenko <alexhoppus111@gmail.com> |
core: refactor ubsan panic code
Move panic invocation to common function. That makes entire code a little bit more compact and removes duplications. Also remove volatile modifier from ubsan_panic va
core: refactor ubsan panic code
Move panic invocation to common function. That makes entire code a little bit more compact and removes duplications. Also remove volatile modifier from ubsan_panic variable to make checkpatch happy.
Signed-off-by: Aleksandr Iashchenko <alexhoppus111@gmail.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 45ef9dd0 | 27-Dec-2024 |
Aleksandr Iashchenko <alexhoppus111@gmail.com> |
core: fix error in ubsan_builtin_unreachable naming
There is only __ubsan_handle_builtin_unreachable interface in gcc. It was there starting from version 4.9.0.
Signed-off-by: Aleksandr Iashchenko
core: fix error in ubsan_builtin_unreachable naming
There is only __ubsan_handle_builtin_unreachable interface in gcc. It was there starting from version 4.9.0.
Signed-off-by: Aleksandr Iashchenko <alexhoppus111@gmail.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 6966dabd | 27-Dec-2024 |
Aleksandr Iashchenko <alexhoppus111@gmail.com> |
core: fix gcc warnings in ubsan
Latest gcc versions utilize void * as argument type for most of the ubsan related handlers prototypes. Reproduced with gcc 11.2 .
Signed-off-by: Aleksandr Iashchenko
core: fix gcc warnings in ubsan
Latest gcc versions utilize void * as argument type for most of the ubsan related handlers prototypes. Reproduced with gcc 11.2 .
Signed-off-by: Aleksandr Iashchenko <alexhoppus111@gmail.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| eb969f18 | 26-Dec-2024 |
Aleksandr Iashchenko <alexhoppus111@gmail.com> |
core: fix undefined reference to ubsan function
Add UBSan handler __ubsan_handle_invalid_builtin, which support __builtin* functions validation. In some cases when __builtin functions are used, und
core: fix undefined reference to ubsan function
Add UBSan handler __ubsan_handle_invalid_builtin, which support __builtin* functions validation. In some cases when __builtin functions are used, undefined behaviour might be triggered by invalid arguments. E.g. passing 0 as the argument to __builtin_ctz or __builtin_clz invokes undefined behavior and is diagnosed by UBSan.
Signed-off-by: Aleksandr Iashchenko <alexhoppus111@gmail.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 04e46975 | 16-Dec-2024 |
Etienne Carriere <etienne.carriere@foss.st.com> |
tree-wide: use ROUNDUP_DIV() where applicable
Use ROUNDUP_DIV() instead of ROUNDUP(..., size) / size where applicable.
Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com> Reviewed-by: Je
tree-wide: use ROUNDUP_DIV() where applicable
Use ROUNDUP_DIV() instead of ROUNDUP(..., size) / size where applicable.
Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 76d6685e | 17-Dec-2024 |
Etienne Carriere <etienne.carriere@foss.st.com> |
tree-wide: use power-of-2 rounding macros where applicable
Use ROUNDUP2(), ROUNDUP2_OVERFLOW(), ROUNDUP2_DIV() and ROUNDDOWN2() at places where the rounding argument is a variable value and we want
tree-wide: use power-of-2 rounding macros where applicable
Use ROUNDUP2(), ROUNDUP2_OVERFLOW(), ROUNDUP2_DIV() and ROUNDDOWN2() at places where the rounding argument is a variable value and we want to leverage the implementation of these routines optimized for a power-of-2 rounding argument.
Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 2f2f69df | 13-Sep-2024 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: mm: replace MEM_AREA_TA_RAM
Replace MEM_AREA_TA_RAM with MEM_AREA_SEC_RAM_OVERALL.
All read/write secure memory is covered by MEM_AREA_SEC_RAM_OVERALL, sometimes using an aliased map. But sec
core: mm: replace MEM_AREA_TA_RAM
Replace MEM_AREA_TA_RAM with MEM_AREA_SEC_RAM_OVERALL.
All read/write secure memory is covered by MEM_AREA_SEC_RAM_OVERALL, sometimes using an aliased map. But secure read-only or execute core memory is not covered as that would defeat the purpose of CFG_CORE_RWDATA_NOEXEC.
Since the partition TA memory isn't accessed via MEM_AREA_TA_RAM any longer, don't map it using the partition specific map.
This is needed later where unification of OP-TEE core and physical TA memory is possible.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| de56c16d | 04-Oct-2024 |
Etienne Carriere <etienne.carriere@foss.st.com> |
core: kernel: dt: add and use fdt_reg_info()
Implement fdt_reg_info() instead of fdt_reg_base_address() and fdt_reg_size() to optimize look up in the DT due to finding parent node.
Signed-off-by: E
core: kernel: dt: add and use fdt_reg_info()
Implement fdt_reg_info() instead of fdt_reg_base_address() and fdt_reg_size() to optimize look up in the DT due to finding parent node.
Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 578bc4fe | 01-Oct-2024 |
Etienne Carriere <etienne.carriere@foss.st.com> |
core: dt: cache embedded DTB node information
Optimize OP-TEE boot time regarding parsing of the embedded DTB content when using libfdt. The library functions fdt_parent_offset() and fdt_node_offset
core: dt: cache embedded DTB node information
Optimize OP-TEE boot time regarding parsing of the embedded DTB content when using libfdt. The library functions fdt_parent_offset() and fdt_node_offset_by_phandle() are not very efficient since they parse the DTB from root node to target node to look up for, respectively, the node offset of a node parent and the node offset related to a node phandle. Helper functions fdt_reg_base_address() and fdt_reg_size() are also affected since they are based on fdt_parent_offset() to find the #address-cells and #size-cells properties of a node parent.
Optimize this by parsing the embedded DT once and caching node information (parent node, phandle value, parent node #address-cells and #size-cells values) in a array. Parse the array instead of the DT for find these information.
We made few tests to use bisection or hash tables for look up the information in the cache array. The gain was very small, likely due to the number of DT node involved in the platform is relatively small (only several hundreds or nodes).
This feature is enabled upon configuration switch CFG_DT_CACHED_NODE_INFO.
Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 718cc2b5 | 30-Sep-2024 |
Volodymyr Babchuk <volodymyr_babchuk@epam.com> |
notif: fix build when NS_VIRTUALIZATION is enabled
Right now OP-TEE build fails if CFG_NS_VIRTUALIZATION=y and CFG_CORE_ASYNC_NOTIF=n with the following error:
core/kernel/notif.c: In function 'nex
notif: fix build when NS_VIRTUALIZATION is enabled
Right now OP-TEE build fails if CFG_NS_VIRTUALIZATION=y and CFG_CORE_ASYNC_NOTIF=n with the following error:
core/kernel/notif.c: In function 'nex_init_notif': core/kernel/notif.c:185:42: error: 'notif_data_id' undeclared (first use in this function); did you mean 'notif_wait'? 185 | return virt_add_guest_spec_data(¬if_data_id, | ^~~~~~~~~~~~~ | notif_wait core/kernel/notif.c:185:42: note: each undeclared identifier is reported only once for each function it appears in core/kernel/notif.c:186:48: error: invalid application of 'sizeof' to incomplete type 'struct notif_data' 186 | sizeof(struct notif_data), NULL); | ^~~~~~ core/kernel/notif.c:187:1: warning: control reaches end of non-void function [-Wreturn-type] 187 | } | ^
Move `#ifdef CFG_NS_VIRTUALIZATION` section under `#ifdef CFG_CORE_ASYNC_NOTIF` to fix this.
Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| da5e7ba5 | 28-Aug-2024 |
Gatien Chevallier <gatien.chevallier@foss.st.com> |
core: pm: add unregister_pm_cb()
Add unregister_pm_cb() API function and its helper variants to allow unregistering a PM callback entry. This can be needed for example in the GPIO framework where gp
core: pm: add unregister_pm_cb()
Add unregister_pm_cb() API function and its helper variants to allow unregistering a PM callback entry. This can be needed for example in the GPIO framework where gpio_put() can release a GPIO that a driver no more consumed. In case a PM callback was previously registered for such a GPIO, consumer driver needs mean to unregister it.
This change implies that the PM callbacks list is protected from concurrent accesses hence add a lock for that purpose.
Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| de19cacb | 08-May-2024 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: replace tee_mm_sec_ddr with phys_mem functions
Replace the tee_mm_sec_ddr mm pool with the phys_mem functions. This doesn't change the behaviour.
Signed-off-by: Jens Wiklander <jens.wiklander
core: replace tee_mm_sec_ddr with phys_mem functions
Replace the tee_mm_sec_ddr mm pool with the phys_mem functions. This doesn't change the behaviour.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 980d32c4 | 19-Jun-2024 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: open-code thread_init_stack()
The implementations of thread_init_stack() are identical and trivial for both arm and riscv. So simplify code further and open-code it where it's called from in c
core: open-code thread_init_stack()
The implementations of thread_init_stack() are identical and trivial for both arm and riscv. So simplify code further and open-code it where it's called from in core/kernel/thread.c.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Alvin Chang <alvinga@andestech.com> Tested-by: Alvin Chang <alvinga@andestech.com>
show more ...
|
| 913d93a4 | 12-Aug-2024 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: add call_{early,service,driver}_initcalls()
Add more fine-grained replacements for call_initcalls() to enable initcalls at several separate stages.
Signed-off-by: Jens Wiklander <jens.wikland
core: add call_{early,service,driver}_initcalls()
Add more fine-grained replacements for call_initcalls() to enable initcalls at several separate stages.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 3e6106ff | 26-Jul-2024 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: don't instrument asan functions
Don't instrument the functions used by CFG_CORE_SANITIZE_KADDRESS=y since it may cause recursive calls together with CFG_CORE_DEBUG_CHECK_STACKS=y.
Signed-off-
core: don't instrument asan functions
Don't instrument the functions used by CFG_CORE_SANITIZE_KADDRESS=y since it may cause recursive calls together with CFG_CORE_DEBUG_CHECK_STACKS=y.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| df46e553 | 08-Jul-2024 |
Abhishek Revadekar <abhishek.rvdkr@yahoo.com> |
core: fix undefined behavior nonnull_args in user_access.c
Add null pointer checks on 'kaddr' and 'uaddr' before memcpy to avoid ubsan 'nonnull_args' panic.
xtest error log - 4013 --- $ xtest 4013
core: fix undefined behavior nonnull_args in user_access.c
Add null pointer checks on 'kaddr' and 'uaddr' before memcpy to avoid ubsan 'nonnull_args' panic.
xtest error log - 4013 --- $ xtest 4013
E/TC:? 0 Undefined behavior nonnull_arg at core/kernel/user_access.c:56 col 3 E/TC:1 0 Panic at core/kernel/ubsan.c:241 <__ubsan_handle_nonnull_arg> E/TC:1 0 TEE load address @ 0x8e100000 E/TC:1 0 Call stack: E/TC:1 0 0x8e10d6c0 print_kernel_stack at optee_os/core/arch/arm/kernel/unwind_arm64.c:89 E/TC:1 0 0x8e130c7c __do_panic at optee_os/core/kernel/panic.c:73 E/TC:1 0 0x8e134eac __ubsan_handle_nonnull_arg at optee_os/core/kernel/ubsan.c:241 E/TC:1 0 0x8e135a48 copy_from_user at optee_os/core/kernel/user_access.c:56 E/TC:1 0 0x8e157198 system_derive_ta_unique_key at optee_os/core/pta/system.c:111 E/TC:1 0 0x8e141258 pseudo_ta_enter_invoke_cmd at optee_os/core/kernel/pseudo_ta.c:209 E/TC:1 0 0x8e13401c tee_ta_invoke_command at optee_os/core/kernel/tee_ta_manager.c:765 E/TC:1 0 0x8e162dac syscall_invoke_ta_command at optee_os/core/tee/tee_svc.c:871 E/TC:1 0 0x8e108110 scall_do_call at optee_os/core/arch/arm/kernel/arch_scall_a64.S:140 E/TC:1 0 0x8e107544 thread_scall_handler at optee_os/core/arch/arm/kernel/thread.c:1138 E/TC:1 0 0x8e1048b4 el0_svc at optee_os/core/arch/arm/kernel/thread_a64.S:850 ---
Signed-off-by: Abhishek Revadekar <abhishek.rvdkr@yahoo.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 39f965c2 | 10-Jul-2024 |
Etienne Carriere <etienne.carriere@foss.st.com> |
core: kernel: print node name on provider driver registering failure
Print the name of the node when failing to register a provider driver in DT_DRIVER framework.
Signed-off-by: Etienne Carriere <e
core: kernel: print node name on provider driver registering failure
Print the name of the node when failing to register a provider driver in DT_DRIVER framework.
Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com> Acked-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
show more ...
|
| f4cc581b | 09-Jul-2024 |
Etienne Carriere <etienne.carriere@foss.st.com> |
core: kernel: dt_driver: fix nodes reference passed in dt_pargs
Correct the DT node references passed in struct dt_pargs. Field phandle_node is expected to be the node offset of the provider driver
core: kernel: dt_driver: fix nodes reference passed in dt_pargs
Correct the DT node references passed in struct dt_pargs. Field phandle_node is expected to be the node offset of the provider driver but dt_driver_device_from_node_idx_prop_phandle() implementation passes node offset -1, dt_driver_device_from_parent() passes the consumer node offset and dt_driver_device_from_node_idx_prop() may pass the phandle node offset from a previous index in the parsed DT node property.
Fix that by adding field consumer_node to reference the node offset of the consumer device and fixing phandle_node where applicable and update atmel_i2c and stm32_i2c drivers to get the I2C device address from the consumer_node field instead of the phandle_node that is now fixed.
Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com> Acked-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
show more ...
|
| d237e616 | 06-Feb-2024 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: make generic notifications virtualization-aware
Makes the generic notification handling aware of virtualization. Atomic events are delivered with a guest_id parameter and asynchronous notifica
core: make generic notifications virtualization-aware
Makes the generic notification handling aware of virtualization. Atomic events are delivered with a guest_id parameter and asynchronous notifications are started per guest_id.
struct notif_data is added as guest specific data to be able to track if notifications are started for a guest.
While this patch compiles it doesn't work as intended without patches handling the ABI specific side of things.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 956c2d50 | 12-Jun-2024 |
Etienne Carriere <etienne.carriere@foss.st.com> |
core: fix race condition on TA/PTA/StMM context loading
Fix race condition on creation of a context for single instance TAs, PTAs or StMM application. Such race condition could occur and lead to dup
core: fix race condition on TA/PTA/StMM context loading
Fix race condition on creation of a context for single instance TAs, PTAs or StMM application. Such race condition could occur and lead to duplicated contexts if connected close enough that they are created after tee_ta_init_session() calls tee_ta_init_session_with_context() and before the context are added in the centralized context list.
This is realized by keeping tee_ta_mutex held while tee_ctxes list is looked up for matching a context or a new context is added into that list with its .is_initializing field activated. For that purpose user TA and StMM application initialization function are split in 2 functions, the 2nd one used to finalizes the context creation started in the 1st function.
By the way, add inline description comments and fix indentation issues in uaer_ta.h and remove the inline comment in pseudo_ta.c that refers to TA loading whereas the function relates to PTA contexts creation.
Closes: https://github.com/OP-TEE/optee_os/issues/6801 Suggested-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| fee55718 | 14-May-2024 |
Etienne Carriere <etienne.carriere@foss.st.com> |
core: make is_initializing field a generic service context
Replace fields is_initializing from struct user_mode_ctx and struct stmm_ctx with a common new field is_initialing in generic struct tee_ta
core: make is_initializing field a generic service context
Replace fields is_initializing from struct user_mode_ctx and struct stmm_ctx with a common new field is_initialing in generic struct tee_ta_ctx so that it can be used in generic context loading functions for contexts which initialization is done with tee_ta_mutex released.
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 9b0ee59d | 12-Jun-2024 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: rename tee_mm_vcore to core_virt_mem_pool
Rename tee_mm_vcore to core_virt_mem_pool to make it clear that it handles virtual memory allocations.
Signed-off-by: Jens Wiklander <jens.wiklander@
core: rename tee_mm_vcore to core_virt_mem_pool
Rename tee_mm_vcore to core_virt_mem_pool to make it clear that it handles virtual memory allocations.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|