uhyve icon indicating copy to clipboard operation
uhyve copied to clipboard

add basic virtio support

Open stlankes opened this issue 5 years ago • 11 comments

  • Add virtio support in Uhyve
  • Analysis of crates provided by rust_vmm. Maybe it is the easiest ways to support virtio.

stlankes avatar Nov 09 '19 09:11 stlankes

By add virtio support, does that mean we need to extend uhyve to support PCI devices? Or will this be done through shared memory?

We've been looking through crates, and kvm-ioctl and kvm-bindings should be all we need to support virtio.

RealRichardParker avatar Nov 18 '19 21:11 RealRichardParker

What do you mean by shared memory? Hm, I thought that by scanning the IO address space uhyve jump to https://github.com/hermitcore/uhyve/blob/master/src/linux/vcpu.rs#L274

stlankes avatar Nov 18 '19 21:11 stlankes

Currently when the pci scan is initiated in libhermit. It jumps to Uhvye Unknown exit reason rather than handle the exit. Currently Uhyve does not handle PCI_CONFIG_ADDRESS_PORT and PCI_CONFIG_DATA_PORT. Are we adding PCI support to Uhvye, or are we connecting the virtio device differently?

MatthewHinton56 avatar Nov 18 '19 21:11 MatthewHinton56

No, I think that you have to extend uhyve

stlankes avatar Nov 18 '19 21:11 stlankes

Our first goal is to emulate the PCI bus by providing the address and data port catches in Uhvye. This will allow for PCI devices to be detected by libhermit. From there, we will construct a virtio device around it. Does this work?

MatthewHinton56 avatar Nov 18 '19 21:11 MatthewHinton56

Yes!

stlankes avatar Nov 18 '19 21:11 stlankes

Is there a driver that we should model our device after?

RealRichardParker avatar Nov 20 '19 19:11 RealRichardParker

Should we add mmio support next for the virtio device? If so, is there a specific region of memory you would wish the device to use?

MatthewHinton56 avatar Nov 25 '19 18:11 MatthewHinton56

I think that MMIO isn't not necessary. I don't use it in in me C driver. As far as I remember it correctly.

stlankes avatar Nov 26 '19 07:11 stlankes

Oh, I misspoke. What values should we assign the base registers for iobase, iomem and the irq? Do you have preference?

MatthewHinton56 avatar Nov 26 '19 18:11 MatthewHinton56

virtio-queue is definitely worth a look and I will take care of this in my draft implementation.

Side note: GuestMemoryMmap does look like an interesting alternative for the in-house struct.

BaderSZ avatar May 29 '23 01:05 BaderSZ