virtio: add support for vsock

The "run" command accepts a new option (--vsock <cid>) which specify the
guest CID. For instance:

  $ lkvm run --kernel ./bzImage --disk test --vsock 3

One can easily test by:

In the guest:

  # modprobe vsock
  # nc-vsock -l 1234

In the host:

  # modprobe vhost_vsock
  # nc-vsock 3 1234

This patch comes from the early submission of G. Campana. On this basis,
I fixed the compilation errors and runtime crashes. Thanks for the work
done by G. Campana.

Signed-off-by: G. Campana <>
Signed-off-by: Tianjia Zhang <>
Signed-off-by: Will Deacon <>
9 files changed