KVM pci passthrough in Centos 6.9 not working?

General support questions
Post Reply
matrix2020
Posts: 21
Joined: 2016/11/11 07:42:01

KVM pci passthrough in Centos 6.9 not working?

Post by matrix2020 » 2017/05/15 18:26:33

Trying to add a network card to a vm.
If I try through command line with qemu-kvm it just sits there doing nothing i.e the vm is not getting created.
When trying through monitor to add device after the guest booted, I get
Device 'pci-assign' could not be initialized

vt-d is enabled in grub, and I run the following 4 commands before attempting to do that:
echo "10ec 8168" > /sys/bus/pci/drivers/pci-stub/new_id
echo "0000:07:00.0" > /sys/bus/pci/devices/0000:07:00.0/driver/unbind
echo "0000:07:00.0" > /sys/bus/pci/drivers/pci-stub/bind
echo 1 > /sys/module/kvm/parameters/allow_unsafe_assigned_interrupts

Also selinux is completely disabled.
Any thoughts?

User avatar
TrevorH
Site Admin
Posts: 33215
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: KVM pci passthrough in Centos 6.9 not working?

Post by TrevorH » 2017/05/15 22:07:04

Did you try the upstream documentation? This https://access.redhat.com/documentation ... with_virsh is for CentOS 7 but I expect it'll either work or there'll be a /6/ version of the same thing somewhere on docs.redhat.com
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

matrix2020
Posts: 21
Joined: 2016/11/11 07:42:01

Re: KVM pci passthrough in Centos 6.9 not working?

Post by matrix2020 » 2017/05/16 09:34:12

Thanks.
It turned to be my stupidity actually.
Somehow I missed the part where you are supposed to add id to the command.
-device pci-assign,host=07:00.0,id=test is the command that worked.
Network adapter is correctly passed on to the VM and my network performance is back to 40mbit that I am supposed to have from my ISP :)
The thing is, the Centos/Redhat docs are useless to me, because I don't use virsh and am running cloudmin which generates command line options from the gui.
Unfortunately neither Centos nor kvm docs mention the fact that id is apparently obligatory.
I was trying just -device pci-assign,host=07:00.0 and sure enough it failed, but there were no indications as to why either in logs or dmesg.

Post Reply