| 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 ...
|
| c5e3e79f | 10-Jun-2024 |
Sungbae Yoo <sungbaey@nvidia.com> |
core: kernel: change DT getters to use manifest DT
This change get_dt() and get_secure_dt() to use manifest DT as an alternative if there is no embedded DT or external DT.
Signed-off-by: Sungbae Yo
core: kernel: change DT getters to use manifest DT
This change get_dt() and get_secure_dt() to use manifest DT as an alternative if there is no embedded DT or external DT.
Signed-off-by: Sungbae Yoo <sungbaey@nvidia.com> Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 4bc2c5f0 | 10-Jun-2024 |
Sungbae Yoo <sungbaey@nvidia.com> |
core: kernel: move manifest DT functions to dt.c
This moves functions to handle manifest DT, used as a SP (secure partition) manifest via FF-A interface, to core/kernel/dt.c and their definitions to
core: kernel: move manifest DT functions to dt.c
This moves functions to handle manifest DT, used as a SP (secure partition) manifest via FF-A interface, to core/kernel/dt.c and their definitions to dt.h. manifest DT is dependent with CORE_FFA that depends on CFG_DT, as the same as dt.c.
Signed-off-by: Sungbae Yoo <sungbaey@nvidia.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 910441c3 | 20-May-2024 |
Yu Chien Peter Lin <peterlin@andestech.com> |
core: kernel: factor out shared memory boot-time helpers
The static and dynamic shared memory helpers used for boot-time reservation/registration are non-architecture-specific. Moving them into the
core: kernel: factor out shared memory boot-time helpers
The static and dynamic shared memory helpers used for boot-time reservation/registration are non-architecture-specific. Moving them into the generic boot.c file will help avoid duplicated code and improve maintainability.
Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by: Alvin Chang <alvinga@andestech.com> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| 48a1cce4 | 02-May-2024 |
Gatien Chevallier <gatien.chevallier@foss.st.com> |
core: firewall: add firewall framework
Add a generic firewall controller framework. The goal of this framework is to offer access control and configuration APIs, that are implemented in the firewall
core: firewall: add firewall framework
Add a generic firewall controller framework. The goal of this framework is to offer access control and configuration APIs, that are implemented in the firewall controllers drivers, to the firewall consumers. This framework requires an embedded device tree.
A firewall controller is an access controller [1]. It should register itself as a provider to the framework. Firewall controllers have the possibility to populate their bus according to defined firewall accesses defined in the "access-controllers" property in each of the device's node.
Any device that consumes one or more firewall should refer it/them in their "access-controllers" property. Arguments can be passed along with the phandle of the firewall controller(s).
Link: https://patchwork.kernel.org/project/linux-media/patch/20240105130404.301172-2-gatien.chevallier@foss.st.com/ [1] Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| d4a87690 | 17-May-2024 |
Sungbae Yoo <sungbaey@nvidia.com> |
drivers: Add FFA_CONSOLE based console driver for log
This console driver uses FFA_CONSOLE ABI to write the trace logs.
If CFG_FFA_CONSOLE is enabled, OP-TEE will try to initialize the console driv
drivers: Add FFA_CONSOLE based console driver for log
This console driver uses FFA_CONSOLE ABI to write the trace logs.
If CFG_FFA_CONSOLE is enabled, OP-TEE will try to initialize the console driver that uses FFA interface to print trace logs.
Signed-off-by: Sungbae Yoo <sungbaey@nvidia.com> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| 59c7dfbe | 06-May-2024 |
Abhishek Revadekar <abhishek.rvdkr@yahoo.com> |
core: fix undefined references to ubsan functions
Add UBSan handlers for `__ubsan_handle_type_mismatch_v1` and `__ubsan_handle_pointer_overflow` to remove undefined references error.
Acked-by: Jens
core: fix undefined references to ubsan functions
Add UBSan handlers for `__ubsan_handle_type_mismatch_v1` and `__ubsan_handle_pointer_overflow` to remove undefined references error.
Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Abhishek Revadekar <abhishek.rvdkr@yahoo.com>
show more ...
|
| 95b8c535 | 02-May-2024 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: callout: disable obsolete timeouts
In callout_service_cb() when a timeout interrupt is received there's a check to see if this is the last scheduled CPU. If not the interrupt is ignored, but n
core: callout: disable obsolete timeouts
In callout_service_cb() when a timeout interrupt is received there's a check to see if this is the last scheduled CPU. If not the interrupt is ignored, but not disabled causing it to trigger again and again. So fix this by disabling the timeout too.
Fixes: cf707bd0d695 ("core: add callout service") Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| ea413ca5 | 31-Jan-2024 |
Gavin Liu <gavin.liu@mediatek.com> |
core: mutex: add support timeout condvar
Add support timeout condvar based on timeout notify
Signed-off-by: Gavin Liu <gavin.liu@mediatek.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org
core: mutex: add support timeout condvar
Add support timeout condvar based on timeout notify
Signed-off-by: Gavin Liu <gavin.liu@mediatek.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 450f8ada | 23-Jan-2024 |
Gavin Liu <gavin.liu@mediatek.com> |
core: notif: add support timeout notify
Add support timeout notification, allowing to avoid waiting indefinitely for the completion of an event
Signed-off-by: Gavin Liu <gavin.liu@mediatek.com> Rev
core: notif: add support timeout notify
Add support timeout notification, allowing to avoid waiting indefinitely for the completion of an event
Signed-off-by: Gavin Liu <gavin.liu@mediatek.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|