This tutorial endeavors to demonstrate the sequential steps required to construct and activate peripheral sharing on the Bao Hypervisor using the VirtIO interface.
Notes:
- The infrastructure is still in the development phase and is only being tested for ARM platforms (QEMU and ZCU102)
- These demo tutorials may contain errors/inaccuracies, as they are continually being updated
For any questions regarding the infrastructure, correction of an error in the tutorials or even any improvement/contribution to the VirtIO infrastructure itself, please send an email to joaopeixotooficial@gmail.com.
Clone the Bao Hypervisor VirtIO branch:
git clone git@github.com:bao-project/bao-hypervisor.git /path/to/your/bao-hypervisor --depth=1 --branch=wip/virtio
Clone the latest buildroot at the latest stable version:
git clone git@github.com:buildroot/buildroot.git /path/to/your/buildroot --depth=1 --branch=2023.08
cd /path/to/your/buildroot
There are availble two buildroot defconfig files:
- A defconfig with
INTRAMFS
enabled; - A defconfig with
INTRAMFS
disabled. This defcondig can be used if you want your Linux filesystem to be placed, for example, directly onto an SD Card (in this case you should untar the generated filesystem underoutput/images/rootfs.tar
onto your SD Card root partition).
Before applying the defoconfig changes, edit the BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE
entry to include your Linux configuration config file path.
If you want to manually configure your Linux, you must enable the option BAO_IO_DISPATCHER. To enable this feature, type make linux-menuconfig
and navigating to: Device Drivers > Virtualization Drivers > Bao Hypervisor I/O Dispatcher
.
Apply the buildroot defconfig changes:
make defconfig BR2_DEFCONFIG=/path/to/your/defconfig
Download Linux from the official repo:
git clone git@github.com:torvalds/linux.git /path/to/your/linux -depth=1 --branch=v6.5
cd /path/to/your/linux
Override the Linux source directory:
export LINUX_OVERRIDE_SRCDIR=/path/to/your/linux
To integrate the I/O Request Management System into Linux, apply the designated patch:
git apply 0001-linux-v6.5-backend-io-dispatcher.patch
Build your system with:
make linux-reconfigure all -j$(nproc)
For the VM frontend you can use any kernel that has VirtIO drivers for the device that you want to use. However, it is imperative to restrict the driver's memory access to a specific memory location, specifically tailored to the shared memory designated for passing VirtIO data information. Presently, if you are utilizing Linux, the approach has been implemented using the CONFIG_DMA_RESTRICTED_POOL
feature.
Presented below is a table detailing the description of each demo alongside its respective target platform.
Demo | PLATFORM | ARCH | FRONTEND DEVICE MODEL |
---|---|---|---|
Two Linux Guests accessing the same console | QEMU | aarch64 | QEMU |
A Linux Guest with network and storage interface | QEMU | aarch64 | QEMU |
A Linux Guest with virtual filesystem interface | QEMU | aarch64 | Bao VirtIO (Rust) |
Two Linux Guests accessing the same network interface | ZCU102/4 | aarch64 | Bao VirtIO (Rust) |
Inter-VM communication using Virtual Sockets | ZCU102/4 | aarch64 | Bao VirtIO (Rust) |