talex5 / wayland-proxy-virtwl

Allow guest VMs to open windows on the host
Apache License 2.0
110 stars 12 forks source link

FR: Xen support #85

Open DemiMarie opened 3 months ago

DemiMarie commented 3 months ago

Parts of virtio-GPU can straightforwardly (if not easily) be implemented on Xen, but mapping host-allocated buffers into the guest isn't supported yet and so there will need to be a workaround.

talex5 commented 3 months ago

Currently (without GPU acceleration), buffers are allocated by guest applications and ideally would be shared with the host. But for some reason crosvm doesn't support that, so we allocate host memory and copy the data across manually. If Xen can pass guest memory to the host then that probably simplifies things:

https://github.com/talex5/wayland-proxy-virtwl/blob/1c0cd6d4f13454f0c72148b4c4a1c1e3b728205e/relay.ml#L208-L211

DemiMarie commented 3 months ago

Xen can easily share guest memory with the host, but there are two caveats:

  1. The current kernel API requires that the memory be allocated specifically for sharing, so a copy will still be needed. This can likely be fixed by a new ioctl that takes a FOLL_LONGTERM pin on the memory.
  2. The host needs to know how to map the memory. crosvm doesn’t support that.