<p dir="ltr">I've tried the script solution and it works perfectly. Thanks!!</p>
<p dir="ltr">I will also try to test the kernel module and let you know how it works.</p>
<div class="gmail_extra"><br><div class="gmail_quote">On Oct 25, 2016 20:35, "Jayme Howard" <<a href="mailto:g.prime@gmail.com">g.prime@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">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.</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 25, 2016 at 1:32 PM, Laszlo Ersek <span dir="ltr"><<a href="mailto:lersek@redhat.com" target="_blank">lersek@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On 10/25/16 16:30, Jayme Howard wrote:<br>
> I'm doing exactly this with no significant problem.  The way I handle it<br>
> is that I've got a script that binds the specific card to vfio-pci at<br>
> runtime, and I call that as a part of my startup script for the VM.<br>
><br>
> /usr/local/bin/vfio-bind<br>
> #!/bin/bash<br>
><br>
> modprobe vfio-pci<br>
><br>
> for dev in "$@"; do<br>
>         vendor=$(cat /sys/bus/pci/devices/$dev/vend<wbr>or)<br>
>         device=$(cat /sys/bus/pci/devices/$dev/devi<wbr>ce)<br>
>         if [ -e /sys/bus/pci/devices/$dev/driv<wbr>er ]; then<br>
>                 echo $dev > /sys/bus/pci/devices/$dev/driv<wbr>er/unbind<br>
>         fi<br>
>         echo $vendor $device > /sys/bus/pci/drivers/vfio-pci/<wbr>new_id<br>
> done<br>
><br>
> Then I just add "-device vfio-pci,host=<address>" to the args to qemu.<br>
> Works like a charm.  The script is called with the format<br>
> "0000:06:00.0", the args to qemu are "06:00.0".  Your address may vary,<br>
> of course.<br>
<br>
</span>I posted a kernel patch for this, and CC'd you guys on it. If you could<br>
test it, that would be great.<br>
<br>
The intended use is that you keep your current pci-stub.ids=... options,<br>
but add pci-stub.except=0000:03:00.0,.<wbr>.. for those devices that you want<br>
pci-stub to ignore. This will cause 0000:03:00.0 to be bound by the<br>
appropriate host driver, while the rest of the ID- and class-matched<br>
devices will be claimed by pci-stub (and therefore they'll be eligible<br>
for assignment, assuming all other conditions are met).<br>
<br>
If I misunderstood the original problem (~ having two identical PCI USB<br>
controllers and intending to assign only one of them), then my bad.<br>
<br>
Thanks<br>
Laszlo<br>
<span><br>
<br>
> On Tue, Oct 25, 2016 at 6:11 AM, Andrei Grigore <<a href="mailto:andrei.grg@gmail.com" target="_blank">andrei.grg@gmail.com</a><br>
</span><span>> <mailto:<a href="mailto:andrei.grg@gmail.com" target="_blank">andrei.grg@gmail.com</a>>> wrote:<br>
><br>
>     Hi,<br>
><br>
>     Does anyone know of an easy way to pass through a USB PCI controller<br>
>     in QEMU w/o libvirt? Since libvirt automatically binds the<br>
>     controller to VFIO, without it I get VFIO not found error messages.<br>
><br>
>     I am getting slightly better performance with a QEMU script rather<br>
>     than using virt-manager. I cannot bind them on boot since I have the<br>
>     same id for all USBs.<br>
><br>
>     Thanks!<br>
><br>
><br>
>     _____________________________<wbr>__________________<br>
>     vfio-users mailing list<br>
</span>>     <a href="mailto:vfio-users@redhat.com" target="_blank">vfio-users@redhat.com</a> <mailto:<a href="mailto:vfio-users@redhat.com" target="_blank">vfio-users@redhat.com</a>><br>
>     <a href="https://www.redhat.com/mailman/listinfo/vfio-users" rel="noreferrer" target="_blank">https://www.redhat.com/mailma<wbr>n/listinfo/vfio-users</a><br>
>     <<a href="https://www.redhat.com/mailman/listinfo/vfio-users" rel="noreferrer" target="_blank">https://www.redhat.com/mailm<wbr>an/listinfo/vfio-users</a>><br>
<div class="m_-1656654058104274235HOEnZb"><div class="m_-1656654058104274235h5">><br>
><br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> vfio-users mailing list<br>
> <a href="mailto:vfio-users@redhat.com" target="_blank">vfio-users@redhat.com</a><br>
> <a href="https://www.redhat.com/mailman/listinfo/vfio-users" rel="noreferrer" target="_blank">https://www.redhat.com/mailman<wbr>/listinfo/vfio-users</a><br>
><br>
<br>
</div></div></blockquote></div><br></div>
</blockquote></div></div>