[vfio-users] What's the differences between different ways for gpu passthrough

Zycorax Tokoroa zycorax at phoxden.xyz
Sat Apr 1 10:47:20 UTC 2017


> Hi,
> 
> I'm a newbie and I have tried many ways to passthrough the gpu to the
> guest. It works well but I found many guides is outdated. So I have
> some questions.
> 
> 1. How many ways to achieve the gpu passthrough nowadays, legacy vga
> via seabios、non-vga(UEFI) via OVMF? What's the differences between
> them?  Which one is the recommended way.
OVMF is generally easier to work with in that it deals with a
legacy-free system and does not require the VGA arbiter patch. Both
systems are however workable with and produce results. Note that by
using OVMF with a Windows guests imposes certain limitations, i.e. a
64bit version of windows greater than win7 is required (I think Vista
had only theoretical support for UEFI on 64bit, newer version of windows
might support it on 32bit as well?)
> 2. If I use legacy vga via seabios, should I apply the additional
> kernel patches(acs override path、i915 vga arbiter patch)? Does these
> patches will never be accepted by the upstream? So are there any linux
> distribution applied these patches. Is the VFIO_PCI_VGA kernel config
> necessary?
The patches can't be accepted upstream because the ACS override could
break things - it basically forces to split into different iommu groups
what is in fact in the same and could have DMA between devices. It is a
last, risky remedy to try if IOMMU groups don't split nicely.
IIRC the VGA arbiter patch is required at times as the i915 device
driver doesn't mark itself as a VGA handler, so if you use integrated
graphics and a passed-through discrete graphic card with seabios, you
will have corrupted graphics on the host. The patch is however not
applied upstream because it also disables certain hardware acceleration
provided by the i915 driver.
> 3. Which gpu passthrough method does ovirt、unraid and proxmox choose?
I'm not particularly familar with any of them as I've worked with
Debian, Ubuntu and Arch, setting them up on my own rather than using an
already built distribution. I believe they should allow to switch
between legacy and UEFI in the VM settings
> 4. When we talk about primary/secondary GPU passthrough, what does
> primary/secondary refer to, host gpu or guest gpu?
Primary and secondary refers to whether a given GPU is the one used and
initialized during boot. In the host, this is relevant because the VBIOS
copies itself to the system memory and can change itself in its
execution, resulting in the copy in ram to be different from the one in
the card's rom. If you want to pass through a primary GPU you need to
use a firmware dump in order to provide a clean VBIOS. Other caveats may
also apply.
In the guest, "secondary" only means that you have another device the VM
boots with, i.e. the emulated graphics. Certain GPU drivers, especially
on the NVidia side, might spot this and return a Code 43 error as they
use the presence of a different primary graphic device as proof they are
running in a virtualized environment (note: I haven't had this problem,
so I suppose it also depends on other factors, and don't think that the
distinction between primary and secondary in a guest actually carries
much practical meaning). Note also that Quadro GPUs, the ones supported
for passthrough, are made available as secondary GPUs in the official
way to set them up.




More information about the vfio-users mailing list