Multiple bhyve VMs

Hi,

When having multiple virtual machines run by bhyve, how does VirtIO works? Do you have a single backend (PCI device) that communicates with all frontends (driver)?

I am implementing a custom VirtIO device/driver pair and I am unsure how to handle this case correctly. I couldn't find any documentation online about this topic so if you know of any that you can point me to, I'd be very grateful. Thanks a lot!
 
I'm confused that someone who is implementing a device driver is asking this question...

VirtIO provides virtual devices. For example bhyve supports virtio-blk, which is a software based device that reads and writes to some sort of block device (usually a file) on the host. The device exposes an interface that is used by the standard virtio-blk driver in BSD/Linux/Windows/etc. If you have multiple guests, each guest will have independent virtio devices, and should be accessing different block devices on the host.

It's not clear, but it sounds like you are talking about using a single physical PCI device in multiple guests. In order to do this, the bhyve part of the code (the virtual "device") would need to be capable of talking to the real device and playing nicely with other bhyve instances doing the same thing. You'd then likely have to expose this device to the guest as either the original device (so the guest just assumes it's talking direct to the hardware, or via some guest device with an api and driver you also develop)

This isn't done with VirtIO. The closest is virtio-net, but in that case you will usually assign a virtual network device to each virtio-net instance, and the host handles traffic between those and physical adapters just using the standard networking stack. None of the virtio devices are directly mapping any host PCI hardware to a guest.
 
Back
Top