RTEMS | risc-v: support running in s-mode (!1086)
Gedare Bloom (@gedare)
gitlab at rtems.org
Thu Feb 26 22:08:26 UTC 2026
Gedare Bloom created a merge request: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1086
Project:Branches: gedare/rtems:riscv-smode to rtems/rtos/rtems:main
Author: Gedare Bloom
Assignee: Gedare Bloom
## Summary
Updates #3337
Adds a new CPU configuration option `RISCV_USE_S_MODE` that enables booting and running RTEMS using the supervisor privileged mode (s-mode) instead of the machine privileged mode (m-mode). This is implemented only for the generic `riscv` BSP variants and works only for uniprocessor execution with the `Sstc` extension enabled (for s-mode timer access). We need to port Supervisor Binary Interface (SBI) calls to access the m-mode legacy timer, IPIs to support SMP, and console input.
It can be run using
`qemu-system-riscv64 -M virt -nographic -kernel build/riscv/rv64imafdc_s/testsuites/samples/hello.exe`
with config.ini:
```
[riscv/rv64imafdc_s]
INHERIT = rv64imafdc
RISCV_RAM_REGION_BEGIN = 0x84000000
RISCV_RAM_REGION_SIZE = 0x03000000
RISCV_USE_S_MODE = True
```
There are about mixed failures whether using s-mode or m-mode.
Test results with S-Mode:
```
Passed: 644
Failed: 17
User Input: 6
Expected Fail: 24
Indeterminate: 0
Benchmark: 3
Timeout: 6
Test too long: 0
Invalid: 0
Wrong Version: 0
Wrong Build: 0
Wrong Tools: 0
Wrong Header: 0
------------------
Total: 700
Failures:
dl01.exe
dl02.exe
dl05.exe
dl06.exe
dl07.exe
dl08.exe
dl09.exe
dl11.exe
dl12.exe
fsfatfsformat01.exe
psx09.exe
psxstat.exe
sp69.exe
stringto01.exe
tftpfs.exe
ts-validation-one-cpu-0.exe
ttest01.exe
...
Timeouts:
spconsole01.exe
tm27.exe
ts-performance-no-clock-0.exe
ts-unit-no-clock-0.exe
ts-validation-intr.exe
ts-validation-no-clock-0.exe
```
Test results without S-Mode:
```
Passed: 648
Failed: 19
User Input: 6
Expected Fail: 24
Indeterminate: 0
Benchmark: 3
Timeout: 0
Test too long: 0
Invalid: 0
Wrong Version: 0
Wrong Build: 0
Wrong Tools: 0
Wrong Header: 0
------------------
Total: 700
Failures:
dl01.exe
dl02.exe
dl05.exe
dl06.exe
dl07.exe
dl08.exe
dl09.exe
dl11.exe
dl12.exe
fsfatfsformat01.exe
psx09.exe
psx12.exe
psxstat.exe
sp69.exe
spcpucounter01.exe
stringto01.exe
tftpfs.exe
ts-validation-intr.exe
ttest01.exe
```
## Generative AI
<!-- 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/1086
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/20260226/be3ab8d9/attachment.htm>
More information about the bugs
mailing list