diff options
| author | GUI <[email protected]> | 2026-10-17 09:44:26 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-10-17 09:44:26 +0800 |
| commit | 8d8dc96b67eee53af2841a8819364d52fbec39cb (patch) | |
| tree | eb2ac2f0984261f526c5d9c14462db47eceeb193 /components/mm | |
| parent | c1d931bcc78915f24c3526a07bdecc64d5110d51 (diff) | |
[ARCH/RISC-V] Next RISC-V (#10320)
* [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 <[email protected]>
* [libcpu][risc-v] skip disabled CPU nodes in early FDT walk
Rbb666 noted that rt_hw_fdt_install_early() walked every /cpus child
without checking status, so disabled cores still joined hart registration
and MMU capability probing. Skip nodes that are not okay/ok via
rt_fdt_device_is_available() before reading reg or mmu-type.
Signed-off-by: seteiro <[email protected]>
* [libcpu][risc-v] Fix per-CPU page table mapping
- reuse existing non-leaf page table entries when mapping per-CPU areas
- reject leaf entry conflicts instead of overwriting mappings
Signed-off-by: GuEe-GUI <[email protected]>
---------
Signed-off-by: GuEe-GUI <[email protected]>
Signed-off-by: seteiro <[email protected]>
Co-authored-by: seteiro <[email protected]>
Diffstat (limited to 'components/mm')
| -rw-r--r-- | components/mm/SConscript | 9 | ||||
| -rw-r--r-- | components/mm/ioremap-nommu.c | 21 | ||||
| -rw-r--r-- | components/mm/utest/test_cache_rv64.h | 2 |
3 files changed, 31 insertions, 1 deletions
diff --git a/components/mm/SConscript b/components/mm/SConscript index f90f540ce2..cc205119f8 100644 --- a/components/mm/SConscript +++ b/components/mm/SConscript @@ -4,7 +4,14 @@ from building import * group = [] cwd = GetCurrentDir() -if GetDepend('ARCH_ARM_CORTEX_A') or GetDepend('ARCH_ARMV8') or GetDepend('ARCH_RISCV64'): +new_riscv_common = GetDepend('RT_USING_RISCV_NEW_COMMON') +legacy_mmu_arch = (GetDepend('ARCH_ARM_CORTEX_A') or + GetDepend('ARCH_ARMV8') or + (GetDepend('ARCH_RISCV64') and not new_riscv_common)) +new_riscv_mmu_arch = (new_riscv_common and + GetDepend('ARCH_MM_MMU')) + +if legacy_mmu_arch or new_riscv_mmu_arch: src = Glob('*.c') + Glob('*_gcc.S') SrcRemove(src, ['ioremap-nommu.c']) if not GetDepend('RT_USING_MEMBLOCK'): diff --git a/components/mm/ioremap-nommu.c b/components/mm/ioremap-nommu.c index d58b457dc4..9d75a37df9 100644 --- a/components/mm/ioremap-nommu.c +++ b/components/mm/ioremap-nommu.c @@ -7,10 +7,31 @@ #include <rtthread.h> #include <ioremap.h> +#include <mm_aspace.h> void *rt_ioremap_start; size_t rt_ioremap_size; +const rt_ubase_t rt_kmem_pvoff(void) +{ + return 0; +} + +void rt_kmem_pvoff_set(rt_ubase_t pvoff) +{ + RT_UNUSED(pvoff); +} + +void *rt_kmem_v2p(void *vaddr) +{ + return vaddr; +} + +void *rt_kmem_p2v(void *paddr) +{ + return paddr; +} + void *rt_ioremap_early(void *paddr, size_t size) { return size ? paddr : RT_NULL; diff --git a/components/mm/utest/test_cache_rv64.h b/components/mm/utest/test_cache_rv64.h index 3bd7fc26eb..72d7dd2527 100644 --- a/components/mm/utest/test_cache_rv64.h +++ b/components/mm/utest/test_cache_rv64.h @@ -12,7 +12,9 @@ #define __TEST_CACHE_RV64_H #ifdef ARCH_RISCV64 +#ifndef RT_USING_RISCV_NEW_COMMON #include "riscv_mmu.h" +#endif #include <utest.h> #include <cache.h> #include <page.h> |
