Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
erichchan999 committed Feb 7, 2024
1 parent 2a2edae commit 5ee7c12
Showing 1 changed file with 32 additions and 26 deletions.
58 changes: 32 additions & 26 deletions examples/virtio_blk/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Using virtIO with multiple Linux guests
# Using virtIO block with driver VM

This example shows off the virtIO support that libvmm provides using the
[seL4 Device Driver Framework](https://github.com/au-ts/sddf) to talk to the
actual hardware.
[seL4 Device Driver Framework](https://github.com/au-ts/sddf) to talk to a linux block driver VM that has passthrough access to the actual hardware.

The example currently works on the following platforms:
* QEMU ARM virt
Expand All @@ -29,33 +28,40 @@ system running the whole system.

## Running

### virtIO console
This example consist of a guest linux client VM that talks virtIO with a backend that consists of a driver VM that has passthrough access to the block device. For debugging purposes, both client and driver VMs also use virtIO serial connected to a serial system in a similar set up to the [virtio](https://github.com/au-ts/libvmm/blob/main/examples/virtio/README.md) example.

This example makes use of the virtIO console device so that neither guest has access
to any serial device on the platform. The virtIO console support in libvmm talks to
a serial multiplexor which then talks to a driver for input/output to the physical
serial device.
When you boot the example, you will see different coloured output for each guest. The block driver VM in red will boot first. When it is ready, the client VM in green will boot.

When you boot the example, you will see different coloured output for each guest. The
Linux logs will be interleaving like so:
After the block client VM boots it will attempt to mount the virtIO block device `/dev/vda`. The block device contains an ext4 filesystem allowing us to test it using block benchmark programs like `postmark`, which has been included in `/root`.

Client VM requests to the virtIO block device will print out debugging messages.
```
Starting klogd: OKStarting klogd:
OK
Running sysctl: Running sysctl: OK
OKSaving random seed:
Saving random seed: [ 4.070358] random: crng init done
[ 4.103992] random: crng init done
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
Saving random seed: [ 18.959300] random: crng init done
OK
Starting network: OK
Starting network: OK
OK
Welcome to Buildroot
buildroot login:
Welcome to Buildroot
buildroot login:
VIRTIO(BLOCK): ------------- Driver notified device -------------
VIRTIO(BLOCK): ----- Request type is 0x0 -----
VIRTIO(BLOCK): Request type is VIRTIO_BLK_T_IN
VIRTIO(BLOCK): Sector (read/write offset) is 2
VIRTIO(BLOCK): Descriptor index is 1, Descriptor flags are: 0x3, length is 0x400
UIO_DRIVER: received irq, count: 2
UIO_DRIVER(BLOCK): Received command: code=0, addr=0x30601000, block_number=1, count=1, id=1
VIRTIO(BLOCK): ------------- Driver notified device -------------
VIRTIO(BLOCK): ----- Request type is 0x0 -----
VIRTIO(BLOCK): Request type is VIRTIO_BLK_T_IN
VIRTIO(BLOCK): Sector (read/write offset) is 0
VIRTIO(BLOCK): Descriptor index is 1, Descriptor flags are: 0x3, length is 0x1000
UIO_DRIVER: received irq, count: 3
UIO_DRIVER(BLOCK): Received command: code=0, addr=0x30601400, block_number=0, count=4, id=2
...
...
...
[ 19.708718] EXT4-fs (vda): mounted filesystem without journal. Quota mode: none.
```

You will notice that we have two Buildroot login prompts, initially all input is defaulted
to the guest one (in red). To switch to input into the other guest (green), type in `@2`.
The `@` symbol is used to switch between clients, in this case the green guest is client 2.
Similar to the [virtio](https://github.com/au-ts/libvmm/blob/main/examples/virtio/README.md) example, initially all input is defaulted to the client VM (in green). To switch input to the driver VM (in red), type in `@2`. The `@` symbol is used to switch between clients of the serial system.


0 comments on commit 5ee7c12

Please sign in to comment.