hermit-os / uhyve

A specialized hypervisor for Hermit.
Apache License 2.0
254 stars 29 forks source link

add basic virtio support #1

Open stlankes opened 4 years ago

stlankes commented 4 years ago
RealRichardParker commented 4 years ago

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.

stlankes commented 4 years ago

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

MatthewHinton56 commented 4 years ago

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?

stlankes commented 4 years ago

No, I think that you have to extend uhyve

MatthewHinton56 commented 4 years ago

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?

stlankes commented 4 years ago

Yes!

RealRichardParker commented 4 years ago

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

MatthewHinton56 commented 4 years ago

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?

stlankes commented 4 years ago

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.

MatthewHinton56 commented 4 years ago

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

BaderSZ commented 1 year ago

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.