Violet enables running real-time OS on risc-v virtual machines

Violet: Enabling Full Virtualization for M-mode RTOS on RISC-V

Operating Systems

Summary

Running real-time operating systems (RTOS) that control hardware directly is tricky on RISC-V computers when using virtual machines, because the usual hardware support doesn't include the mode RTOSs run in. The authors created Violet, a system that mixes built-in virtualization with software tricks to let RTOSs run unmodified inside virtual machines on RISC-V. They tested Violet on real hardware and showed it can run these RTOSs alongside regular Linux operating systems. They also measured the performance costs introduced by their approach.

What this means in practice

  • For embedded systems developers: Run multiple real-time operating systems and general-purpose OSs simultaneously on RISC-V hardware using Violet's virtualization and emulation support.
  • For industrial automation engineers: Deploy real-time control software on RISC-V virtual machines coexisting with general-purpose Linux systems for integrated industrial applications.

Authors

Taro Kito, Ryosuke Yamamoto, Keisuke Horii, Hiroki Masuda, Koichi Mouri

Abstract

In embedded systems, complex configurations may be required, such as the simultaneous execution of a real-time operating system (RTOS) and a general-purpose operating system (GPOS), or the operation of multiple RTOS instances. Embedded system hypervisors have been studied and developed to meet these requirements for architectures like ARM and x86. RISC-V is experiencing growing adoption in embedded systems and faces similar needs. However, RISC-V's virtualization support targets only U-mode (where applications run) and S-mode (where general-purpose OSs run) as virtualization levels. The M-mode, where RTOSs like FreeRTOS or Zephyr run, is excluded from virtualization. This means that, similar to architectures like ARM, running an RTOS on a Virtual Machine (VM) using methods based on virtualization support features is impossible. Therefore, this paper proposes the Violet hypervisor. Violet combines RISC-V's virtualization features with software-based emulation, enabling the execution of unmodified M-mode RTOSs. Evaluation verified the validity of the M-mode emulation functionality using RISC-V architecture tests. Furthermore, this was implemented on the SiFive HiFive Premier P550 hardware, demonstrating that existing RTOSs can run on Violet's VM and that coexistence with GPOSs like Linux is also possible. The performance evaluation also quantified the overhead introduced by M-mode emulation on M-mode CSR accesses, timer interrupt latency, and context switching.