I am in the process of setting up VFIO with KVM. I have the VFIO itself working, in that the VFIO'd GPU displays the UEFI shell screen when I start the VM. I am also able to create a working Windows VM with VNC for graphics. My problem is that I create the VM with passthrough using qemu-system, and the one that fully boots I create using virt-install.

What I would like to do is use virt-install, but with the same PCI device as I passthrough with qemu-create, so I need to figure out how to translate the qemu-system argument to virt-install options (or virsh edit xml)

-device vfio-pci,host=42:00.0,multifunction=on \
-device vfio-pci,host=42:00.1 \

into virt-install arguments. However, the instructions I using for virt-install do not use the PCI ID, but rather domain, bus and slot, which are not shown in lspci and I am not sure how to check. So either I need to get that info and use it in a virt-install command, or find a way to use the PCI ID with virt-install.

Here are my two commands:

qemu system:

sudo qemu-system-x86_64 \
-name $vmname,process=$vmname \
-machine type=q35,accel=kvm \
-cpu EPYC,kvm=off \
-smp 4,sockets=1,cores=2,threads=2 \
-m 16G \
-balloon none \
-rtc clock=host,base=localtime \
-vga none \
-nographic \
-serial none \
-parallel none \
-device vfio-pci,host=42:00.0,multifunction=on \
-device vfio-pci,host=42:00.1 \
-drive if=pflash,format=raw,readonly,file=/usr/share/OVMF/OVMF_CODE.fd \
-drive if=pflash,format=raw,file=/usr/share/OVMF/OVMF_VARS.fd \
-boot order=dc \
#-drive id=disk0,if=virtio,cache=none,format=raw,file=/dev/nvme-tank/ntfs-zvol-part1 \
-drive file=/media/big-tank-8TB/OSISOS/Windows/WindowsOct2018.iso,index=1,media=cdrom \
-drive file=/media/big-tank-8TB/OSISOS/Windows/virtio-win-0.1.160.iso,index=2,media=cdrom 


virt-install \
--name myWINVM1 \
--ram 4096 \
--disk path=/dev/nvme-tank/ntfs-zvol-part1 \
--cpu core2duo \
--vcpus 4 \
--os-type windows \
--os-variant win10 \
--network bridge=virbr0 \
--graphics vnc \
--console pty,target_type=serial \
--disk /media/big-tank-8TB/OSISOS/Windows/WindowsOct2018.iso,device=cdrom,bus=ide \
--disk /media/big-tank-8TB/OSISOS/Windows/virtio-win-0.1.160.iso,device=cdrom,bus=ide 

It would also be OK to figure out how to make the qemu-system boot properly, but I like virt-install better because it makes a handy XML file that I can look at later.

1 Answer 1


I believe you are looking for the --hostdev option to virt-install. It can take a PCI bus location and other flags. The full list is show with:

virt-install --hostdev=?

The options needed for above should look like:

virt-install \
--name myWINVM1 \
--ram 4096 \
--hostdev 42:00.0,address.type=pci,address.multifunction=on \
--hostdev 42:00.1,address.type=pci \
  • Yes, that is what I was looking for! Unfortunately it seems I have other problems, but that is an issue for another thread (if I can't figure it out myself).
    – Stonecraft
    Commented Oct 27, 2018 at 0:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .