| fbe66cf8 | 16-Oct-2023 |
Etienne Carriere <etienne.carriere@foss.st.com> |
core: fix header file guard names
Fixes header file guards macro name prefix (mostly missing occurrences) that should reflect the file base directory sub-path where applicable.
Reviewed-by: Jens Wi
core: fix header file guard names
Fixes header file guards macro name prefix (mostly missing occurrences) that should reflect the file base directory sub-path where applicable.
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| ed89e939 | 11-Oct-2023 |
Alvin Chang <alvinga@andestech.com> |
core: riscv: Fix logic of thread_{get/set}_exceptions()
In ARM, the bits in DAIF register are used to mask the interrupts. While in RISC-V, the bits in CSR XIE are used to enable(unmask) correspondi
core: riscv: Fix logic of thread_{get/set}_exceptions()
In ARM, the bits in DAIF register are used to mask the interrupts. While in RISC-V, the bits in CSR XIE are used to enable(unmask) corresponding interrupt sources.
To not modify the function of thread_get_exceptions(), we invert the bits after reading the value of CSR XIE, as mask.
To not modify the function of thread_set_exceptions(), we invert the bits in given "exceptions" before writing "exceptions" into CSR XIE. Therefore, the intended masked exception bits will be cleared when we write the final value into CSR XIE to mask those interrupts.
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 ...
|
| 470aadc6 | 11-Oct-2023 |
Alvin Chang <alvinga@andestech.com> |
core: riscv: Register thread_vector_table in primary CPU initialization
When primary CPU has initialized everything, it registers the address of thread_vector_table into higher privileged software v
core: riscv: Register thread_vector_table in primary CPU initialization
When primary CPU has initialized everything, it registers the address of thread_vector_table into higher privileged software via a1 register.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 0cbfd093 | 11-Oct-2023 |
Alvin Chang <alvinga@andestech.com> |
core: riscv: Implement thread_vector_table for ABI and FIQ entries
Implement thread_vector_table which only includes entries for standard ABI, fast ABI, and foreign interrupts. Most of code is refer
core: riscv: Implement thread_vector_table for ABI and FIQ entries
Implement thread_vector_table which only includes entries for standard ABI, fast ABI, and foreign interrupts. Most of code is referenced from ARM architecture. The thread_vector_table will be registered into higher privileged software, such as M-mode firmware. The higher privileged software can jump(mret) to OP-TEE based on this vector table.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 0fb22936 | 11-Oct-2023 |
Alvin Chang <alvinga@andestech.com> |
core: riscv: Implement SBI based protocol
Rename thread_return_from_nsec_call() to thread_return_to_ree() for more general behavior, since TEE might not only be called by REE, but also do something
core: riscv: Implement SBI based protocol
Rename thread_return_from_nsec_call() to thread_return_to_ree() for more general behavior, since TEE might not only be called by REE, but also do something on its own initiative (e.g., handle secure interrupts).
This commit also implements SBI based protocol used to return control to REE. The register a7 encodes SBI TEE extension ID, which is temporarily defined here. We may have ratified SBI TEE extension in the future and we can apply ratified ID at that time. The register a6 is unused and encoded as 0. The returned arguments are encoded into registers a0~a5 and should be provided by the caller.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| d7b20c1e | 11-Oct-2023 |
Alvin Chang <alvinga@andestech.com> |
core: riscv: Implement panic_at_abi_return as guard of ABI call
The ABI call to REE domain should not return. We implement panic_at_abi_return macro as guard of ABI call. When the ABI call return il
core: riscv: Implement panic_at_abi_return as guard of ABI call
The ABI call to REE domain should not return. We implement panic_at_abi_return macro as guard of ABI call. When the ABI call return illegally, the system will enter panic or an infinite loop.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| 69a443d0 | 04-Oct-2023 |
Alvin Chang <alvinga@andestech.com> |
core: riscv: Fix condition of is_from_user()
RISC-V defines that xPP(previous privilege mode) field of CSR status indicates the previous privilege level prior to the trap. Since the encoding of user
core: riscv: Fix condition of is_from_user()
RISC-V defines that xPP(previous privilege mode) field of CSR status indicates the previous privilege level prior to the trap. Since the encoding of user mode is 0, we should compare the xPP field with 0 here to know that the trap is from user mode.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Reviewed-by: Marouene Boubakri <marouene.boubakri@nxp.com>
show more ...
|
| 9478318b | 26-Sep-2023 |
Alvin Chang <alvinga@andestech.com> |
riscv: plat-virt: Align PLIC configurations with QEMU v8.1.1
Align the PLIC configurations with RISC-V QEMU virtual platform based on official QEMU v8.1.1 tag. The maximum size of PLIC should be 0x6
riscv: plat-virt: Align PLIC configurations with QEMU v8.1.1
Align the PLIC configurations with RISC-V QEMU virtual platform based on official QEMU v8.1.1 tag. The maximum size of PLIC should be 0x600000, and the number of interrupt sources should be 95.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Reviewed-by: Marouene Boubakri <marouene.boubakri@nxp.com> Acked-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| f33bc3ef | 26-Sep-2023 |
Alvin Chang <alvinga@andestech.com> |
drivers: plic: Maintain controller data in driver source file
To align the design from other architecture, we move the interrupt controller data instance from platform source file to driver source f
drivers: plic: Maintain controller data in driver source file
To align the design from other architecture, we move the interrupt controller data instance from platform source file to driver source file. With this change, the PLIC initialization functions no more get the controller data as input argument. Platforms do not need to care about the interrupt controller data instance.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com> Reviewed-by: Marouene Boubakri <marouene.boubakri@nxp.com>
show more ...
|
| 57b21489 | 30-Aug-2023 |
Marouene Boubakri <marouene.boubakri@nxp.com> |
core: riscv: tee: add entry_fast.c
This commit adds an implementation of fast call handers. It copies the original implementation replacing thread_smc_args structures with thread_abi_args counterpar
core: riscv: tee: add entry_fast.c
This commit adds an implementation of fast call handers. It copies the original implementation replacing thread_smc_args structures with thread_abi_args counterparts. tee_entry_fastcall_l2cc_mutex() has been modified to return OPTEE_ABI_RETURN_UNKNOWN_FUNCTION.
Signed-off-by: Marouene Boubakri <marouene.boubakri@nxp.com> Reviewed-by: Alvin Chang <alvinga@andestech.com> Tested-by: Alvin Chang <alvinga@andestech.com>
show more ...
|
| 5cc48b15 | 29-Aug-2023 |
Marouene Boubakri <marouene.boubakri@nxp.com> |
core: riscv: add thread_optee_abi.c
This commit just copies thread_optee_smc.c from ARM and renames smc/SMC to abi/ABI.
Signed-off-by: Marouene Boubakri <marouene.boubakri@nxp.com> Reviewed-by: Alv
core: riscv: add thread_optee_abi.c
This commit just copies thread_optee_smc.c from ARM and renames smc/SMC to abi/ABI.
Signed-off-by: Marouene Boubakri <marouene.boubakri@nxp.com> Reviewed-by: Alvin Chang <alvinga@andestech.com> Tested-by: Alvin Chang <alvinga@andestech.com>
show more ...
|
| 55dd28e8 | 29-Aug-2023 |
Marouene Boubakri <marouene.boubakri@nxp.com> |
core: riscv: include: add tee/teeabi_opteed_macros.h
This commit just copies teesmc_opteed_macros.h from ARM and renames smc/SMC to abi/ABI. All unused and ARM-related macros are removed.
Signed-of
core: riscv: include: add tee/teeabi_opteed_macros.h
This commit just copies teesmc_opteed_macros.h from ARM and renames smc/SMC to abi/ABI. All unused and ARM-related macros are removed.
Signed-off-by: Marouene Boubakri <marouene.boubakri@nxp.com> Reviewed-by: Alvin Chang <alvinga@andestech.com> Tested-by: Alvin Chang <alvinga@andestech.com>
show more ...
|
| 14812c66 | 29-Aug-2023 |
Marouene Boubakri <marouene.boubakri@nxp.com> |
core: riscv: include: add tee/teeabi_opteed.h
This commit just copies teesmc_opteed.h from ARM and renames smc/SMC to abi/ABI.
Signed-off-by: Marouene Boubakri <marouene.boubakri@nxp.com> Reviewed-
core: riscv: include: add tee/teeabi_opteed.h
This commit just copies teesmc_opteed.h from ARM and renames smc/SMC to abi/ABI.
Signed-off-by: Marouene Boubakri <marouene.boubakri@nxp.com> Reviewed-by: Alvin Chang <alvinga@andestech.com> Tested-by: Alvin Chang <alvinga@andestech.com>
show more ...
|
| 21c10a52 | 29-Aug-2023 |
Marouene Boubakri <marouene.boubakri@nxp.com> |
core: riscv: include: add tee/optee_abi.h
This commit just copies optee_smc.h from ARM and renames smc/SMC to abi/ABI.
Signed-off-by: Marouene Boubakri <marouene.boubakri@nxp.com> Reviewed-by: Alvi
core: riscv: include: add tee/optee_abi.h
This commit just copies optee_smc.h from ARM and renames smc/SMC to abi/ABI.
Signed-off-by: Marouene Boubakri <marouene.boubakri@nxp.com> Reviewed-by: Alvin Chang <alvinga@andestech.com> Tested-by: Alvin Chang <alvinga@andestech.com>
show more ...
|
| a12b98e3 | 29-Aug-2023 |
Marouene Boubakri <marouene.boubakri@nxp.com> |
core: riscv: include: add tee/entry_fast.h
This commit just copies entry_fast.h from ARM and renames thread_smc_args to thread_abi_args.
Signed-off-by: Marouene Boubakri <marouene.boubakri@nxp.com>
core: riscv: include: add tee/entry_fast.h
This commit just copies entry_fast.h from ARM and renames thread_smc_args to thread_abi_args.
Signed-off-by: Marouene Boubakri <marouene.boubakri@nxp.com> Reviewed-by: Alvin Chang <alvinga@andestech.com> Tested-by: Alvin Chang <alvinga@andestech.com>
show more ...
|
| a2efa71b | 29-Aug-2023 |
Marouene Boubakri <marouene.boubakri@nxp.com> |
core: riscv: move TEE ABI handlers from thread_rv.S to thread_optee_abi_rv.S
This commits moves the following functions from thread_rv.S to a separate file thread_optee_abi_rv.S:
- thread_return_fr
core: riscv: move TEE ABI handlers from thread_rv.S to thread_optee_abi_rv.S
This commits moves the following functions from thread_rv.S to a separate file thread_optee_abi_rv.S:
- thread_return_from_nsec_call() - thread_std_smc_entry() -> renamed to thread_std_abi_entry() - thread_rpc()
Signed-off-by: Marouene Boubakri <marouene.boubakri@nxp.com> Reviewed-by: Alvin Chang <alvinga@andestech.com> Tested-by: Alvin Chang <alvinga@andestech.com>
show more ...
|
| 3f1a58ff | 29-Aug-2023 |
Marouene Boubakri <marouene.boubakri@nxp.com> |
core: riscv: thread_arch.c: Use of ABI structure instead of SMC structure
SMC is an ARM-related keyword, make use thread_std_abi_entry instead of thread_std_smc_entry.
Signed-off-by: Marouene Bouba
core: riscv: thread_arch.c: Use of ABI structure instead of SMC structure
SMC is an ARM-related keyword, make use thread_std_abi_entry instead of thread_std_smc_entry.
Signed-off-by: Marouene Boubakri <marouene.boubakri@nxp.com> Reviewed-by: Alvin Chang <alvinga@andestech.com> Tested-by: Alvin Chang <alvinga@andestech.com>
show more ...
|
| b0f61f0c | 29-Aug-2023 |
Marouene Boubakri <marouene.boubakri@nxp.com> |
core: riscv: thread_private_arch.h: add std and fast calls prototypes
This commit adds the following prototypes to thread_private_arch.h: - thread_std_abi_entry() - __thread_std_abi_entry() - thread
core: riscv: thread_private_arch.h: add std and fast calls prototypes
This commit adds the following prototypes to thread_private_arch.h: - thread_std_abi_entry() - __thread_std_abi_entry() - thread_handle_fast_abi() - thread_handle_std_abi()
Signed-off-by: Marouene Boubakri <marouene.boubakri@nxp.com> Reviewed-by: Alvin Chang <alvinga@andestech.com> Tested-by: Alvin Chang <alvinga@andestech.com>
show more ...
|
| 4d941774 | 29-Aug-2023 |
Marouene Boubakri <marouene.boubakri@nxp.com> |
core: riscv: thread_arch.h: rename thread_smc_args to thread_abi_args
SMC is an ARM-related keyword referring to Secure Monitor Call. This commit renames thread_smc_args to thread_abi_args in thread
core: riscv: thread_arch.h: rename thread_smc_args to thread_abi_args
SMC is an ARM-related keyword referring to Secure Monitor Call. This commit renames thread_smc_args to thread_abi_args in thread_arch.h and keeps the same members to guarantee compatibility with the existing secure and non-secure domain communication protocol.
Signed-off-by: Marouene Boubakri <marouene.boubakri@nxp.com> Reviewed-by: Alvin Chang <alvinga@andestech.com> Tested-by: Alvin Chang <alvinga@andestech.com>
show more ...
|
| df0be605 | 01-Sep-2023 |
Alvin Chang <alvinga@andestech.com> |
core: riscv: Add definitions of CLINT for platform spike
Add definitions for base address of CLINT, otherwise build failure occurs for platform spike.
Signed-off-by: Alvin Chang <alvinga@andestech.
core: riscv: Add definitions of CLINT for platform spike
Add definitions for base address of CLINT, otherwise build failure occurs for platform spike.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Reviewed-by: Marouene Boubakri <marouene.boubakri@nxp.com>
show more ...
|
| a7c08b07 | 02-Aug-2023 |
Alvin Chang <alvinga@andestech.com> |
riscv: plat-virt: Rename to latest interrupt controller functions
Rename main_init_plic() to boot_primary_init_intc(). Rename main_secondary_init_plic() to boot_secondary_init_intc(). Also the inclu
riscv: plat-virt: Rename to latest interrupt controller functions
Rename main_init_plic() to boot_primary_init_intc(). Rename main_secondary_init_plic() to boot_secondary_init_intc(). Also the include path of RISC-V PLIC driver header is fixed.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Marouene Boubakri <marouene.boubakri@nxp.com>
show more ...
|
| c9c3eb4b | 04-Aug-2023 |
Alvin Chang <alvinga@andestech.com> |
core: riscv: Load register TP from thread_user_mode_rec in trap handler
RISC-V kernel uses TP register to store thread_core_local structure. When the thread enters user mode, the value of TP is used
core: riscv: Load register TP from thread_user_mode_rec in trap handler
RISC-V kernel uses TP register to store thread_core_local structure. When the thread enters user mode, the value of TP is used by user mode. Therefore, when CPU enters trap handler, it needs to restore TP to get thread_core_local structure. In previous implementation, the value of TP is saved under kernel SP before entering user mode, and the trap handler restores TP from that stack location. However, the value of TP has already been saved into the thread_user_mode_rec structure, which is also upon kernel SP, before entering user mode. So the value of TP can be restored just from thread_user_mode_rec, instead of saving into another location which is under the kernel SP.
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 ...
|
| 3db1b3e3 | 18-Jul-2023 |
Alvin Chang <alvinga@andestech.com> |
core: riscv: Support Privileged Access Never by CSR status.SUM bit
The SUM (Supervisor User Memory access) bit modifies the privilege with which S-mode loads and stores the user virtual memory. When
core: riscv: Support Privileged Access Never by CSR status.SUM bit
The SUM (Supervisor User Memory access) bit modifies the privilege with which S-mode loads and stores the user virtual memory. When SUM bit is 0, S-mode accesses to pages whose U bit of corresponding PTE is set will fault. When SUM bit is 1, these accesses are permitted.
When CFG_PAN is disabled in RISC-V architecture, the status.SUM bit is initialized as 1 by default. Therefore all accesses to user pages will succeed. When CFG_PAN is enabled, the status.SUM bit is initialized as 0, and only set to 1 when kernel needs to access user pages.
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 ...
|
| 539cdb87 | 18-Jul-2023 |
Alvin Chang <alvinga@andestech.com> |
core: riscv: Fix thread_rpc() wrong stack usage and CSR value
Since there are four registers to be stored onto stack, we should preserve up to 32 bytes space on the stack instead of only 16 bytes, o
core: riscv: Fix thread_rpc() wrong stack usage and CSR value
Since there are four registers to be stored onto stack, we should preserve up to 32 bytes space on the stack instead of only 16 bytes, otherwise the stack overflow occurs. The s0 is regarded as frame pointer. The value of CSR status is also restored before returning from thread_rpc().
Signed-off-by: Alvin Chang <alvinga@andestech.com> Reviewed-by: Marouene Boubakri <marouene.boubakri@nxp.com>
show more ...
|
| 0aa98cd2 | 18-Jul-2023 |
Alvin Chang <alvinga@andestech.com> |
core: riscv: Fix width of status CSR
Since we also support RV64 with 64-bit register width, fix the width of status CSR by declaring it as "unsigned long" and encoding it by general bit-wise operati
core: riscv: Fix width of status CSR
Since we also support RV64 with 64-bit register width, fix the width of status CSR by declaring it as "unsigned long" and encoding it by general bit-wise operations instead of invoking fixed-width API.
Signed-off-by: Alvin Chang <alvinga@andestech.com> Reviewed-by: Marouene Boubakri <marouene.boubakri@nxp.com>
show more ...
|