Share one NVIDIA GPU between a Linux host and Linux VMs, without VFIO passthrough
The project GitHub - reindertpelsma/nvkvm-pv: Paravirtual NVIDIA GPU for KVM guests — run unmodified CUDA, PyTorch and Vulkan inside a VM at host parity, on a GPU the host keeps using. No passthrough, no vGPU licence. Experimental. · GitHub allows you to run KVM VMs with full NVIDIA driver support, without VFIO.
The project forwards NVIDIA’s driver API to the VM with native performance. The idea is to get the CUDA container experience in VMs, on GeForce cards where this isn’t available at all.
Experimental, several months, solo. Any bug reports, contributions, architectures/GPUs it worked on are welcome. Currently only Linux amd64 guests with glibc; any distro should work.
How it works: Guest kernel module → virtio → QEMU → a per-guest process stub to execute the NVIDIA API on the host → host NVIDIA driver. RM/UVM ioctls are forwarded, not emulated. GPU memory (DMA/BAR) is actual passthrough, not emulated or copied, using regular unprivileged NVIDIA userspace calls.
Display is forwarded as natively as possible. The VM gets a KMS plane (rendering target) from the host display compositor, for example Wayland, and it renders without any cross CPU-GPU copy (unless your display output is on integrated graphics).
Supports CUDA, graphics and display, also intended for compute workloads beyond gaming and graphics.
Geekbench 7 GPU (OpenCL): RTX 4070 99.6%, RTX 3050 Laptop 99.9%, H100 PCIe 98.8%, A100 80GB 98.0%. clpeak: 7 of 8 subtests at 99.4–100.2%. Not everything is parity; some performance issues are still open, for example kernel launch latency is 8.18µs compared to 3.84µs on bare metal.
Running Red Dead Redemption 2 in a KVM guest:
Docker example, running a headless KVM guest
docker run --rm -it --device /dev/kvm --gpus all \
-e NVIDIA_DRIVER_CAPABILITIES=compute,utility,graphics,display,video \
-p 127.0.0.1:2222:2222 -v nvkvm-guest:/opt/nvkvm-guest \
ghcr.io/reindertpelsma/nvkvm-pv:v0.2.5
ssh -p 2222 ubuntu@127.0.0.1 # password is ubuntu
It can also be built using docker build -t nvkvm-pv . from the git repository.