Huang Qi
4ebc581c73
esp32c3: Simplify irq dispatch logic
...
ESP32C3 use customized irq encoding so it's hard to share further code
with other risc-v based chips, in this patch, we keep the exception
number definition with risc-v spec.
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-04-07 18:16:35 +02:00
Petro Karashchenko
9b7f9867aa
arch/risc-v: use STACK_FRAME_SIZE for in S-mode syscall asm
...
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-04-04 12:05:53 +08:00
Xiang Xiao
e959775397
arch/riscv: Access [m|s]scratch through CSR_SCRATCH macro
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-04-02 14:08:37 +03:00
Xiang Xiao
629d9969dd
arch/riscv: Rename riscv_syscall_dispatch to riscv_dispatch_syscall
...
follow other function naming(e.g. riscv_dispatch_irq)
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-04-02 14:08:37 +03:00
Xiang Xiao
7a209e6ee8
arch/riscv: Align the macro definition in csr.h
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-04-02 14:08:37 +03:00
Ville Juven
c15b6701ce
RISC-V: Implement option to run NuttX in supervisor mode (S-mode)
...
- Add config "ARCH_USE_S_MODE" which controls whether the kernel
runs in M-mode or S-mode
- Add more MSTATUS and most of the SSTATUS register definitions
- Add more MIP flags for interrupt delegation
- Add handling of interrupts from S-mode
- Add handling of FPU from S-mode
- Add new context handling functions that are not dependent on the trap
handlers / ecall
NOTE: S-mode requires a companion SW (SBI) which is not yet implemented,
thus S-mode is not usable as is, yet.
2022-04-01 16:19:42 -03:00
Petro Karashchenko
870ca12146
arch/risc-v: get wider visibility for arch instruction macros
...
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-04-01 10:31:24 +08:00
Petro Karashchenko
36b0b95eb1
arch/risc-v: include csr.h indirectly through nuttx/irq.h
...
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-03-31 19:34:52 +08:00
Richard Tucker
6d8cd4ec92
arch/risc-v/src/litex/litex_sdio: add litesdcard peripheral driver
...
See the following for details on the pepheral:
https://github.com/enjoy-digital/litesdcard
2022-03-30 02:35:27 +08:00
Ville Juven
43d5f60a74
MPFS: Fix issue with external interrupt detection
...
The bitmask overflow'd. Failing test is at mpfs_irq_dispatch / line 69
2022-03-28 22:40:11 +08:00
Huang Qi
83a5e9958f
arch/risc-v: Correct comments for current implementations
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-03-28 13:41:57 +08:00
Huang Qi
494230a841
arch/risc-v: Improve performance of context switch
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-03-26 07:19:09 +09:00
Petro Karashchenko
7afedda89e
arch/risc-v: improve style consistency accross chip variants
...
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-03-25 10:26:15 -03:00
Ville Juven
77e90d9c87
RISC-V: Include support for kernel stack
...
Preparation for CONFIG_BUILD_KERNEL=y, which requires that a kernel
stack is allocated for each user process.
2022-03-24 00:15:28 +08:00
Huang Qi
00efcd3308
arch/risc-v: Merge riscv_getnewintctx into common
...
And also mask the bits which should be preserved (from ISA spec)
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-03-19 17:38:18 +08:00
Ville Juven
75afe491ad
RISC-V: Prepare for CONFIG_BUILD_KERNEL
...
- Thread context prior to system call needs to be preserved
- Allocate a kernel heap
2022-03-18 18:20:12 +08:00
Ville Juven
9269a86d00
RISC-V: Add common data memory and instruction barriers
2022-03-18 18:20:12 +08:00
Xiang Xiao
b6bc460b2c
arch: Make the comment and definition of CONFIG_SYS_RESERVED correctly
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-14 22:51:00 +02:00
Xiang Xiao
ea614090cd
arch/risc-v: Change hex number to low case in csr.h
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-13 10:17:25 +02:00
Huang Qi
c6e636a871
arch/risc-v: Save/Load float register in setjmp
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-03-09 10:15:54 +02:00
Huang Qi
8dedf1d9af
arch/risc-v: Correct handling of QPFPU and DPFPU
...
If QPFPU enabled we will never enter the expected QPFPU branch since
option QPFPU depend on DPFPU.
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-03-09 10:15:54 +02:00
Huang Qi
35330a798b
risc-v: Implement READ_AND_SET_CSR for CSR operate
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-03-03 19:55:54 +08:00
Xiang Xiao
44bd3212d4
arch: Remove SYS_RESERVED from Kconfg
...
let's arch define the correct value instead
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-27 22:54:13 +08:00
Xiang Xiao
087b9e5ff3
arch: Move the content from svcall.h to syscall.h
...
and remove svcall.h
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-27 22:54:13 +08:00
Huang Qi
e8552156b6
arch/risc-v: Remove unneeded ISA specifc interface
...
They are not really defined and used in any where:
uint32_t up_getmisa(void);
uint32_t up_getarchid(void);
uint32_t up_getimpid(void);
uint32_t up_getvendorid(void);
uint32_t up_gethartid(void);
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-02-25 20:36:16 +08:00
Huang Qi
8b66280b4f
arch/risc-v: Update outdated comments
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-02-25 20:36:16 +08:00
Ville Juven
81188d9c94
Extend the RISC-V PMP functionality
...
- Add test for mode support, which is architecture dependent
- Add tests for address alignment and region size
- Add option to query for access rights
- The function goes through every PMP entry and tests if an address
range from [base, base+size] has been configured for desired
access rights.
- If several PMP entries match the range and access rights, the
information is combined
- End result is either no access, a partial match was found, or a full
match was found. Details about the partial match are not provided.
The intent for testing access rights and not just blindly applying them
is a case where they are already set in e.g. a bootloader. In this
case, nothing should be done, unless the configuration does not match,
in which case the software must not continue further.
2022-01-25 20:22:34 +08:00
Huang Qi
b803919b9d
arch/risc-v: Merge mcause.h into irq.h
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-01-22 14:57:05 +08:00
Huang Qi
d846bb0235
arch/risc-v: Remove dupped irq code from mpfs
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-01-21 00:44:43 +08:00
Huang Qi
6dc4dd207f
arch/risc-v: Remove dupped irq code from rv32m1
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-01-21 00:44:43 +08:00
Huang Qi
089dc2e090
arch/risc-v: Remove dupped irq code from litex
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-01-21 00:44:43 +08:00
Huang Qi
d1edd887d5
arch/risc-v: Remove dupped irq code from c906
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-01-21 00:44:43 +08:00
Huang Qi
bd57229f3c
arch/risc-v: Remove dupped irq code from bl602
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-01-21 00:44:43 +08:00
Huang Qi
8532feda78
arch/risc-v: Remove dupped irq code from fe310
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-01-21 00:44:43 +08:00
Huang Qi
e81439a367
arch/risc-v: Remove dupped irq code from k210
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-01-21 00:44:43 +08:00
Huang Qi
7738bb98fc
arch/risc-v: Remove dupped irq code from qemu-rv
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-01-21 00:44:43 +08:00
Huang Qi
f43d677c2e
arch/risc-v: Unify common irq code to arch/irq.h
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-01-21 00:44:43 +08:00
Huang Qi
5792d851e5
arch/risc-v/qemu-rv: Support both rv32/rv64 core
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-01-15 11:42:01 +08:00
Huang Qi
10bb48b9b4
arch/risc-v: Merge rv32im and rv64gc into common
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-01-11 23:24:33 +08:00
Huang Qi
3a0e86c99b
arch/risc-v: Replace __LP64__ with CONFIG_ARCH_RV64
...
It can provide better auto complete experience for modern code editor,
since they use clang/gcc based parser to analyze code but lacks some
target dependent info such as __LP64__ for riscv64.
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-01-04 23:22:43 +08:00
Huang Qi
a6662c2887
arch/risc-v: Refine arch.h
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-01-04 14:46:24 +08:00
Huang Qi
2de22980e5
arch/risc-v: Refine syscall interface
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-12-30 11:47:42 +08:00
Huang Qi
d71cfc178a
arch/risc-v: Remove unneeded kconfigs
...
CONFIG_RV32IM_HW_MULDIV can be safely removed since this behavior is
controlled by M extension.
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-12-28 05:02:42 -06:00
Huang Qi
c2e8c92b25
arch/risc-v: Refine Toolchain.defs
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-12-28 00:30:10 -06:00
Huang Qi
8ce3337e85
arch/risc-v: Implement TLS support
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-12-12 10:19:00 -06:00
Xiang Xiao
6357523892
arch: Add _wchar_t typedef like other basic types
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-12-09 16:57:23 +09:00
Huang Qi
63ab2f4308
arch/risc-v: Introduce basic support for qemu rv32
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-12-07 23:28:33 -06:00
Xiang Xiao
a0990ee416
arch: Remove the duplicated up_tls_info implementation
...
Define up_tls_info in arch/arch.h directly if the general one isn't suitable
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-12-05 20:59:53 -06:00
Alin Jerpelea
15a37c5a5a
arch: Omni Hoverboards: update licenses to Apache
...
Gregory Nutt has submitted the SGA
Omni Hoverboards has submitted the SGA
David Sidrane has submitted the ICLA
Mateusz Szafoni has submitted the ICLA
Sebastien Lorquet has submitted the ICLA
Paul Alexander Patience has submitted the ICLA
as a result we can migrate the licenses to Apache.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-09-28 04:37:38 -07:00
Gustavo Henrique Nihei
06f4ee850a
arch/risc-v: Remove FAR qualifier for RISC-V-specific files
...
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-09-22 08:16:01 -03:00