[vfio-users] Passthrough USB PCI Controller

Jayme Howard g.prime at gmail.com
Tue Oct 25 18:35:12 UTC 2016


I appreciate the patch, but it's not a great one for me to test,
personally.  My issue wasn't actually that I have two identical
controllers.  Rather, I have one specific controller that I sometimes want
to use on the host, so I don't want to assign it to the guest at boot of
the host.  That's why I actually use the script.  On a quick glance though
the patch looked solid to me, though I'm not a kernel dev.

On Tue, Oct 25, 2016 at 1:32 PM, Laszlo Ersek <lersek at redhat.com> wrote:

> On 10/25/16 16:30, Jayme Howard wrote:
> > I'm doing exactly this with no significant problem.  The way I handle it
> > is that I've got a script that binds the specific card to vfio-pci at
> > runtime, and I call that as a part of my startup script for the VM.
> >
> > /usr/local/bin/vfio-bind
> > #!/bin/bash
> >
> > modprobe vfio-pci
> >
> > for dev in "$@"; do
> >         vendor=$(cat /sys/bus/pci/devices/$dev/vendor)
> >         device=$(cat /sys/bus/pci/devices/$dev/device)
> >         if [ -e /sys/bus/pci/devices/$dev/driver ]; then
> >                 echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
> >         fi
> >         echo $vendor $device > /sys/bus/pci/drivers/vfio-pci/new_id
> > done
> >
> > Then I just add "-device vfio-pci,host=<address>" to the args to qemu.
> > Works like a charm.  The script is called with the format
> > "0000:06:00.0", the args to qemu are "06:00.0".  Your address may vary,
> > of course.
>
> I posted a kernel patch for this, and CC'd you guys on it. If you could
> test it, that would be great.
>
> The intended use is that you keep your current pci-stub.ids=... options,
> but add pci-stub.except=0000:03:00.0,... for those devices that you want
> pci-stub to ignore. This will cause 0000:03:00.0 to be bound by the
> appropriate host driver, while the rest of the ID- and class-matched
> devices will be claimed by pci-stub (and therefore they'll be eligible
> for assignment, assuming all other conditions are met).
>
> If I misunderstood the original problem (~ having two identical PCI USB
> controllers and intending to assign only one of them), then my bad.
>
> Thanks
> Laszlo
>
>
> > On Tue, Oct 25, 2016 at 6:11 AM, Andrei Grigore <andrei.grg at gmail.com
> > <mailto:andrei.grg at gmail.com>> wrote:
> >
> >     Hi,
> >
> >     Does anyone know of an easy way to pass through a USB PCI controller
> >     in QEMU w/o libvirt? Since libvirt automatically binds the
> >     controller to VFIO, without it I get VFIO not found error messages.
> >
> >     I am getting slightly better performance with a QEMU script rather
> >     than using virt-manager. I cannot bind them on boot since I have the
> >     same id for all USBs.
> >
> >     Thanks!
> >
> >
> >     _______________________________________________
> >     vfio-users mailing list
> >     vfio-users at redhat.com <mailto:vfio-users at redhat.com>
> >     https://www.redhat.com/mailman/listinfo/vfio-users
> >     <https://www.redhat.com/mailman/listinfo/vfio-users>
> >
> >
> >
> >
> > _______________________________________________
> > 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/20161025/3414e792/attachment.htm>


More information about the vfio-users mailing list