PCI Passthrough PVE4 Beta2 Error

churnd

Active Member
Aug 11, 2013
43
2
28
I had passthrough working on PVE4 Beta1 thanks to adding pci_stub to /etc/modules per http://forum.proxmox.com/threads/22850-Issue-Can-t-PCI-Passthrough-on-Proxmox-4-0-Beta1

Now I'm running into a different issue with Beta2 after I upgraded. As far as I can tell, everything it the same... pci_stub module is loaded, IOMMU is enabled, VM config file has the same configuration pointing to the right PCI device as per lspci.

However when I start the VM, I get this:

Code:
Running as unit 100.scope.
kvm: -device pci-assign,host=01:00.0,id=hostpci0,bus=pci.0,addr=0x10: Failed to assign device "hostpci0": Invalid argument
TASK ERROR: start failed: command '/usr/bin/systemd-run --scope --slice qemu --unit 100 -p 'CPUShares=1000' /usr/bin/kvm -id 100 -chardev 'socket,id=qmp,path=/var/run/qemu-server/100.qmp,server,nowait' -mon 'chardev=qmp,mode=control' -vnc unix:/var/run/qemu-server/100.vnc,x509,password -pidfile /var/run/qemu-server/100.pid -daemonize -smbios 'type=1,uuid=654b4b5e-b72b-4a4f-a012-01091568391f' -name FreeNAS -smp '2,sockets=1,cores=2,maxcpus=2' -nodefaults -boot 'menu=on,strict=on,reboot-timeout=1000' -vga cirrus -cpu kvm64,+lahf_lm,+sep,+kvm_pv_unhalt,+kvm_pv_eoi,enforce -m 4096 -k en-us -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' -device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f' -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' -device 'pci-assign,host=01:00.0,id=hostpci0,bus=pci.0,addr=0x10' -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3' -iscsi 'initiator-name=iqn.1993-08.org.debian:01:dd2e9b4777f' -drive 'file=/dev/ssd/vm-100-disk-1,if=none,id=drive-virtio1,format=raw,cache=none,aio=native,detect-zeroes=on' -device 'virtio-blk-pci,drive=drive-virtio1,id=virtio1,bus=pci.0,addr=0xb' -drive 'file=/dev/san/vm-100-disk-1,if=none,id=drive-virtio0,format=raw,cache=none,aio=native,detect-zeroes=on' -device 'virtio-blk-pci,drive=drive-virtio0,id=virtio0,bus=pci.0,addr=0xa,bootindex=101' -netdev 'type=tap,id=net0,ifname=tap100i0,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on' -device 'virtio-net-pci,mac=82:72:F3:93:E5:F5,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=300' -netdev 'type=tap,id=net1,ifname=tap100i1,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on' -device 'virtio-net-pci,mac=D2:C8:54:CD:E8:DD,netdev=net1,bus=pci.0,addr=0x13,id=net1,bootindex=301'' failed: exit code 1

I tried adding
Code:
pcie=1,driver=vfio
&
Code:
machine: q35
but it causes the VM to hang up halfway through boot. Any tips appreciated.
 
I'm also getting this on BETA 2. Shame there are no replies. Did you manage to fix it and if so, how?
 
Seem that since kernel 4.2, CONFIG_KVM_DEVICE_ASSIGNMENT is deprecated and disable in kernel.

That mean than only vfio method is working. (and should work, as it's should give us better security and less crash than classic method).


so, you should use : hostpci0: ....,driver=vfio

using machine:q35 and hostpci0: ....,pcie=1,driver=fio is optionnal , only if you wan to passthough pci express card.

 
so, you should use : hostpci0: ....,driver=vfio
Thanks for the info, but I'm not sure what you mean. Do you mean I need to add a line like this to the vmnumber.conf file:

hostpci0: 05:02.2,driver=vfio

If that's all that's required it sounds easy - and too good to be true.
 
If that's all that's required it sounds easy - and too good to be true..

Well, it should be like this. now maybe they are still kernel or kvm bug, I really don't known.
pci passthourgh is really complex, and depend of a lot of hardware implementations of iommu.

I think we'll make the driver=vfio the default for the beta3, as this is the only way with newer kernel.
 
Can confirm that simply adding "driver=vfio" fixed this for me. I think I tried to add too many options (machine:q35, pcie=1) the first time around. Not sure what the q35 machine stands for, but my PCI card is definitely PCI-E. Should I try to get the pci-e option working? Any benefits?
 
May i ask what device you are passthrough? TVcard or graphiccard...?
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!