| 9d1a0f06 | 20-Jul-2023 |
Marouene Boubakri <marouene.boubakri@nxp.com> |
core: riscv: riscv.mk: define CFG_WITH_LPAE
Set CFG_WITH_LPAE according to CFG_CORE_LARGE_PHYS_ADDR. Memory manager makes use of CFG_WITH_LPAE, therefore, we set it according to the platform specifi
core: riscv: riscv.mk: define CFG_WITH_LPAE
Set CFG_WITH_LPAE according to CFG_CORE_LARGE_PHYS_ADDR. Memory manager makes use of CFG_WITH_LPAE, therefore, we set it according to the platform specifications.
Signed-off-by: Marouene Boubakri <marouene.boubakri@nxp.com> Reviewed-by: Alvin Chang <alvinga@andestech.com>
show more ...
|
| df913c6d | 02-Aug-2023 |
Alvin Chang <alvinga@andestech.com> |
core: arm: Rename primary_init_intc() to boot_primary_init_intc()
Since interrupt controllers are usually initialized in boot stage, rename primary_init_intc() to boot_primary_init_intc().
Signed-o
core: arm: Rename primary_init_intc() to boot_primary_init_intc()
Since interrupt controllers are usually initialized in boot stage, rename primary_init_intc() to boot_primary_init_intc().
Signed-off-by: Alvin Chang <alvinga@andestech.com> Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| 8aae4669 | 31-Jul-2023 |
Alvin Chang <alvinga@andestech.com> |
core: arm: Rename main_secondary_init_intc() to boot_secondary_init_intc()
main_secondary_*() is an ambiguous name since it conveys no meaning relative to the purpose of the function. Fix it by rena
core: arm: Rename main_secondary_init_intc() to boot_secondary_init_intc()
main_secondary_*() is an ambiguous name since it conveys no meaning relative to the purpose of the function. Fix it by renameing to boot_secondary_init_intc(), since interrupt controllers are always initialized in boot stage.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| a61bc392 | 12-Nov-2022 |
Marouene Boubakri <marouene.boubakri@nxp.com> |
core: riscv: introduce primary_init_intc() and secondary_init_intc()
Rename interrupt controller initialization functions to primary_init_intc() and secondary_init_intc(). To be called by platform b
core: riscv: introduce primary_init_intc() and secondary_init_intc()
Rename interrupt controller initialization functions to primary_init_intc() and secondary_init_intc(). To be called by platform boot code to initialize interrupt controller on boot hart and secondary harts, respectively.
Signed-off-by: Marouene Boubakri <marouene.boubakri@nxp.com> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| f7e4fc1e | 12-Jun-2023 |
Marouene Boubakri <marouene.boubakri@nxp.com> |
riscv: mm: initial implementation of memory management routines
An initial working implementation of mm for RISC-V MMU-enabled harts. The default MMU mode is set to Sv39 for RV64 with 3 page table l
riscv: mm: initial implementation of memory management routines
An initial working implementation of mm for RISC-V MMU-enabled harts. The default MMU mode is set to Sv39 for RV64 with 3 page table levels.
Signed-off-by: Marouene Boubakri <marouene.boubakri@nxp.com> Reviewed-by: Alvin Chang <alvinga@andestech.com> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| d843ed62 | 12-Jun-2023 |
Marouene Boubakri <marouene.boubakri@nxp.com> |
riscv: kernel: asm-defines.c: add defines for struct core_mmu_config
Add CORE_MMU_CONFIG_SIZE and CORE_MMU_CONFIG_SATP defines to asm-defines.c
Signed-off-by: Marouene Boubakri <marouene.boubakri@n
riscv: kernel: asm-defines.c: add defines for struct core_mmu_config
Add CORE_MMU_CONFIG_SIZE and CORE_MMU_CONFIG_SATP defines to asm-defines.c
Signed-off-by: Marouene Boubakri <marouene.boubakri@nxp.com> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Alvin Chang <alvinga@andestech.com> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 9af8810c | 12-Jun-2023 |
Marouene Boubakri <marouene.boubakri@nxp.com> |
riscv: mm: core_mmu_arch.h: define translation levels parameters
This commits modify core_mmu_arch.h to: - Set CORE_MMU_PGDIR_LEVEL to zero, since the deepest translation level is always zero. - Set
riscv: mm: core_mmu_arch.h: define translation levels parameters
This commits modify core_mmu_arch.h to: - Set CORE_MMU_PGDIR_LEVEL to zero, since the deepest translation level is always zero. - Set CORE_MMU_BASE_TABLE_LEVEL to (RISCV_PGLEVELS - 1) which the first translation level depending on the MMU mode. - Set RISCV_MMU_ASID_WIDTH to number of bits used to represent ASID.
Signed-off-by: Marouene Boubakri <marouene.boubakri@nxp.com> Reviewed-by: Alvin Chang <alvinga@andestech.com> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| c120d282 | 05-Jul-2023 |
Alvin Chang <alvinga@andestech.com> |
core: riscv: Add external DT initialization and updating
Initialize the external DT which is provided by early boot stage. The external DT is updated by adding reserved-memory node for secure RAM.
core: riscv: Add external DT initialization and updating
Initialize the external DT which is provided by early boot stage. The external DT is updated by adding reserved-memory node for secure RAM.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| adb103f3 | 05-Jul-2023 |
Alvin Chang <alvinga@andestech.com> |
core: riscv: Get external device tree provided by early boot stage
Early boot stage (i.e., M-mode firmware) can provide external device tree via register a1. Implement code that OP-TEE gets device t
core: riscv: Get external device tree provided by early boot stage
Early boot stage (i.e., M-mode firmware) can provide external device tree via register a1. Implement code that OP-TEE gets device tree from a1 and saves the value into s1 for future use. Platform can also define CFG_DT_ADDR to forcely set the physical address of the device tree.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 6fa59c9a | 12-May-2023 |
Seonghyun Park <seonghp@amazon.com> |
arm64: Introduce permissive PAN implementation
Privileged Access Never (PAN) is a part of ARMv8.1 extension that restricts accesses to unprivileged memory from privileged mode in order to prevent un
arm64: Introduce permissive PAN implementation
Privileged Access Never (PAN) is a part of ARMv8.1 extension that restricts accesses to unprivileged memory from privileged mode in order to prevent unintended accesses to potentially malicious memory.
This introduces configuration of PAN and helper functions enter_user_access() and exit_user_access() that toggles PSTATE.PAN that controls the behavior of PAN.
Current OP-TEE impelmentation is not ready to apply strict PAN policy due to missing user-access function uses, etc.
Hence, this patch takes a very permissive approach (yet better than nothing), where PAN is deactivated in the entire lifetime of thread_svc_handler (i.e., system call).
Signed-off-by: Seonghyun Park <seonghp@amazon.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| e4992be7 | 16-Jun-2023 |
Alvin Chang <alvinga@andestech.com> |
core: riscv: Add TLB operation related to virtual address and ASID
Add TLB invalidate function which is corresponding to virtual address and ASID. The commit also adds missing declaration of tlbi_va
core: riscv: Add TLB operation related to virtual address and ASID
Add TLB invalidate function which is corresponding to virtual address and ASID. The commit also adds missing declaration of tlbi_va_allasid().
Signed-off-by: Alvin Chang <alvinga@andestech.com> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| cabb8df3 | 20-Jun-2023 |
Alvin Chang <alvinga@andestech.com> |
core: riscv: Add cflags for excluding source files from ftrace
Some C source files may lead to incorrect behaviors in ftrace. Exclude them when the system is compiled with ftrace support.
Signed-of
core: riscv: Add cflags for excluding source files from ftrace
Some C source files may lead to incorrect behaviors in ftrace. Exclude them when the system is compiled with ftrace support.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Marouene Boubakri <marouene.boubakri@nxp.com>
show more ...
|
| 994c8602 | 20-Jun-2023 |
Alvin Chang <alvinga@andestech.com> |
core: riscv: Implement timer related functions for ftrace support
Implement barrier_read_counter_timer() to read the timer value after a barrier. Implement read_cntfrq() to get the frequency of mach
core: riscv: Implement timer related functions for ftrace support
Implement barrier_read_counter_timer() to read the timer value after a barrier. Implement read_cntfrq() to get the frequency of machine timer counter. The read_time() is moved from header to C source file to reduce the code size.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Marouene Boubakri <marouene.boubakri@nxp.com>
show more ...
|
| 97a70d28 | 20-Jun-2023 |
Alvin Chang <alvinga@andestech.com> |
libutils: Add riscv.S to make it available for core and TA libs
Some assembly macros are necessary for both OP-TEE core and TA libraries. Therefore, we add riscv specific assembly file into libutils
libutils: Add riscv.S to make it available for core and TA libs
Some assembly macros are necessary for both OP-TEE core and TA libraries. Therefore, we add riscv specific assembly file into libutils and move some assembly related macros from riscv.h to riscv.S.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Marouene Boubakri <marouene.boubakri@nxp.com>
show more ...
|
| 660463d3 | 16-Jun-2023 |
Alvin Chang <alvinga@andestech.com> |
core: riscv: Use standard ABI Mnemonic for frame pointer
Some older toolchain might not recognize "fp". To fix it, we use standard ABI Mnemonic "s0" instead of "fp".
Signed-off-by: Alvin Chang <alv
core: riscv: Use standard ABI Mnemonic for frame pointer
Some older toolchain might not recognize "fp". To fix it, we use standard ABI Mnemonic "s0" instead of "fp".
Signed-off-by: Alvin Chang <alvinga@andestech.com> Tested-by: Marouene Boubakri <marouene.boubakri@nxp.com> Reviewed-by: Marouene Boubakri <marouene.boubakri@nxp.com>
show more ...
|
| efc69401 | 02-Jun-2023 |
Alvin Chang <alvinga@andestech.com> |
core: riscv: Update saving panic registers from _utee_panic()
The _utee_panic() function only saves ra and s0(fp) onto stack. So we only get them from the stack and save them as epc and s0 as abort
core: riscv: Update saving panic registers from _utee_panic()
The _utee_panic() function only saves ra and s0(fp) onto stack. So we only get them from the stack and save them as epc and s0 as abort registers.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Tested-by: Marouene Boubakri <marouene.boubakri@nxp.com> Reviewed-by: Marouene Boubakri <marouene.boubakri@nxp.com>
show more ...
|
| 7d6b0a05 | 02-Jun-2023 |
Alvin Chang <alvinga@andestech.com> |
core: riscv: Add TA compiler flags for stack unwinding
When the CFG_UNWIND is enabled, the frame pointer should not be omitted by compiler. Add "-fno-omit-frame-pointer" compiler flag when we enable
core: riscv: Add TA compiler flags for stack unwinding
When the CFG_UNWIND is enabled, the frame pointer should not be omitted by compiler. Add "-fno-omit-frame-pointer" compiler flag when we enable the CFG_UNWIND to let compiler not to omit the frame pointer when it builds TA.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Tested-by: Marouene Boubakri <marouene.boubakri@nxp.com> Reviewed-by: Marouene Boubakri <marouene.boubakri@nxp.com>
show more ...
|
| fe16b87b | 08-Jun-2023 |
Alvin Chang <alvinga@andestech.com> |
core: mm: Rename "mva" to "va" for TLB operations
The terminology "mva" is specific for older ARM architecture which has FCSE extension. To support multiple architecture, it would be good to rename
core: mm: Rename "mva" to "va" for TLB operations
The terminology "mva" is specific for older ARM architecture which has FCSE extension. To support multiple architecture, it would be good to rename "mva" to common terminology, such as "va". This PR renames "mva" to "va" in TLB operations for ARM64 and RISC-V. For ARM32, "mva" is reserved because it is really defined in ARM32's documentations.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Acked-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 ...
|
| 1e608aa1 | 11-Jun-2023 |
Alvin Chang <alvinga@andestech.com> |
core: mm: Introduce core_mmu_level_in_range()
Since the checking of the valid translation level is architecture specific, the core_mmu_level_in_range() is introduced and every architecture could imp
core: mm: Introduce core_mmu_level_in_range()
Since the checking of the valid translation level is architecture specific, the core_mmu_level_in_range() is introduced and every architecture could implement the function with their own translation rules.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 88dfa327 | 08-Jun-2023 |
Alvin Chang <alvinga@andestech.com> |
core: riscv: Fix misuse of cppflags
The -mxxx and -Wxxx are not preprocessor flags. Fix it by defining them as C flags.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Reviewed-by: Jerome Foriss
core: riscv: Fix misuse of cppflags
The -mxxx and -Wxxx are not preprocessor flags. Fix it by defining them as C flags.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| 2e5a3b0d | 26-May-2023 |
Alvin Chang <alvinga@andestech.com> |
core: riscv: Implement function to print kernel stack
Implement the function to print the kernel stack. The code is referenced from ARM architecture.
Signed-off-by: Alvin Chang <alvinga@andestech.c
core: riscv: Implement function to print kernel stack
Implement the function to print the kernel stack. The code is referenced from ARM architecture.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 4450510c | 26-May-2023 |
Alvin Chang <alvinga@andestech.com> |
core: riscv: Add read_fp() and read_pc()
Implement inline functions to read PC and FP. This is required to trace back the kernel stack.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Acked-by:
core: riscv: Add read_fp() and read_pc()
Implement inline functions to read PC and FP. This is required to trace back the kernel stack.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| b498b831 | 26-May-2023 |
Alvin Chang <alvinga@andestech.com> |
core: riscv: Update the kernel mode unwinding
The data structure for RISC-V does not have sp, remove it in the function. Also the function and structure are renamed.
Signed-off-by: Alvin Chang <alv
core: riscv: Update the kernel mode unwinding
The data structure for RISC-V does not have sp, remove it in the function. Also the function and structure are renamed.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 27be144d | 26-May-2023 |
Alvin Chang <alvinga@andestech.com> |
core: riscv: Add core compiler flags for stack unwinding
When the CFG_UNWIND is enabled, the frame pointer should not be omitted by compiler. Add "-fno-omit-frame-pointer" compiler flag when we enab
core: riscv: Add core compiler flags for stack unwinding
When the CFG_UNWIND is enabled, the frame pointer should not be omitted by compiler. Add "-fno-omit-frame-pointer" compiler flag when we enable the CFG_UNWIND to let compiler not to omit the frame pointer.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| 37a778a5 | 26-May-2023 |
Alvin Chang <alvinga@andestech.com> |
core: riscv: Save and restore register s0 when trap occurs
In RISC-V the frame pointer is stored into register s0. It is necessary to save/restore s0 when we enable CFG_UNWIND to process stack unwin
core: riscv: Save and restore register s0 when trap occurs
In RISC-V the frame pointer is stored into register s0. It is necessary to save/restore s0 when we enable CFG_UNWIND to process stack unwinding.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|