Skip to content

Commit 64097c8

Browse files
committed
[libcpu][risc-v] Refactor the RISC-V architecture port
Introduce an opt-in unified RISC-V common layer for RV32 and RV64 while keeping existing BSPs on the legacy implementation during migration. - use ARCH_RISCV and ARCH_CPU_64BIT for architecture and XLEN selection - unify context, trap, MMU, cache, timer, SBI, SMP and ISA handling - add PLIC, CLIC, ACLINT, APLIC and IMSIC support - map physical hart IDs to contiguous logical CPU IDs - add T-Head vendor overrides while preserving legacy ports - migrate qemu-virt64-riscv with RV32 and RV64 support - update clock_time, MM, LWP, OFW, PCI and Rust integration Existing BSPs continue using legacy_common or common64 unless they select RT_USING_RISCV_NEW_COMMON. Signed-off-by: GuEe-GUI <2991707448@qq.com>
1 parent 991f0ff commit 64097c8

173 files changed

Lines changed: 14902 additions & 3477 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bsp/qemu-virt64-riscv/.config

Lines changed: 247 additions & 56 deletions
Large diffs are not rendered by default.

bsp/qemu-virt64-riscv/.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
mnt.c
2-
romfs_data.c
1+
*.dtb
2+
*.dts
3+
*.qcow2
34
opensbi
5+
romfs_data.c

bsp/qemu-virt64-riscv/Kconfig

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -6,52 +6,53 @@ RTT_DIR := ../../
66

77
PKGS_DIR := packages
88

9+
SOC_DM_PIC_DIR := $(RTT_DIR)/libcpu/risc-v/common/pic
10+
SOC_DM_SERIAL_DIR := $(RTT_DIR)/libcpu/risc-v/common/serial
11+
SOC_DM_HWCACHE_DIR := $(RTT_DIR)/libcpu/risc-v/common/hwcache
12+
SOC_DM_SOC_DIR := $(BSP_DIR)/driver
13+
14+
choice
15+
prompt "RISC-V XLEN"
16+
default BSP_QEMU_RISCV64
17+
18+
config BSP_QEMU_RISCV32
19+
bool "RV32"
20+
21+
config BSP_QEMU_RISCV64
22+
bool "RV64"
23+
endchoice
24+
25+
config ARCH_TEXT_OFFSET
26+
range 0x400000 0x400000 if BSP_QEMU_RISCV32
27+
range 0x200000 0x200000 if BSP_QEMU_RISCV64
28+
default 0x400000 if BSP_QEMU_RISCV32
29+
default 0x200000 if BSP_QEMU_RISCV64
30+
31+
config ARCH_RAM_OFFSET
32+
range 0x80000000 0x80000000
33+
default 0x80000000
34+
935
source "$(RTT_DIR)/Kconfig"
1036
osource "$PKGS_DIR/Kconfig"
11-
rsource "driver/Kconfig"
1237

13-
config BOARD_QEMU_VIRT_RV64
38+
config BSP_USING_QEMU_RISCV_VIRT
1439
bool
15-
select ARCH_RISCV64
16-
select ARCH_USING_RISCV_COMMON64
40+
select ARCH_RISCV
41+
select ARCH_CPU_64BIT if BSP_QEMU_RISCV64
42+
select RT_USING_RISCV_NEW_COMMON
43+
select ARCH_RISCV_USING_GENERIC_STARTUP
44+
select ARCH_RISCV_USING_GENERIC_LINKER_SCRIPT
45+
select ARCH_RISCV_USING_GENERIC_SETUP
46+
select RT_USING_DM
47+
select RT_USING_OFW
48+
select RT_USING_PIC
1749
select RT_USING_COMPONENTS_INIT
1850
select RT_USING_USER_MAIN
1951
select RT_USING_CACHE
2052
select ARCH_MM_MMU
21-
select ARCH_REMAP_KERNEL
22-
default y
23-
24-
config ENABLE_FPU
25-
bool "Enable FPU"
26-
select ARCH_RISCV_FPU
53+
select ARCH_REMAP_KERNEL if RT_USING_SMART
54+
select ARCH_RISCV_FPU_D if BSP_QEMU_RISCV64
55+
select ARCH_RISCV_VECTOR if BSP_QEMU_RISCV64
56+
select RT_KLIBC_USING_VSNPRINTF_LONGLONG
57+
select RT_USING_STDC_ATOMIC
2758
default y
28-
29-
config ENABLE_VECTOR
30-
bool "Using RISC-V Vector Extension"
31-
select ARCH_RISCV_VECTOR
32-
default n
33-
34-
if ENABLE_VECTOR
35-
choice ARCH_VECTOR_VLEN_SEL
36-
prompt "Vector Registers Length in Bits"
37-
default ARCH_VECTOR_VLEN_128
38-
39-
config ARCH_VECTOR_VLEN_128
40-
bool "128"
41-
42-
config ARCH_VECTOR_VLEN_256
43-
bool "256"
44-
endchoice
45-
endif
46-
47-
config RT_USING_USERSPACE_32BIT_LIMIT
48-
bool "Enable userspace 32bit limit"
49-
default n
50-
51-
config RT_USING_VIRTIO_MMIO_ALIGN
52-
bool "Open packed attribution, this may caused an error on virtio"
53-
default n
54-
55-
config __STACKSIZE__
56-
int "stack size for interrupt"
57-
default 4096

0 commit comments

Comments
 (0)