This is an old revision of the document!
Table of Contents
vms pci passthrough
Using vms for pci passthrough. This example is for a graphics card, but it will work for any PCI device. This has been tested for qemu guests running linux, Windows and macOS.
Setup the virtual machine
Install vms and setup a virtual machine as described here https://docs.slackware.com/howtos:emulators:vms
Continue and install the guest OS. Install any updates on the guest OS you want. Things are easier to troubleshoot when the guest is setup and updated without the passthrough
PCI passthrough
It is easier and more trouble free to have a regular emulated standard vga for qemu and use the real graphics card as a second one for the guest.
For AMD systems add these kernel options to the append line in /etc/lilo.conf
iommu=pt iommu=1
For Intel systems add this kernel option to the append line in /etc/lilo.conf
intel_iommu=on
Find the device you want to passthrough, eg.
# lspci | grep VGA 07:00.0 VGA compatible controller: Advanced Micro Devices, Inc...
The interesting part is 07:00.0
Setup the 07:00.0 card for vfio-pci like this as root
/usr/sbin/vfio-bind 07:00.0
You can add the line above to /etc/rc.d/rc.local to automatically set the 07:00.0 card during boot.
Assuming your virtual machine is called vm1 stop it and configure it like this
vms conf vm1 extra10 "'-device vfio-pci,host=07:00.0'"
Also, it is recommended to configure a mouse and a keyboard like this
vms conf vm1 extra09 "'-usb -device usb-kbd -device usb-mouse'"
Then start vm1 like this
vms start vm1
Your gfx card should be available in the guest. You can go on and install a regular driver if needed. Using the same logic you can pass any PCI device, like a sound card or a USB controller
Sources
Originally written by Nikos Giotis