Cloud Hypervisor with virtio-gpu support

This is a patchset for Cloud Hypervisor support providing a virtio-gpu device to guests, using crosvm’s virtio-gpu implementation over vhost-user.

If this patchset is useful to you, please consider donating to support its continued development via either GitHub Sponsors or LiberaPay.

The patches as developed as part of Spectrum, a compartmentalized desktop operating system project.

Building

It’s necessary to patch both Cloud Hypervisor itself, and the vhost crate. The Cloud Hypervisor patches expect to find the patched vhost source tree under the same parent directory as Cloud Hypervisor’s.
  1. Clone the repositories for Cloud Hypervisor and vhost. Make sure the revision of the vhost repository you have checked out contains the versions of the vhost and vhost-user-backend crates expected by your version of Cloud Hypervisor.
  2. Download and apply the patches for the correct versions of Cloud Hypervisor and vhost.
  3. Use cargo build in the Cloud Hypervisor source tree as normal.

Usage example

Start the crosvm GPU device:
crosvm device gpu --socket gpu.sock
Connect to the GPU device with cloud-hypervisor:
cloud-hypervisor --gpu socket=gpu.sock …

Downloads

  1. cloud-hypervisor-38.0-spectrum0-patches.tar.xz
  2. cloud-hypervisor-37.0-spectrum0-patches.tar.xz

Contributing

The patches are maintained in Spectrum’s git repository. Please refer to the documentation for contributing to Spectrum.

Can these patches be upstreamed?

I don’t think so. The Cloud Hypervisor developers are not very interested in GPU support — although perhaps an implementation that was just a vfio-user frontend implementation, deletaging all of the complexity of rendering, input handling, etc. to another process would be light enough to overcome that — but on top of that, communicating with crosvm’s GPU device requires using non-standard commands that are not part of the vhost-user specification.

It’s possible that, in future, it might be possible to use an external virtual GPU device with an unmodified Cloud Hypervisor using vfio-user or VHOST_USER_PROTOCOL_F_PROBE, or that at least the custom vhost-user commands could be standardized.

Other Cloud Hypervisor work is regularly upstreamed as part of the Spectrum project.

Bug reports and other questions

Bug reports for and other questions about the patchset are welcome! You can send mail to the discuss@spectrum-os.org mailing list, or ask in the Spectrum Matrix chat.


Permission is granted to copy, distribute and/or modify this document under either the terms of the Creative Commons Attribution-ShareAlike 4.0 International License, or the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.

Impressum