Skip to content

Running

LekKit edited this page Oct 7, 2024 · 36 revisions

Running RVVM

Demo

CLI Example: Launches a dual-core VM with 2 GiB of RAM, 1280x720 display.

Runs OpenSBI + U-Boot firmware, Arch RISC-V guest. Forwards host 127.0.0.1:2022 into guest SSH port.

rvvm fw_payload.bin -i archriscv.img -m 2G -smp 2 -res 1280x720 -portfwd tcp/127.0.0.1:2022=22

Be aware that default 256M of guest RAM may not be enough for complex guests, like Ubuntu.

Extended help:

Usage: rvvm <firmware> [-m 256M] [-k kernel] [-i drive.img] ...

    <firmware>       Initial M-mode firmware (OpenSBI [+ U-Boot], etc)
    -k, -kernel ...  Optional S-mode kernel payload (Linux, U-Boot, etc)
    -i, -image  ...  Attach preferred storage image (Currently as NVMe)
    -m, -mem 1G      Memory amount, default: 256M
    -s, -smp 4       Cores count, default: 1
    -rv32            Enable 32-bit RISC-V, 64-bit by default
    -cmdline    ...  Override payload kernel command line
    -append     ...  Modify payload kernel command line
    -res 1280x720    Set display(s) resolution
    -poweroff_key    Send HID_KEY_POWER instead of exiting on GUI close
    -portfwd 8080=80 Port forwarding (Extended: tcp/127.0.0.1:8080=80)
    -vfio_pci   ...  PCI passthrough via VFIO (Example: 00:02.0), needs root
    -nvme       ...  Explicitly attach storage image as NVMe device
    -ata        ...  Explicitly attach storage image as ATA (IDE) device
    -nogui           Disable display GUI
    -nonet           Disable networking
    -serial     ...  Add more serial ports (Via pty/pipe path), or null
    -dtb        ...  Pass custom Device Tree Blob to the machine
    -dumpdtb    ...  Dump auto-generated DTB to file
    -v, -verbose     Enable verbose logging
    -h, -help        Show this help message

Testing or debugging features:

    -noisolation                   Disable seccomp/pledge isolation
    -nojit                         Disable RVJIT (For rvvm debug, slow!)
    -rvjit_harvard                 Strict instruction cache flush checks (For guest debug, slow!)
    -rvjit_disable_rwx             Force W^X JIT heap allocation
    -rvjit_force_bmi2 [true/false] Force enable/disable BMI2 x86 extensions
    -jitcache 16M                  Per-core JIT cache size (Scales with guest RAM by default)
    -sv48                          Enable SV48 MMU pagetable scheme
    -sv57                          Enable SV57 MMU pagetable scheme

Recommended VM firmware

Running generic distro images via U-Boot

For most generic distro images, EFI firmware is needed. U-Boot works as EFI implementation, and additionally supports extlinux scripts.

U-Boot runs in S-mode, thus it has to be used with an M-mode SBI implementation (OpenSBI, aka fw_jump.bin). The result is often combined into a single firmware file fw_payload.bin.

Latest recommended EFI firmware: fw_payload.bin

rvvm fw_payload.bin -i distro_image.img -m 2G

Running kernel payloads manually

Some users may wish to directly run a static Linux kernel payload via -k argument. It does still require OpenSBI, which may be either taken from their upstream release or downloaded here: fw_jump.bin

rvvm fw_jump.bin -k linux_6.10 -i rootfs.img

Recommended OS images

Arch RISC-V: archriscv.zip

rvvm fw_payload.bin -i archriscv.img -m 2G

Credentials: root:riscv

Debian (Lacks video drivers): debian.zip

rvvm fw_payload.bin -i debian.img -m 2G

Credentials: root:riscv

rvvm fw_payload.bin -i ubuntu-23.10-preinstalled-server-riscv64.img -m 2G -s 4

Press Enter over UART console when greeted with GRUB.

Credentials: ubuntu:ubuntu. This image is pretty bloated thus slow to boot.

rvvm fw_payoad.bin -i FreeBSD-13.3-STABLE-riscv-riscv64.raw -m 2G

Credentials: root:root. Run kldload if_re to load networking card driver.

Screenshots

Arch RISC-V guest running Plasma 6 graphical session in RVVM:

image

Buildroot guest running DOOM Shareware in RVVM:

image

Photo of RVVM guest rendering graphics on a physical GPU with VFIO PCI passthrough:

image

Clone this wiki locally