Jump to content
archedraft

***GUIDE*** Passthrough Entire PCI USB Controller

507 posts in this topic Last Reply

Recommended Posts

7 hours ago, saarg said:

unraid usb on the same usb controllers that you use vfio-pci.ids on

I have 3 USB 3.0 controllers with legacy support. I also have XHCI enabled in my BIOS. My motherboard has 2x 2.0 ports and 4x 3.0 ports. Unraid is plugged into a 2.0 port

 

07:00.1 USB controller: Advanced Micro Devices, Inc. [AMD] Matisse USB 3.0 Host Controller
07:00.3 USB controller: Advanced Micro Devices, Inc. [AMD] Matisse USB 3.0 Host Controller
0c:00.3 USB controller: Advanced Micro Devices, Inc. [AMD] Matisse USB 3.0 Host Controller

My Unraid's on Bus 1 (IOMMU Group 21 —07:00.1), whereas the Genesys USB Hub is on Bus 6 (Group 31 — 0c:00.3). 

 

How might I solve for this?

 

 

Share this post


Link to post
4 hours ago, vvolfpack said:

I have 3 USB 3.0 controllers with legacy support. I also have XHCI enabled in my BIOS. My motherboard has 2x 2.0 ports and 4x 3.0 ports. Unraid is plugged into a 2.0 port

 


07:00.1 USB controller: Advanced Micro Devices, Inc. [AMD] Matisse USB 3.0 Host Controller
07:00.3 USB controller: Advanced Micro Devices, Inc. [AMD] Matisse USB 3.0 Host Controller
0c:00.3 USB controller: Advanced Micro Devices, Inc. [AMD] Matisse USB 3.0 Host Controller

My Unraid's on Bus 1 (IOMMU Group 21 —07:00.1), whereas the Genesys USB Hub is on Bus 6 (Group 31 — 0c:00.3). 

 

How might I solve for this?

 

 

You can't use the stubbing method you used as all your USB controllers have the same ID.

So you need to look at the new method of stubbing using the PCI ID. I don't remember which release it was added, but go through the release announcements to find it. Might have been 6.8, but might have been in one of the 6.7 releases.

Share this post


Link to post
11 hours ago, saarg said:

So you need to look at the new method of stubbing using the PCI ID. I don't remember which release it was added, but go through the release announcements to find it. Might have been 6.8, but might have been in one of the 6.7 releases.

Thanks for the help, saarg! I followed your suggestion and looked up the 6.7 release which led me to this awesome thread. Worked for both, the GPU and the USB hub.

Share this post


Link to post

Good day all!

 

First of all, thank you very much for this guide! It was very helpful, though I am experiencing an error when I add the hostdev lines of code to the XML file:

 

Quote

Execution error
internal error: Non-endpoint PCI devices cannot be assigned to guests

 

I just installed a PCIe USB3.0 card in my unraid system since the onboard ports have not been playing nicely with anything I plug into them. I've got a W10 VM set up and running nicely that I want to game with. There's a GTX1070 already passed through and I am able to run Dirt Rally 2.0 on my tv and a G27 wheel.

 

Since we're social distancing now, I picked up an Oculus Rift and am having trouble getting it detected in the VM.

 

If I use the VM settings GUI to set up the USB passthrough for all devices (KB, mouse, wheel, Rift headset and Rift sensor), only the Rift headset is not detected within the VM W10 guest (KB, mouse, wheel and Rift sensor all detect fine).

 

I was hoping to pass the USB PCIe card to benefit from USB PnP which would then solve my Rift issue.

 

Here are the results of the steps I followed in the OP:

 

ls | grep USB

Quote


00:14.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller (rev 04)
00:1a.0 USB controller: Intel Corporation 7 Series/C216 Chipset Family USB Enhanced Host Controller #2 (rev 04)
00:1d.0 USB controller: Intel Corporation 7 Series/C216 Chipset Family USB Enhanced Host Controller #1 (rev 04)
04:00.0 USB controller: Fresco Logic FL1100 USB 3.0 Host Controller (rev 10)
05:00.0 USB controller: VIA Technologies, Inc. VL80x xHCI USB 3.0 Controller (rev 03)

 

 

lsusb

Quote

Bus 006 Device 005: ID 0781:558b SanDisk Corp. Extreme **my test USB key in 1st slot**
Bus 006 Device 006: ID 0781:558b SanDisk Corp. Extreme **my test USB key in 2nd slot**
Bus 005 Device 003: ID 046d:c294 Logitech, Inc. Driving Force **in 3rd**
Bus 005 Device 005: ID 413c:2003 Dell Keyboard **4th**
Bus 005 Device 004: ID 1532:0001 Razer Diamondback **5th**


readlink /sys/bus/usb/devices/usb5

Quote

../../../devices/pci0000:00/0000:00:1c.1/0000:04:00.0/usb5

readlink /sys/bus/usb/devices/usb6

Quote

../../../devices/pci0000:00/0000:00:1c.1/0000:04:00.0/usb6

 

PCIe ACS override is ENABLED

Quote

IOMMU group 8:    [8086:1e12] 00:1c.1 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 2 (rev c4)

 

The lines I added to my XML file:

Quote

    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x00' slot='0x1c' function='0x1'/>
      </source>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x00' slot='0x1c' function='0x4'/>
      </source>
    </hostdev>

 

Without those two hostdev entries (or even just one) I get the error above. Here is my XML file in whole:

Quote

<?xml version='1.0' encoding='UTF-8'?>
<domain type='kvm'>
  <name>Player2</name>
  <uuid>bc7b1d2e-b6e2-bf90-72d2-dd34d956efae</uuid>
  <description>Prodigal son returns</description>
  <metadata>
    <vmtemplate xmlns="unraid" name="Windows 10" icon="windows.png" os="windows10"/>
  </metadata>
  <memory unit='KiB'>8912896</memory>
  <currentMemory unit='KiB'>8912896</currentMemory>
  <memoryBacking>
    <nosharepages/>
  </memoryBacking>
  <vcpu placement='static'>6</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='1'/>
    <vcpupin vcpu='1' cpuset='5'/>
    <vcpupin vcpu='2' cpuset='2'/>
    <vcpupin vcpu='3' cpuset='6'/>
    <vcpupin vcpu='4' cpuset='3'/>
    <vcpupin vcpu='5' cpuset='7'/>
  </cputune>
  <os>
    <type arch='x86_64' machine='pc-i440fx-4.2'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/qemu/ovmf-x64/OVMF_CODE-pure-efi.fd</loader>
    <nvram>/etc/libvirt/qemu/nvram/bc7b1d2e-b6e2-bf90-72d2-dd34d956efae_VARS-pure-efi.fd</nvram>
  </os>
  <features>
    <acpi/>
    <apic/>
    <hyperv>
      <relaxed state='on'/>
      <vapic state='on'/>
      <spinlocks state='on' retries='8191'/>
      <vendor_id state='on' value='none'/>
    </hyperv>
  </features>
  <cpu mode='host-passthrough' check='none'>
    <topology sockets='1' cores='3' threads='2'/>
  </cpu>
  <clock offset='localtime'>
    <timer name='hypervclock' present='yes'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/local/sbin/qemu</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source file='/mnt/user/domains/Player2/vdisk1.img'/>
      <target dev='hdc' bus='virtio'/>
      <boot order='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/isos/Windows10.iso'/>
      <target dev='hda' bus='ide'/>
      <readonly/>
      <boot order='2'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/isos/virtio-win-0.1.173-2.iso'/>
      <target dev='hdb' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'/>
    <controller type='usb' index='0' model='qemu-xhci' ports='15'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:8a:23:d9'/>
      <source bridge='br0'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target type='isa-serial' port='0'>
        <model name='isa-serial'/>
      </target>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <channel type='unix'>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='tablet' bus='usb'>
      <address type='usb' bus='0' port='3'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <sound model='ich9'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </sound>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x02' slot='0x00' function='0x1'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x00' slot='0x1b' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </hostdev>

    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x00' slot='0x1c' function='0x1'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x00' slot='0x1c' function='0x4'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
    </hostdev>

    <memballoon model='none'/>
  </devices>
</domain>

 

I appreciate all ideas! Thanks

Share this post


Link to post

There isn't really a need to do it this way anymore.

If the usb card have its own ID (4 digits:4 digits) then you can stub the card in the syslinux.conf file and then choose the card in the other PCI devices part in the VM template.

If the usb card shares an ID with a USB controller on the motherboard, you have to use the new method of stubbing the card using a config file and the PCI number.

Share this post


Link to post
4 hours ago, saarg said:

There isn't really a need to do it this way anymore.

If the usb card have its own ID (4 digits:4 digits) then you can stub the card in the syslinux.conf file and then choose the card in the other PCI devices part in the VM template.

If the usb card shares an ID with a USB controller on the motherboard, you have to use the new method of stubbing the card using a config file and the PCI number.

Thank you for replying! I continued to research and read last night an managed to pass the card through using the VFIO-PCI Config plugin.

 

I did give the syslinux.conf method a try by clicking on the flash drive in the GUI, and added the USB controller ID after the "append". With that method the USB controller appeared in the PCI devices section in the VM settings, but then I had the same "guest" error starting up the VM.

 

After removing that line from the syslinux.conf and using the VFIO plugin instead it works!

 

USB PnP is now functional in my W10 VM and so does the Oculus Rift.

Share this post


Link to post

I am currently having difficulty passing through a Fresco Logic FL1100 USB 3.0 Host Controller (rev 10).  Tried a number of methods pass it through including the VIFO plugin.

 

 Originally, posted detailed info in the VM (KVM) forum but haven't received a response in a week.   Realize that it might be in the wrong place.   Suggestions are be apricated!

 

 

 

 

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.