| 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 ...
|
| e1482ae7 | 15-Mar-2025 |
Yu-Chien Peter Lin <peter.lin@sifive.com> |
core: mm: fix va to index calculation for RV64
On RV64, shifting va is not enough when top bits are present in the virtual address, e.g. for Sv48, bits 63-48 must be set when bit 47 is set to form a
core: mm: fix va to index calculation for RV64
On RV64, shifting va is not enough when top bits are present in the virtual address, e.g. for Sv48, bits 63-48 must be set when bit 47 is set to form a valid virtual address.
In this case, we need to mask the base-level virtual addresses to clear any extended bits before calculating the index.
Signed-off-by: Yu-Chien Peter Lin <peter.lin@sifive.com> Suggested-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Alvin Chang <alvinga@andestech.com>
show more ...
|
| 232f1cde | 08-Mar-2025 |
Yu-Chien Peter Lin <peter.lin@sifive.com> |
core: mm: refactor ASLR mapping for architecture support
To allow adding RISC-V ASLR support, add arch_aslr_base_addr() which will be used to apply architecture specific ASLR base calculation.
Sign
core: mm: refactor ASLR mapping for architecture support
To allow adding RISC-V ASLR support, add arch_aslr_base_addr() which will be used to apply architecture specific ASLR base calculation.
Signed-off-by: Yu-Chien Peter Lin <peter.lin@sifive.com> Suggested-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Alvin Chang <alvinga@andestech.com>
show more ...
|
| 6a2e17e9 | 20-Mar-2025 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: mm: shared xlat tables for NEX_DYN_VASPACE
Mappings in MEM_AREA_NEX_DYN_VASPACE belong to the nexus and are must to be the same for all partitions. Since these mappings must be updated in the
core: mm: shared xlat tables for NEX_DYN_VASPACE
Mappings in MEM_AREA_NEX_DYN_VASPACE belong to the nexus and are must to be the same for all partitions. Since these mappings must be updated in the partitions after the MMU has been enabled. Partitions share translation tables for this mappings, so we only need to update in one translation table when adding or removing mappings.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 809e0744 | 26-Feb-2025 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: mm: add virt_page_alloc()
Add virt_page_alloc() to allocate memory from physical pool and map it in a virtual address pool.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-
core: mm: add virt_page_alloc()
Add virt_page_alloc() to allocate memory from physical pool and map it in a virtual address pool.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 1baf19de | 26-Feb-2025 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: mm: add phys_mem_alloc_flags()
Add phys_mem_alloc_flags() taking MAF_* flags to control memory allocation. The new flag MAF_CORE_MEM behaves like {nex_,}phys_mem_core_alloc(), if the flag is
core: mm: add phys_mem_alloc_flags()
Add phys_mem_alloc_flags() taking MAF_* flags to control memory allocation. The new flag MAF_CORE_MEM behaves like {nex_,}phys_mem_core_alloc(), if the flag is absent it becomes {nex_,}phys_mem_ta_alloc().
The MAF_NEX flag selects Nexus memory.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 5f76bc75 | 26-Feb-2025 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: add tee_mm_alloc_flags()
Add tee_mm_alloc_flags() taking a flags field to passed to malloc_flags() when allocating the tee_mm_entry_t.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org
core: add tee_mm_alloc_flags()
Add tee_mm_alloc_flags() taking a flags field to passed to malloc_flags() when allocating the tee_mm_entry_t.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| b462b681 | 26-Feb-2025 |
Jens Wiklander <jens.wiklander@linaro.org> |
Use malloc flags MAF_* in tee_mm.h
Switch to use the malloc flags MAF_* in tee_mm.h replacing the previous TEE_MM_POOL_* flags. TEE_MM_POOL_* flags are kept defined using MAF_* flags to for easier t
Use malloc flags MAF_* in tee_mm.h
Switch to use the malloc flags MAF_* in tee_mm.h replacing the previous TEE_MM_POOL_* flags. TEE_MM_POOL_* flags are kept defined using MAF_* flags to for easier transition. The TEE_MM_POOL_* flags can be moved gradually after this commit.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 96f43358 | 26-Feb-2025 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: add nex_dyn_vaspace and tee_dyn_vaspace areas
Add MEM_AREA_NEX_DYN_VASPACE and MEM_AREA_TEE_DYN_VASPACE areas for dynamic Nexus and TEE memory mapping. This will be used to map additional heap
core: add nex_dyn_vaspace and tee_dyn_vaspace areas
Add MEM_AREA_NEX_DYN_VASPACE and MEM_AREA_TEE_DYN_VASPACE areas for dynamic Nexus and TEE memory mapping. This will be used to map additional heap and the stacks in later patches.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| bea90f04 | 03-Mar-2025 |
Alvin Chang <alvinga@andestech.com> |
core: Implicitly enable CFG_BOOT_MEM
Now both ARM and RISC-V architectures support and enable CFG_BOOT_MEM by default. It's unnecessary to define CFG_BOOT_MEM. This commit removes CFG_BOOT_MEM and r
core: Implicitly enable CFG_BOOT_MEM
Now both ARM and RISC-V architectures support and enable CFG_BOOT_MEM by default. It's unnecessary to define CFG_BOOT_MEM. This commit removes CFG_BOOT_MEM and relevant dead code.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Yu-Chien Peter Lin <peter.lin@sifive.com>
show more ...
|
| 325d4963 | 11-Oct-2023 |
Gatien Chevallier <gatien.chevallier@foss.st.com> |
core: add platform-specific abort handler
Platforms may have specific code to handle an abort when fault type is FAULT_TYPE_IGNORE. Add plat_abort_handler() that can be overridden at platform level
core: add platform-specific abort handler
Platforms may have specific code to handle an abort when fault type is FAULT_TYPE_IGNORE. Add plat_abort_handler() that can be overridden at platform level.
Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 8fda89c7 | 13-Sep-2024 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: merge core_mmu_init_phys_mem() and core_mmu_init_virtualization()
Moves the implementation of core_mmu_init_virtualization() into core_mmu_init_phys_mem().
This simplifies init_primary() in c
core: merge core_mmu_init_phys_mem() and core_mmu_init_virtualization()
Moves the implementation of core_mmu_init_virtualization() into core_mmu_init_phys_mem().
This simplifies init_primary() in core/arch/arm/kernel/boot.c.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| e712be7a | 13-Sep-2024 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: initialize guest physical memory early
Initialize guest physical memory in virt_guest_created() before the first entry into the guest from normal world. This replaces the call to core_mmu_init
core: initialize guest physical memory early
Initialize guest physical memory in virt_guest_created() before the first entry into the guest from normal world. This replaces the call to core_mmu_init_phys_mem() in init_tee_runtime().
Remove unused code in core_mmu_init_phys_mem() and the now unused functions core_mmu_get_ta_range() and virt_get_ta_ram().
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| f1284346 | 13-Sep-2024 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: mm: allocate temporary memory map array
With CFG_BOOT_MEM enabled, allocate a temporary memory map array using boot_mem_alloc_tmp() instead of using the global static_mmap_regions[]. core_mmu_
core: mm: allocate temporary memory map array
With CFG_BOOT_MEM enabled, allocate a temporary memory map array using boot_mem_alloc_tmp() instead of using the global static_mmap_regions[]. core_mmu_save_mem_map() is added and called from boot_init_primary_late() before the temporary memory is reused.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
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 ...
|
| 1fbe848c | 13-Sep-2024 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: remove CORE_MEM_TA_RAM
The buffer attribute CORE_MEM_TA_RAM isn't used to query the status of a buffer anywhere. So remove the attribute to allow future simplifications.
Signed-off-by: Jens W
core: remove CORE_MEM_TA_RAM
The buffer attribute CORE_MEM_TA_RAM isn't used to query the status of a buffer anywhere. So remove the attribute to allow future simplifications.
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 ...
|
| 041b1fa2 | 13-Sep-2024 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: mm: add vaddr_to_phys()
Add a wrapper function for virt_to_phys() using vaddr_t instead of a void pointer.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Jerome Foriss
core: mm: add vaddr_to_phys()
Add a wrapper function for virt_to_phys() using vaddr_t instead of a void pointer.
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 ...
|
| b1e25277 | 14-Aug-2024 |
Yu Chien Peter Lin <peterlin@andestech.com> |
core: mm: core_mmu: add core_mmu_user_va_range_is_defined() for RISC-V
The function hasn't been implemented for RISC-V, so move the core_mmu_user_va_range_is_defined() definition to generic core_mmu
core: mm: core_mmu: add core_mmu_user_va_range_is_defined() for RISC-V
The function hasn't been implemented for RISC-V, so move the core_mmu_user_va_range_is_defined() definition to generic core_mmu.h and function implementations to arch-specific files.
Also, update the assertions where checks if user va range is defined.
Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by: Alvin Chang <alvinga@andestech.com> Tested-by: Alvin Chang <alvinga@andestech.com> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 90c16066 | 15-Aug-2024 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: rename to core_mmu_init_phys_mem()
Rename core_mmu_init_ta_ram() to core_mmu_init_phys_mem() for a more accurate name of the function.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org
core: rename to core_mmu_init_phys_mem()
Rename core_mmu_init_ta_ram() to core_mmu_init_phys_mem() for a more accurate name of the function.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
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 ...
|
| c596d835 | 26-Jul-2024 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: add phys_mem allocation functions
Add nex_phys_mem and phys_mem allocation functions. These functions are intended to replace the previous calls to tee_mm functions on with the virt_mapper_poo
core: add phys_mem allocation functions
Add nex_phys_mem and phys_mem allocation functions. These functions are intended to replace the previous calls to tee_mm functions on with the virt_mapper_pool or tee_mm_sec_ddr as arguments.
The pool of physical memory is divided into two parts, core and ta. All physical TA memory allocations are done from the core pool if a ta pool isn't added. This might be the case if core and ta physical memory resides in the same physical memory range.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 10b19e73 | 09-Jul-2024 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: mm: add core_mmu_for_each_map()
Add core_mmu_for_each_map() to iterate over all memory regions, struct tee_mmap_region.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by:
core: mm: add core_mmu_for_each_map()
Add core_mmu_for_each_map() to iterate over all memory regions, struct tee_mmap_region.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
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 ...
|
| 8c95493b | 08-Jul-2024 |
Jens Wiklander <jens.wiklander@linaro.org> |
core: remove unused mobj_sec_ddr
Remove the unused global variable mobj_sec_ddr.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.co
core: remove unused mobj_sec_ddr
Remove the unused global variable mobj_sec_ddr.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| f15052a2 | 21-Jun-2024 |
Etienne Carriere <etienne.carriere@foss.st.com> |
core: mm: add CFG_PGT_CACHE_ENTRIES
Add CFG_PGT_CACHE_ENTRIES to allow platforms to customize the page table cache size. This is needed for example when a platform is to support very large TAs of se
core: mm: add CFG_PGT_CACHE_ENTRIES
Add CFG_PGT_CACHE_ENTRIES to allow platforms to customize the page table cache size. This is needed for example when a platform is to support very large TAs of several dozen of Mbytes of private memory (code/data).
Move PGT_CACHE_SIZE macro definition from pgt_cache.h to pgt_cache.c since it is used only in that source file.
By the way, fix pgt_cache.h layout to have header files includes first followed by macro definitions.
Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|