| fe85eae5 | 13-Sep-2024 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: add CFG_BOOT_MEM and boot_mem_*() functions
Adds CFG_BOOT_MEM to support stack-like memory allocations during boot before a heap has been configured.
Signed-off-by: Jens Wiklander <jens.wikl
core: add CFG_BOOT_MEM and boot_mem_*() functions
Adds CFG_BOOT_MEM to support stack-like memory allocations during boot before a heap has been configured.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| a5ac48d6 | 13-Sep-2024 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: add VCORE_FREE_{PA,SZ,END_PA}
Add VCORE_FREE_{PA,SZ,END_PA} defines to identify the unused and free memory range at the end of TEE_RAM_START..(TEE_RAM_START + TEE_RAM_VA_SIZE).
VCORE_FREE_SZ
core: add VCORE_FREE_{PA,SZ,END_PA}
Add VCORE_FREE_{PA,SZ,END_PA} defines to identify the unused and free memory range at the end of TEE_RAM_START..(TEE_RAM_START + TEE_RAM_VA_SIZE).
VCORE_FREE_SZ is 0 in a pager configuration since all the memory is used by the pager.
The VCORE_FREE range is excluded from the TEE_RAM_RW area for CFG_NS_VIRTUALIZATION=y and instead put in a separate NEX_RAM_RW area. This makes each partition use a bit less memory and leaves the VCORE_FREE range available for the Nexus.
The VCORE_FREE range is added to the TEE_RAM_RW area for the normal configuration with CFG_NS_VIRTUALIZATION=n and CFG_WITH_PAGER=n. It's in practice unchanged behaviour in this configuration.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 6b1b2b99 | 29-Oct-2024 |
Yitong Cheng <santongding@foxmail.com> |
core: thread: clarify thread_rpc_alloc_*_payload() inline description
The thread_rpc_alloc_*_payload APIs are consistent with the thread_shm_type enumerations, as seen in the alloc_shm function. How
core: thread: clarify thread_rpc_alloc_*_payload() inline description
The thread_rpc_alloc_*_payload APIs are consistent with the thread_shm_type enumerations, as seen in the alloc_shm function. However, the name and comments of thread_rpc_alloc_payload might be misleading, suggesting it is a universal API. To maintain backward compatibility, only the code comments have been updated for clarity.
Signed-off-by: Yitong Cheng <santongding@foxmail.com> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
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 ...
|
| 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 ...
|
| a7574834 | 18-Sep-2024 |
Etienne Carriere <etienne.carriere@foss.st.com> |
core: timeout_elapsed(): fix expiration threshold
Fix timeout threshold that should return once the time expires, not 1 tick after it has expired. This change makes udelay(0) to immediately return a
core: timeout_elapsed(): fix expiration threshold
Fix timeout threshold that should return once the time expires, not 1 tick after it has expired. This change makes udelay(0) to immediately return and not wait a generic timer counter increment.
This change fixes an issue where a driver stops the counter feeding Arm generic timer counter and indirectly calls IO_READ32_POLL_TIMEOUT() with a delay of 0us. It that case, since counter never increments, the udelay(0) call in IO_READ32_POLL_TIMEOUT() never returns while we expect the macro to endlessly poll (as timeout would never be detected) until poll condition is met or system watchdog is triggered.
Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com> Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| f00b453a | 19-Jan-2024 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: add THREAD_SHM_CACHE_USER_RPMB
Add an enum to cache RPMB shared memory allocations.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@l
core: add THREAD_SHM_CACHE_USER_RPMB
Add an enum to cache RPMB shared 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 ...
|
| 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 ...
|
| faf09045 | 15-Jun-2024 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: arm: introduce boot_init_primary_final()
Introduce boot_init_primary_final() and move the call to call_finalcalls() into that function.
This is needed in later patches to enabled PAUTH before
core: arm: introduce boot_init_primary_final()
Introduce boot_init_primary_final() and move the call to call_finalcalls() into that function.
This is needed in later patches to enabled PAUTH before boot_init_primary_final() is called.
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 ...
|
| b8ef8d0b | 08-May-2024 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: mm: introduce struct memory_map
Introduce struct memory_map to keep track of the array of struct tee_mmap_region, covering number of used entries and number of allocated entries.
core_mmap_is
core: mm: introduce struct memory_map
Introduce struct memory_map to keep track of the array of struct tee_mmap_region, covering number of used entries and number of allocated entries.
core_mmap_is_end_of_table() and MEM_AREA_END are now unused so remove them.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| 42c3d31b | 26-Jul-2024 |
Thomas Perrot <thomas.perrot@bootlin.com> |
kernel: pm: add suspend type hint
When entering suspend type, the suspend level is platform dependent and can be set to various values depending on these platform. In order to allow platforms settin
kernel: pm: add suspend type hint
When entering suspend type, the suspend level is platform dependent and can be set to various values depending on these platform. In order to allow platforms setting it in a generic way when entering suspend, reserve some bits in the suspend/resume hint to pass this information. Driver can then used it in a platform independent way to execute specific code depending on it.
Signed-off-by: Thomas Perrot <thomas.perrot@bootlin.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| 773d3f83 | 08-Jul-2024 |
Levi Yun <yeoreum.yun@arm.com> |
core: kernel: Fix checking register convention r1/x1 value of transfer_list
According to recently firmware handsoff spec [1]'s "Register usage at handoff boundary", Transfer List's signature value w
core: kernel: Fix checking register convention r1/x1 value of transfer_list
According to recently firmware handsoff spec [1]'s "Register usage at handoff boundary", Transfer List's signature value was changed from 0x40_b10b (3 bytes) to 4a0f_b10b (4 bytes).
As updating of TL's signature, register value of x1/r1 should be:
In aarch32's r1 value should be R1[23:0]: set to the TL signature (4a0f_b10b->masked value: 0f_b10b) R1[31:24]: version of the register convention == 1 and In aarch64's x1 value should be X1[31:0]: set to the TL signature (4a0f_b10b) X1[39:32]: version of the register convention == 1 X1[63:40]: MBZ (See the [2] and [3]).
Therefore, it requires to separate mask and shift value for register convention version field when checking each r1/x1 value.
This patch fix two problems: 1. breaking X1 value with updated specification in aarch64 - change of length of signature field.
2. previous error value set in R1 in arm32. - length of signature should be 24, but it uses 32bit signature.
This patch is a breaking change. It works only TF-A is updated.
Link: https://github.com/FirmwareHandoff/firmware_handoff [1] Link: https://github.com/FirmwareHandoff/firmware_handoff/issues/32 [2] Link: https://github.com/FirmwareHandoff/firmware_handoff/commit/5aa7aa1d3a1db75213e458d392b751f0707de027 [3] Fixes: 508e2476b232 ("core: update transfer list header and signature") Signed-off-by: Levi Yun <yeoreum.yun@arm.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
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 ...
|
| beb90210 | 05-Feb-2024 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: virt: add guest specific data
Add virt_add_guest_spec_data() and virt_get_guest_spec_data() to handle guest specific data.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by:
core: virt: add guest specific data
Add virt_add_guest_spec_data() and virt_get_guest_spec_data() to handle guest specific data.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| a951eb5f | 26-Feb-2024 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: virt: support iterating over partitions
Add support to iterate over partitions using virt_next_guest().
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Etienne Carriere <e
core: virt: support iterating over partitions
Add support to iterate over partitions using virt_next_guest().
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| a755a64f | 26-Feb-2024 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: virt: get guest ID of a guest partition
Add the function virt_get_guest_id() to return the guest ID of a guest partition.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: E
core: virt: get guest ID of a guest partition
Add the function virt_get_guest_id() to return the guest ID of a guest partition.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 29e682bd | 26-Feb-2024 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: virt: get current guest partition
Add the function virt_get_current_guest() to get a pointer to the current guest partition. The returned guest partition has its reference counter increased wh
core: virt: get current guest partition
Add the function virt_get_current_guest() to get a pointer to the current guest partition. The returned guest partition has its reference counter increased which must be restored with a matching call to virt_put_guest() when the caller is done with the guest partition.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| ac1c95dd | 26-Feb-2024 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: virt: get guest partition by guest ID
Add the function virt_get_guest() to get the pointer to a guest partition with a certain guest ID. The returned guest partition has its reference counter
core: virt: get guest partition by guest ID
Add the function virt_get_guest() to get the pointer to a guest partition with a certain guest ID. The returned guest partition has its reference counter increased which must be restored with a matching call to virt_put_guest() when the caller is done with the guest partition.
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 ...
|
| 30730d67 | 13-Jun-2024 |
Etienne Carriere <etienne.carriere@foss.st.com> |
core: add mutex_is_locked() helper function
Add mutex_is_locked() helper function to return whether a mutex is locked or not. This helper function must be use with care since it does not guarantee t
core: add mutex_is_locked() helper function
Add mutex_is_locked() helper function to return whether a mutex is locked or not. This helper function must be use with care since it does not guarantee that the mutex is held by the executing thread.
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 ...
|
| 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 ...
|