• Stars
    star
    343
  • Rank 123,371 (Top 3 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created about 6 years ago
  • Updated almost 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

RISC-V hypervisor written in Rust

RVirt

Travis License Language

RVirt is an S-mode trap-and-emulate hypervisor for RISC-V. It is currently targeted at QEMU's virt machine type, but partially supports the HiFive Unleashed as well. It can run either on either the Berkeley Boot Loader or with its own (considerably faster) M-mode stub. It is powerful enough to run multiple instances of Linux as guest operating systems.

FAQ

How is RVirt different from other hypervisors like Firecracker, Cloud Hypervisor or xvisor?

All three of the other projects can only run on processors that have hardware virtualization extensions like Intel VT-x or RISC-V's planned H-extension. Firecracker and Cloud Hypervisor additionally depend on KVM (and by extension the entire Linux kernel). By contrast, RVirt doesn't need KVM or Linux and can run on any sufficiently powerful 64-bit RISC-V processor with an MMU.

Why RISC-V?

RISC-V is classically virtualizable which means that a hypervisor can rely on any privileged instruction triggering an illegal instruction fault when executed by the (unprivileged) guest OS. This is in contrast to other ISAs like x86 which have instructions that behave differently in user and kernel mode but never trap. Additionally, RISC-V has only 12 supervisor level control registers and only a handful of privileged instructions making the work to implement trap and emulate much more manageable.

Why Rust?

Why not? Rust is a pleasant language to work with and can directly target bare metal platforms. I was also excited by Rust's ability to guarantee memory safety for safe code, but I found the amount of unsafe code required for initialization and vm entry/exit partially negated this benefit.

Getting Started

For more detailed instructions, see the getting started guide.

Install Dependencies

$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
$ sudo apt-get install qemu-system-misc

Clone the repository

$ git clone https://github.com/mit-pdos/rvirt && cd rvirt

Download guest images

$ wget https://fedorapeople.org/groups/risc-v/disk-images/vmlinux
$ mv vmlinux fedora-vmlinux
$ wget https://fedorapeople.org/groups/risc-v/disk-images/stage4-disk.img.xz
$ unxz stage4-disk.img.xz

Compile and run

$ make qemu

This command launches an instance of QEMU with RVirt running inside and Linux running inside that. Once the boot process has completed you can SSH in through all the layers and directly interact with the guest (root password is 'riscv'):

$ ssh -p 10001 root@localhost

Current Status

RVirt supports running both inside an emulator and on real hardware and does runtime detection to learn what platform it is executing on. It has so far been tested with Fedora RISC-V builds, but may work with other distributions as well.

Supported Platforms

Tier 1: Boots fully and supports interaction via SSH / serial console

  • QEMU virt machine type

Tier 2: Boots partially but lacks driver support for block/network device to complete boot process

  • HiFive Unleashed board
  • QEMU sifiveu machine type

Correctness

  • Trap and emulate of privileged instructions (CSR related and SFENCE.VMA)
  • Shadow page tables
  • Update PTE accessed and dirty bits
  • Timers
  • Expose and/or emulate peripherals
  • Address lingering bugs in boot process

Functionality

In addition to being able to boot and run a single guest, RVirt also supports some features not needed for the correct virtualization of a single guest:

  • multiple guests
  • passthrough of virtio block and network devices
  • paravirtualized network devices backed by HiFive Unleashed's NIC (in progress)
  • multicore guests and inter-processor interrupts between them

Other features not used by Linux / not supported by current platforms are unlikely to be implemented:

  • ASID support
  • Sv48 or Sv57 guest page tables (only Sv39 currently allowed)
  • SR-IOV PCIe devices
  • 32-bit guests

More Repositories

1

xv6-public

xv6 OS
C
7,710
star
2

xv6-riscv

Xv6 for RISC-V
C
6,787
star
3

noria

Fast web applications through dynamic, partially-stateful dataflow
Rust
4,980
star
4

biscuit

Biscuit research OS
Go
2,447
star
5

xv6-riscv-book

Text describing xv6 on RISC-V
TeX
640
star
6

xv6-book

Commentary for xv6-public
Perl
243
star
7

fscq

FSCQ is a certified file system written and proven in Coq
Coq
234
star
8

xv6-riscv-fall19

6.S081/6.828 lab repo for fall 2019
C
197
star
9

perennial

Verifying concurrent crash-safe systems
Coq
154
star
10

sigmaos

Go
96
star
11

6.828-qemu

qemu patched for debugging, used for 6.828
C
78
star
12

noria-mysql

MySQL/MariaDB protocol shim for Noria
Rust
67
star
13

noria-ui

Web UI for Noria clusters
JavaScript
67
star
14

go-journal

Verified, concurrent, crash-safe transaction system
Go
49
star
15

mcqc

A Gallina compiler with C++17 as an intermediate representation
Haskell
41
star
16

go-nfsd

Fast NFS server implemented using GoJournal
Go
40
star
17

ward

C++
30
star
18

daisy-nfsd

DaisyNFS is an NFS server verified using Dafny and Perennial.
Dafny
28
star
19

scalefs

C
21
star
20

dsrg

Distributed Systems Reading Group
CSS
20
star
21

secfs-skeleton

Skeleton code for new 6.858 final project --- an encrypted and authenticated file system
Python
20
star
22

perflock

RWMutex for sharing of multicore machines.
C
16
star
23

vmvcc

Go
16
star
24

6.826-2020-labs

Lab assignments for 6.826
Coq
13
star
25

what

An improved version of `w`
Python
13
star
26

6.826-2017-labs

Coq
13
star
27

6.S060-labs

Programming labs for 6.S060 (Foundations of Computer Security).
Python
12
star
28

cspec

Verifying concurrent code with layers and movers
Coq
12
star
29

argosy

Proving crash safety for systems with layered recovery
Coq
11
star
30

6.826-2019-labs

Lab assignments for 6.826
Coq
10
star
31

gokv

Go
10
star
32

syndicate

Syndicate multiplexes several distributed master-slave applications onto a single cluster of machines.
Go
9
star
33

mailbot

Bot to send email notifications when pushing to GitHub
Shell
7
star
34

deepspec-pocs

Coq
6
star
35

6.1600-labs

Student lab assignments for MIT 6.1600
Python
6
star
36

6.5660-lab-2023

Python
5
star
37

spectrebench

C++
5
star
38

perennial-examples

Examples verified using Perennial
Go
4
star
39

grove-artifact

Python
3
star
40

noria-benchmarks

Experiment scripts and results for Soup
Rust
3
star
41

6.1600-notes

TeX
3
star
42

csail-events-slack

Simple Slack webhook for posting notifications about upcoming CSAIL seminars
Ruby
3
star
43

grove

Experiments in verifying distributed systems with Iris
2
star
44

6.566-lab-2024

Python
2
star
45

new-students

Welcome for new PDOS students to get access to the organization
1
star