nuttx/arch
Lee Lup Yuen 62c358946d risc-v/bl808: Flush MMU Cache after updating SATP
Ox64 BL808 crashes with a Page Fault when we run `getprime` then `hello`. This is caused by the T-Head C906 MMU incorrectly accessing the MMU Page Tables of the Previous Process (`getprime`) while starting the New Process (`hello`).

To fix the problem, this PR flushes the MMU Cache whenever we point the MMU SATP Register to the New Page Tables. We execute 2 RISC-V Instructions that are specific to T-Head C906:

- DCACHE.IALL: Invalidate all Page Table Entries in the D-Cache
- SYNC.S: Ensure that all Cache Operations are completed

This is derived from the T-Head Errata for Linux Kernel. More details here: https://lupyuen.github.io/articles/mmu#appendix-flush-the-mmu-cache-for-t-head-c906

Modified Files:

- `arch/risc-v/src/common/riscv_mmu.h`: If needed, `mmu_write_satp()` calls `mmu_flush_cache()` (weak function) to flush the MMU Cache. (Like for T-Head C906)

- `arch/risc-v/src/bl808/bl808_mm_init.c`: Flush the MMU Cache for T-Head C906. Extend `mmuflags` from 32-bit to 64-bit to be consistent with `mmu_ln_setentry()`.

- `boards/risc-v/bl808/ox64/configs/nsh/defconfig`: Enable `ostest` in the Build Config. Update `CONFIG_BOARD_LOOPSPERMSEC` according to `calib_udelay`.
2024-01-23 01:25:20 -08:00
..
arm stm32h7:serial make TX DMA busy when there are an outstanding transaction 2024-01-22 06:06:01 -08:00
arm64 docs/comments: fix some typos 2024-01-15 13:22:13 +08:00
avr arch/: remove duplicated task exit logs 2024-01-17 09:18:17 -08:00
ceva docs/comments: fix some typos 2024-01-15 13:22:13 +08:00
dummy
hc arch/: remove duplicated task exit logs 2024-01-17 09:18:17 -08:00
mips arch/: remove duplicated task exit logs 2024-01-17 09:18:17 -08:00
misoc arch/: remove duplicated task exit logs 2024-01-17 09:18:17 -08:00
or1k arch/: remove duplicated task exit logs 2024-01-17 09:18:17 -08:00
renesas arch/: remove duplicated task exit logs 2024-01-17 09:18:17 -08:00
risc-v risc-v/bl808: Flush MMU Cache after updating SATP 2024-01-23 01:25:20 -08:00
sim arch/: remove duplicated task exit logs 2024-01-17 09:18:17 -08:00
sparc arch/: remove duplicated task exit logs 2024-01-17 09:18:17 -08:00
x86 arch/: remove duplicated task exit logs 2024-01-17 09:18:17 -08:00
x86_64 arch/: remove duplicated task exit logs 2024-01-17 09:18:17 -08:00
xtensa esp32: Explicitly fail on boot-up for unsupported ESP32 versions. 2024-01-21 06:33:25 -08:00
z16 arch/: remove duplicated task exit logs 2024-01-17 09:18:17 -08:00
z80 arch/: remove duplicated task exit logs 2024-01-17 09:18:17 -08:00
CMakeLists.txt build: add initial cmake build system 2023-07-08 13:50:48 +08:00
Kconfig arch/risc-v: add ARCH_QPFPU for Quad-Precision Floating-Point 2024-01-15 22:31:39 -08:00