| d45fc140 | 26-Nov-2025 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: ffa: add missing field in memory access descriptor
FF-A v1.2 introduced a 16 byte implementation-defined field in the endpoint memory access descriptor. Update all handling of struct ffa_mem_a
core: ffa: add missing field in memory access descriptor
FF-A v1.2 introduced a 16 byte implementation-defined field in the endpoint memory access descriptor. Update all handling of struct ffa_mem_access to for correct access regardless of FF-A version.
With this patch, OP-TEE will use the updated memory access descriptor, but ignore the impdef field.
Suggested-by: Olivier Deprez <olivier.deprez@arm.com> Fixes: bef959c837fe ("core: arm: ffa: switch to FF-A version 1.2") Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| 82d5d8cc | 24-Oct-2025 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: ffa: guard sp_session field state with spinlock
Accesses to the state field in struct sp_session is often guarded with a spinlock, but there are a few places with it's missing. So, add the mis
core: ffa: guard sp_session field state with spinlock
Accesses to the state field in struct sp_session is often guarded with a spinlock, but there are a few places with it's missing. So, add the missing spinlocks.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| 8c8f3bae | 24-Oct-2025 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: ffa: verify thread ID before resuming S-EL0 SP
Check that the thread ID for an S-EL0 SP is correct before trying to resume it. This guards against resuming an unrelated thread.
Signed-off-by:
core: ffa: verify thread ID before resuming S-EL0 SP
Check that the thread ID for an S-EL0 SP is correct before trying to resume it. This guards against resuming an unrelated thread.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| 6af74df5 | 24-Oct-2025 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: ffa: fix direct request error code for S-EL0 SP
Direct requests to S-EL0 SPs are delivered using a thread. If no thread is available return FFA_BUSY, to let the caller know that it should try
core: ffa: fix direct request error code for S-EL0 SP
Direct requests to S-EL0 SPs are delivered using a thread. If no thread is available return FFA_BUSY, to let the caller know that it should try again. This should normally never happen, but let's do our best for a corner case.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| 00338334 | 31-Oct-2024 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: support dynamic protected memory lending
With CFG_CORE_DYN_PROTMEM=y support dynamic protected memory lending.
A new internal struct mobj_ffa_rsm is added to handle dynamic protected memory f
core: support dynamic protected memory lending
With CFG_CORE_DYN_PROTMEM=y support dynamic protected memory lending.
A new internal struct mobj_ffa_rsm is added to handle dynamic protected memory for FF-A.
A new internal struct mobj_protmem is add to handle dynamic protected memory without FF-A.
Lending non-secure memory to OP-TEE to use it as protected memory means that it should to become inaccessible by the normal world as part of the process. This part is currently not supported, since it must be done in a platform specific way for platforms that support that. QEMU don't support that.
Adding two platform specific functions, plat_get_protmem_config() and plat_set_protmem_range() for dynamic protected memory. The functions has __weak implementation to allow easier testing. However, plat_set_protmem_range() requires CFG_INSECURE=y since it doesn't change memory protection.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| ed89aa36 | 19-Aug-2025 |
Yeoreum Yun <yeoreum.yun@arm.com> |
core: arm: stmm_sp: return FFA_NOT_SUPPORTED for undefined FFA functions
edk2's patch ("ArmFfaLib: Add Rx/Tx support for Stmm secure partition") [0] added Rx/Tx buffer mapping support to ArmFfaStand
core: arm: stmm_sp: return FFA_NOT_SUPPORTED for undefined FFA functions
edk2's patch ("ArmFfaLib: Add Rx/Tx support for Stmm secure partition") [0] added Rx/Tx buffer mapping support to ArmFfaStandaloneMm(Core)Lib.
However, stmm_sp does not require Rx/Tx buffer mapping and its SVC handler is lightweight. Therefore, when it receives an undefined FFA function, it is sufficient to return FFA_NOT_SUPPORTED to StandaloneMm instead of panicking.
This also aligns with the FF-A specification, which requires returning FFA_NOT_SUPPORTED when an unimplemented function ID is received.
If StandaloneMm fails to initialize, it will return FFA_ERROR. In this case, there is no way to keep the stmm_sp TA alive, so panic is called. Otherwise, StandaloneMm will return with DIRECT_MSG_RESP.
Link: https://github.com/tianocore/edk2/pull/11080/commits/75ca159e57dbe081b89373046280f34d67571852 [0] Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Tested-by: Mikko Rapeli <mikko.rapeli@linaro.org>
show more ...
|
| 62caa4d4 | 12-Aug-2025 |
Joseph Lo <josephl@nvidia.com> |
core: boot: fix TPM log area mapping to use correct device tree source
Change the conditional compilation for TPM log area mapping from CFG_CORE_SEL1_SPMC to CFG_CORE_FFA. This ensures the correct d
core: boot: fix TPM log area mapping to use correct device tree source
Change the conditional compilation for TPM log area mapping from CFG_CORE_SEL1_SPMC to CFG_CORE_FFA. This ensures the correct device tree source is used:
- When CFG_CORE_FFA is enabled: use manifest DT (get_manifest_dt()) - When CFG_CORE_FFA is disabled: use external DT (get_external_dt())
The fix aligns the device tree source selection with the broader FFA configuration, ensuring TPM log area mapping works correctly across all FFA-enabled platforms regardless of the specific SPMC variant (S-EL1, S-EL2, or EL3).
Signed-off-by: Joseph Lo <josephl@nvidia.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| cdffc82e | 25-Jun-2025 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: arm: support EL1 physical timer
When configured with an SPMC at S-EL2 (CFG_CORE_SEL2_SPMC=y) use the (emulated) EL1 physical timer instead of the EL3 physical timer since the latter then is us
core: arm: support EL1 physical timer
When configured with an SPMC at S-EL2 (CFG_CORE_SEL2_SPMC=y) use the (emulated) EL1 physical timer instead of the EL3 physical timer since the latter then is used by S-EL2.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
show more ...
|
| 2cd578ba | 23-May-2025 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: fix asan for CFG_WITH_PAGER=n
Some fixes are needed to make CFG_CORE_SANITIZE_KADDRESS=y work both with and without CFG_DYN_CONFIG=y.
Sanitizing stack addresses aren't supported with CFG_DYN_
core: fix asan for CFG_WITH_PAGER=n
Some fixes are needed to make CFG_CORE_SANITIZE_KADDRESS=y work both with and without CFG_DYN_CONFIG=y.
Sanitizing stack addresses aren't supported with CFG_DYN_CONFIG=y since it requires extensive changes in the ASAN framework.
The VCORE_FREE area is moved right before the .asan_shadow area.
init_asan() calls boot_mem_init_asan() to tag access to already allocated boot memory.
entry_a32.S is updated to skip allowing access to stacks in the .asan_shadow area for CFG_DYN_CONFIG=y since stacks are stored elsewhere in that configuration.
entry_a64.S is updated to initialize the .asan_shadow area in the same way as in entry_a32.S.
The .asan_shadow area is mapped explicitly in collect_mem_ranges() instead of relying on the now non-existent coverage of MEM_AREA_TEE_RAM_RW.
CFG_DYN_CONFIG=y and CFG_WITH_PAGER=y is not yet known to work.
Fixes: 1c1f8b65b5c6 ("core: mm: unify secure core and TA memory") Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| bb538722 | 02-Jun-2025 |
Alvin Chang <alvinga@andestech.com> |
core: replace CFG_DYN_STACK_CONFIG with CFG_DYN_CONFIG
This commit replaces CFG_DYN_STACK_CONFIG with CFG_DYN_CONFIG since now RISC-V also supports CFG_DYN_STACK_CONFIG.
Signed-off-by: Alvin Chang
core: replace CFG_DYN_STACK_CONFIG with CFG_DYN_CONFIG
This commit replaces CFG_DYN_STACK_CONFIG with CFG_DYN_CONFIG since now RISC-V also supports CFG_DYN_STACK_CONFIG.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 9d58f55e | 19-May-2025 |
Gyorgy Szing <gyorgy.szing@arm.com> |
spmc: fix FF-A manifest boot-order handling
According to the official manifest binding documentation [1], all integer properties must be defined as 32-bit wide DTB properties. However, the OP-TEE SP
spmc: fix FF-A manifest boot-order handling
According to the official manifest binding documentation [1], all integer properties must be defined as 32-bit wide DTB properties. However, the OP-TEE SPMC previously implemented the boot-order property as a 16-bit value. This patch corrects that inconsistency by adding support for the correct 32 bit representation while keeping backwards compatibility.
Recent changes in TF-A’s build tooling have broken support for manifest files using the "/bits/" width specifier. This update restores compatibility by eliminating the need to use them.
[1] FF-A Manifest Binding Link: https://trustedfirmware-a.readthedocs.io/en/v2.12.0/components/ffa-manifest-binding.html
Signed-off-by: Gyorgy Szing <gyorgy.szing@arm.com> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 91d4649d | 20-Mar-2025 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: add thread_count to thread_init_threads()
Add a thread_count parameter to thread_init_threads(). This must currently always be equal to CFG_NUM_THREADS, but may become a dynamic configuration
core: add thread_count to thread_init_threads()
Add a thread_count parameter to thread_init_threads(). This must currently always be equal to CFG_NUM_THREADS, but may become a dynamic configuration parameter with CFG_DYN_CONFIG=y in later patches.
The array threads[] is changed into a pointer to allow dynamic allocation in later patches. The assembly code is updated accordingly to handle a pointer instead of an array.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Alvin Chang <alvinga@andestech.com> Tested-by: Alvin Chang <alvinga@andestech.com> Reviewed-by: Yu-Chien Peter Lin <peter.lin@sifive.com> Tested-by: Yu-Chien Peter Lin <peter.lin@sifive.com> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 59724f22 | 20-Mar-2025 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: dynamic allocation of thread_core_local and its stacks
With CFG_DYN_CONFIG enabled, use dynamic allocation of thread_core_local and the two stacks, tmp_stack and abt_stack, recorded in it.
Si
core: dynamic allocation of thread_core_local and its stacks
With CFG_DYN_CONFIG enabled, use dynamic allocation of thread_core_local and the two stacks, tmp_stack and abt_stack, recorded in it.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| a4c2e0cb | 20-Mar-2025 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: add core_count to thread_init_thread_core_local()
Add a core_count parameter to thread_init_thread_core_local() to enable dynamic configuration of the number of supported cores when configured
core: add core_count to thread_init_thread_core_local()
Add a core_count parameter to thread_init_thread_core_local() to enable dynamic configuration of the number of supported cores when configured with CFG_DYN_STACK_CONFIG=y, or it must be equal to CFG_TEE_CORE_NB_CORE. This is needed in later patches where the number of cores is configured dynamically.
The array thread_core_local[] is changed into a pointer to allow dynamic allocation in later patches. The assembly code is updated accordingly to handle a pointer instead of an array.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Alvin Chang <alvinga@andestech.com> Tested-by: Alvin Chang <alvinga@andestech.com> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| a6d75fa2 | 20-Mar-2025 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: arm: virt: share TA memory with core
With CFG_NS_VIRTUALIZATION=y it is assumed that all physical OP-TEE memory, core and TA, is equally secure. When a guest is created, register the allocated
core: arm: virt: share TA memory with core
With CFG_NS_VIRTUALIZATION=y it is assumed that all physical OP-TEE memory, core and TA, is equally secure. When a guest is created, register the allocated physical TA memory in the physical core memory pool instead of physical TA memory pool. This lets the partition to allocate from a single pool reserved for the partition instead of trying to guess how much core memory it might need.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| ecf08061 | 22-Apr-2025 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: arm: ffa: add framework for Logical SPs
Add a framework to register Logical Secure Partitions in parallel with OP-TEE at S-EL1. This is akin to Pseudo TAs, it provides an ABI but it's part of
core: arm: ffa: add framework for Logical SPs
Add a framework to register Logical Secure Partitions in parallel with OP-TEE at S-EL1. This is akin to Pseudo TAs, it provides an ABI but it's part of the OP-TEE binary. A critical difference is that it's only available for FF-A and can only use the non-threaded environment, that is, no mutexes or RPC.
The logical OP-TEE core partition is registered in the framework. The SPMC is also registered in the framework, but with a nil UUID so it's not returned by FFA_PARTITION_INFO_GET.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com> Reviewed-by: Akshay Belsare <akshay.belsare@amd.com>
show more ...
|
| 40f03182 | 22-Apr-2025 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: ffa: only accept FFA_RUN for S-EL0 SPs
OP-TEE core is never preemted with FFA_INTERRUPT so it must never be resumed with FFA_RUN. However, S-EL0 SPs are preempted with FFA_INTERRUPT so those a
core: ffa: only accept FFA_RUN for S-EL0 SPs
OP-TEE core is never preemted with FFA_INTERRUPT so it must never be resumed with FFA_RUN. However, S-EL0 SPs are preempted with FFA_INTERRUPT so those are still resumed using FFA_RUN.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com> Reviewed-by: Akshay Belsare <akshay.belsare@amd.com>
show more ...
|
| 5c85c87e | 22-Apr-2025 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: ffa: sp_partition_info_get() takes uuid_words[]
Replace the TEE_UUID *ffa_uuid parameter with uint32_t ffa_uuid_words[4] to simplify how sp_partition_info_get() is called.
Signed-off-by: Jens
core: ffa: sp_partition_info_get() takes uuid_words[]
Replace the TEE_UUID *ffa_uuid parameter with uint32_t ffa_uuid_words[4] to simplify how sp_partition_info_get() is called.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com> Reviewed-by: Akshay Belsare <akshay.belsare@amd.com>
show more ...
|
| fc6415c4 | 22-Apr-2025 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: ffa: add spmc_is_reserved_id()
Add spmc_is_reserved_id() and replace direct checks against spmd_id and spmc_id. spmd_id and spmc_id are changed to static variables since they don't need to be
core: ffa: add spmc_is_reserved_id()
Add spmc_is_reserved_id() and replace direct checks against spmd_id and spmc_id. spmd_id and spmc_id are changed to static variables since they don't need to be exported any longer.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com> Reviewed-by: Akshay Belsare <akshay.belsare@amd.com>
show more ...
|
| aa6d7fc3 | 11-Sep-2024 |
Levi Yun <yeoreum.yun@arm.com> |
core: applies FF-A v1.2 features on StandaloneMm
edk2's StandaloneMm will be applied with FF-A v1.2. while applying, StandaloneMm doesn't create anymore PHIT hob by itself but it should be passed fr
core: applies FF-A v1.2 features on StandaloneMm
edk2's StandaloneMm will be applied with FF-A v1.2. while applying, StandaloneMm doesn't create anymore PHIT hob by itself but it should be passed from other software stack.
To make StandaloneMm runs properly, create Hob information and deliver it using FF-A Boot protocol according to FF-A specification [1].
Also, apply FF-A management protocol to change it [2] to get/set memory permission instead of using DIRECT_REQ_MSG.
Also, implements some FF-A ABIs to communication StandaloneMm properly.
Link: https://developer.arm.com/documentation/den0077/latest [1] Link: https://developer.arm.com/documentation/den0140/latest [2]
Tested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Signed-off-by: Levi Yun <yeoreum.yun@arm.com>
show more ...
|
| f3434bd3 | 28-Apr-2025 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: arm: remove $(libgcccore) usage
Remove all remaining $(libgcccore) usage now that lib/libutils/compiler-rt provides the needed bits.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
core: arm: remove $(libgcccore) usage
Remove all remaining $(libgcccore) usage now that lib/libutils/compiler-rt provides the needed bits.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| 414123ae | 03-Apr-2025 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: ffa: reserve physical memory for manifest
With CFG_CORE_SEL2_SPMC=y (Hafnium as SPMC at S-EL2), the FF-A manifest passed to OP-TEE resides in the memory reserved for OP-TEE just before the loa
core: ffa: reserve physical memory for manifest
With CFG_CORE_SEL2_SPMC=y (Hafnium as SPMC at S-EL2), the FF-A manifest passed to OP-TEE resides in the memory reserved for OP-TEE just before the load address. The physical memory pool is initialized with the entire range of secure memory, with holes carved out for already used memory.
Temporarily allocate the physical memory used by the manifest until it's not needed any longer and released by release_manifest_dt().
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| 45c754ce | 16-Apr-2025 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: fix crash during syscall ftrace
Syscall ftrace collects data during a syscall. get_fbuf() checks if thread_get_id_may_fail() != -1 to see if a function is called under normal thread execution.
core: fix crash during syscall ftrace
Syscall ftrace collects data during a syscall. get_fbuf() checks if thread_get_id_may_fail() != -1 to see if a function is called under normal thread execution. This can lead to an inconsistent state if a native interrupt occur while ftrace_enter() or ftrace_return() is recording data in the ftrace buffer. So fix this by using thread_is_in_normal_mode() to exclude ftrace during interrupt processing.
Reported-by: Jerome Forissier <jerome.forissier@linaro.org> Closes: https://github.com/OP-TEE/optee_os/issues/7216 Fixes: 099918f6744c ("ftrace: Add support for syscall function tracer") Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (vexpress-qemu_armv8a)
show more ...
|
| abb35419 | 14-Apr-2025 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: arm: update recorded SP first after MMU is enabled
With CFG_CORE_ASLR=y, stored addresses must be updated after MMU has been enabled to match the map offset. In particular the recorded stack p
core: arm: update recorded SP first after MMU is enabled
With CFG_CORE_ASLR=y, stored addresses must be updated after MMU has been enabled to match the map offset. In particular the recorded stack pointers in thread_core_local[] must be updated to match the new offset before any calls can be done into C code or check_stack_limits() with CFG_CORE_DEBUG_CHECK_STACKS=y might catch an inconsistent stack pointer.
Currently, boot_mem_relocate() is called before the recorded stack pointers have been updated and causes a crash with CFG_CORE_ASLR=y and CFG_CORE_DEBUG_CHECK_STACKS=y. So fix this by calling delaying the call to boot_mem_relocate() to after the stack pointers in thread_core_local[] has been updated.
Reported-by: Jerome Forissier <jerome.forissier@linaro.org> Closes: https://github.com/OP-TEE/optee_os/issues/7363 Fixes: ea991d7459f6 ("core: arm: remove THREAD_CORE_LOCAL_STACKCHECK_RECURSION") Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (vexpress-qemu_armv8a)
show more ...
|
| c60785c4 | 28-Mar-2025 |
Yu-Chien Peter Lin <peter.lin@sifive.com> |
core: move plat_get_random_stack_canaries() to common part
Other architectures (e.g. RISC-V) may want to call plat_get_random_stack_canaries() for random stack canaries. Move it from ARM architectur
core: move plat_get_random_stack_canaries() to common part
Other architectures (e.g. RISC-V) may want to call plat_get_random_stack_canaries() for random stack canaries. Move it from ARM architecture directory to common part.
Signed-off-by: Yu-Chien Peter Lin <peter.lin@sifive.com> Co-developed-by: Alvin Chang <alvinga@andestech.com> Signed-off-by: Alvin Chang <alvinga@andestech.com> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|