RTEMS | RISC-V: add support for using the MMU in S-Mode (!1182)

Gedare Bloom (@gedare) gitlab at rtems.org
Thu Apr 2 21:17:51 UTC 2026



Gedare Bloom created a merge request: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1182

Project:Branches: gedare/rtems:riscv-satp-init to rtems/rtos/rtems:main
Author:   Gedare Bloom



## Summary

Add basic support for MMU.

Closes #5540 

## Testing

I have to hunt down the `spconsole01.exe` failure. It's probably an issue with the mmio register r/w access sync'ing.

### Uniprocessor s-mode

config.ini:
```
[riscv/rv64imafdc_s]
INHERIT = rv64imafdc
RISCV_RAM_REGION_BEGIN = 0x84000000
RISCV_RAM_REGION_SIZE =  0x03000000
RISCV_USE_S_MODE = True
```

Tester
```
rtems-test --rtems-bsp=rv64imafdc_smode build/riscv/rv64imafdc_s/testsuites/sptests
...
Passed:        221
Failed:          1
User Input:      0
Expected Fail:   0
Indeterminate:   0
Benchmark:       0
Timeout:         1
Test too long:   0
Invalid:         0
Wrong Version:   0
Wrong Build:     0
Wrong Tools:     0
Wrong Header:    0
------------------
Total:         223
Failures:
 sp69.exe
Timeouts:
 spconsole01.exe
```

### SMP s-mode

```
[riscv/rv64imafdc_s_smp]
INHERIT = rv64imafdc_s
RTEMS_SMP = True
```

```
rtems-test --rtems-bsp=rv64imafdc_smode_smp build/riscv/rv64imafdc_s_smp/testsuites/smptests
...
Passed:        58
Failed:         2
User Input:     0
Expected Fail:  0
Indeterminate:  0
Benchmark:      0
Timeout:        0
Test too long:  0
Invalid:        0
Wrong Version:  0
Wrong Build:    0
Wrong Tools:    0
Wrong Header:   0
-----------------
Total:         60
Failures:
 smpmrsp01.exe
 smpschededf01.exe
```
These more or less match the results for SMP with M-Mode (it fails on smpfatal01.exe but not smpschededf01.exe).

## Generative AI

I used ChatGPT to help debug the page table walk. It was an exciting adventure. Ask me about it some time.

<!-- If you have used AI please use the "AI Contribution" template otherwise leave this blank see our fulls statement at https://www.rtems.org/generative-ai/-->


<!-- Default settings, if it is a dropdown it will set after submission -->

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1182
You're receiving this email because of your account on gitlab.rtems.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20260402/285c87c9/attachment-0001.htm>


More information about the bugs mailing list