[vfio-users] passthrough usb controler pci-e card ?

Frederick N. Brier fnbrier at gmail.com
Thu Jan 28 19:16:23 UTC 2016


I finally got my VM working with PCI passthrough for an nVidia card and 
a PCI-E USB controller card. So far, no problems.  Thank you Alex for 
all your wonderful blog and forum posts.  The use of TightVNC was 
invaluable.  My last niggling problem is automating two commands:

echo "0000:04:00.0" > /sys/bus/pci/devices/0000:04:00.0/driver/unbind
echo 0x1912 0x0014 > /sys/bus/pci/drivers/vfio-pci/new_id

I currently type them when the host system boots.  I tried putting them 
in a /sbin/vfio-pci-override-usb.sh script referenced in the 
/etc/dracut.conf.d/local.conf file with the line:

install_items+="/sbin/vfio-pci-override-usb.sh"

However, the kernel drive in use is still xhci_hcd, not vfio-pci, as it 
is after invoking the above two commands.  Where should these commands 
go to get executed at boot?  Thank you.

Fred

On 01/19/2016 03:21 AM, thibaut noah wrote:
> Update note, i found what prevent my card from running, basically i 
> need to reboot without anything plug into the card and then i can 
> unbind and rebind the card, what that strange behaviour?
>
> 2016-01-19 11:35 GMT+01:00 thibaut noah <thibaut.noah at gmail.com 
> <mailto:thibaut.noah at gmail.com>>:
>
>     Bumping this, running virsh nodedev-detach pci_0000_xx_yy_z' 
>     (with proper numbers) and/or having managed=yes in the xml file
>     changes nothing (actually i had this already), ovmf still hangs
>     waiting for i have no idea what.
>     Cannot run by unbinding the device through script either, seems
>     that i was lucky, or maybe i did something that i forgot.
>     Tried to add nodedev-detach to modprobe but it seems that i did
>     not do it in the proper way so it wasn't working
>
>     2016-01-16 11:30 GMT+01:00 thibaut noah <thibaut.noah at gmail.com
>     <mailto:thibaut.noah at gmail.com>>:
>
>         Didn't know libvirt was capable of unbinding devices on its
>         own, good to know, i'm gonna try this and if i manage to make
>         it work i don't have any reason to bother myself more with
>         this. (note that i don't use virt-manager since you advise me
>         to use libvirt directly)
>         Though the usb card will only be use by the vm, i have more
>         than enough usb ports on my backpanel.
>
>         Tried the gpu method by adding the id of the device in
>         modprobe.d after gpu's ids but it didn't work.
>
>         I paid it 50euros :(
>         Thanks for the explanations alex
>
>
>         2016-01-15 18:59 GMT+01:00 Alex Williamson
>         <alex.williamson at redhat.com <mailto:alex.williamson at redhat.com>>:
>
>             A couple comments, first, boot time pre-binding to
>             vfio-pci is really
>             only necessary for devices where the native host drivers
>             behave poorly
>             if you take the device away from them later.  This is why
>             we do it for
>             GPUs and their companion sound device, host GPU drivers
>             don't like to
>             give up the device, it plays poorly with any sort of
>             graphics on the
>             host, and sequestering the audio device prevents host
>             tools from
>             getting confused (and there are some bugs in the audio
>             driver limiting
>             number of attach/detach cycles iirc).
>
>             For anything else, you can dynamically unbind the device
>             from the host
>             driver, bind it to vfio while the VM is running, and give
>             it back to
>             the host on shutdown.  libvirt will do this automatically
>             for you if
>             your XML sets managed='yes' for the <hostdev> device. 
>             This is the default, so if you use virt-manager to add the
>             device, just select Add Hardware -> PCI Host Device ->
>             select device -> Finish.  Done.  If for some reason you
>             don't want the device flopping back and forth between host
>             and guest, just run 'virsh nodedev-detach
>             pci_0000_xx_yy_z' at bootup where xx_yy_z is the PCI bus
>             (xx), device (yy), and function (z) numbers, the same as
>             in lspci.  You can adopt some of the GPU methods for doing
>             this if you want it to happen earlier as well, there are
>             lots of ways to do this with modprobe.d (install options,
>             softdep, etc..)
>
>             Finally, yes I've seen OVMF hang with some crappy USB
>             controllers.  I'm
>             not sure if it's dependent on the devices attached or the
>             controller
>             itself, but cheaper isn't always better when it comes to
>             selecting
>             devices to use with device assignment. Thanks,
>
>             Alex
>
>
>
>
>
>
> _______________________________________________
> vfio-users mailing list
> vfio-users at redhat.com
> https://www.redhat.com/mailman/listinfo/vfio-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/vfio-users/attachments/20160128/a4061a72/attachment.htm>


More information about the vfio-users mailing list