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


archedraft

Recommended Posts

So then I suppose even with hostdev you will still have to go through the entire first process of finding out which controller you want?

 

Yes you still have to do the steps up to and including 9.

 

Slightly OT, but would hostdev work for gfx cards?

Yes :)

Link to comment

So then I suppose even with hostdev you will still have to go through the entire first process of finding out which controller you want?

 

Yes you still have to do the steps up to and including 9.

 

Slightly OT, but would hostdev work for gfx cards?

Yes :)

 

Might try in with OSX just for science....

Link to comment

Can someone explain what the difference is between qemu passthrough and hostdev please?  I'm not entirely clear on the use cases for each...

I just edited my post :)

It's the same. The hostdev way is used in the XML and qemu:arg is not a part of the XML. Did that confuse you more maybe?  ::)

 

No, I've wondered why there are two separate ways to do things, but never given it too much thought.  So basically they're like two routes to the same destination...

 

No advantages or disadvantages either way?  No reason to choose one over the other?

 

That was a better explanation than mine :D

As far as I know there are no differences other than hostdev being easier and the right way to do it as it's the way I do it  ;D

The only thing I can think of is your OSX VM needs qemu:arg to work.

Link to comment

 

So then I suppose even with hostdev you will still have to go through the entire first process of finding out which controller you want?

 

Yes you still have to do the steps up to and including 9.

 

Slightly OT, but would hostdev work for gfx cards?

Yes :)

 

Might try in with OSX just for science....

 

Let me know what you find!

Link to comment

 

 

Might try in with OSX just for science....

 

Let me know what you find!

 

So using it for USB, the machine boots but doesn't recognise inputs from my mouse or keyboard.  Using it for GFX, and it boots and to all intents and purposes via the Unraid webui, looks like it's working, but I just get a black screen...

 

Interesting nonetheless..  ::)

Link to comment

Hi again,

I want to ask a question while it is still fresh in my mind. I find that out of 10 USB socket that the forwarding has killed all but two USB headers which were on the back of the server. I knew this was going to be the case but I am now rethinking this and may wish to switch them around.

 

Can you give me guidance/instruction on how to go back to ground zero with the re-assigning the USB (group 1) back to the server and not the VM? I'm not concerned about the changing the XML.

 

Advanced thanks

Link to comment

Hi again,

I want to ask a question while it is still fresh in my mind. I find that out of 10 USB socket that the forwarding has killed all but two USB headers which were on the back of the server. I knew this was going to be the case but I am now rethinking this and may wish to switch them around.

 

Can you give me guidance/instruction on how to go back to ground zero with the re-assigning the USB (group 1) back to the server and not the VM? I'm not concerned about the changing the XML.

 

Advanced thanks

 

Reboot Unraid after the relevant bits of the XML are deleted.  Start again...

Link to comment

Hi again,

I want to ask a question while it is still fresh in my mind. I find that out of 10 USB socket that the forwarding has killed all but two USB headers which were on the back of the server. I knew this was going to be the case but I am now rethinking this and may wish to switch them around.

 

Can you give me guidance/instruction on how to go back to ground zero with the re-assigning the USB (group 1) back to the server and not the VM? I'm not concerned about the changing the XML.

 

Advanced thanks

 

Reboot Unraid after the relevant bits of the XML are deleted.  Start again...

 

So this will revert step 9 in your instructions?

 

Thanks

Link to comment

Hi again,

I want to ask a question while it is still fresh in my mind. I find that out of 10 USB socket that the forwarding has killed all but two USB headers which were on the back of the server. I knew this was going to be the case but I am now rethinking this and may wish to switch them around.

 

Can you give me guidance/instruction on how to go back to ground zero with the re-assigning the USB (group 1) back to the server and not the VM? I'm not concerned about the changing the XML.

 

Advanced thanks

 

Reboot Unraid after the relevant bits of the XML are deleted.  Start again...

 

So this will revert step 9 in your instructions?

 

Thanks

 

Not quite sure I follow...

 

Step 9 is just checking the IOMMU groups...

 

All a VM is to Unraid is an XML file.... All the webui does is add bits to the XML, delete those bits and changes are undone...

 

Link to comment

I am a little confused as you can see. I am surprised that the all of the USB are not available to the server if no VM are up.

 

Regards.

 

Have you rebooted?

 

Don't forget it a USB BUS we're talking about, not a USB PORT, One BUS may encompass several ports

Link to comment

So then I suppose even with hostdev you will still have to go through the entire first process of finding out which controller you want?

 

Yes you still have to do the steps up to and including 9.

 

Alright, made an 11.a and 11.b step giving users the choice

 

Just tried passthrough hostdev with a windows machine and that works fine..  But again a gfx card just gives a black screen/no output..

Link to comment

So then I suppose even with hostdev you will still have to go through the entire first process of finding out which controller you want?

 

Yes you still have to do the steps up to and including 9.

 

Alright, made an 11.a and 11.b step giving users the choice

 

Just tried passthrough hostdev with a windows machine and that works fine..  But again a gfx card just gives a black screen/no output..

 

If I remember correctly, JonP mentioned many months ago in a forum post long forgotten, that he had much better luck with the arg format as opposed to the hostdev approach in regards to GPU... [disclaimer, I may have made all that up but I want to say I remember reading that]

Link to comment

I am a little confused as you can see. I am surprised that the all of the USB are not available to the server if no VM are up.

 

Regards.

 

Once a controller gets past through unRAID no longer can see the controller. Once the VM gets shutdown, unRAID doesn't know that the controller is available so you have to restart the server in order for unRAID to see it again. There may be some sort of script you can create that will let unRAID know that the controller is free.

Link to comment

So then I suppose even with hostdev you will still have to go through the entire first process of finding out which controller you want?

 

Yes you still have to do the steps up to and including 9.

 

Alright, made an 11.a and 11.b step giving users the choice

 

Just tried passthrough hostdev with a windows machine and that works fine..  But again a gfx card just gives a black screen/no output..

 

If I remember correctly, JonP mentioned many months ago in a forum post long forgotten, that he had much better luck with the arg format as opposed to the hostdev approach in regards to GPU... [disclaimer, I may have made all that up but I want to say I remember reading that]

It might be that it works better for graphics in OVMF and qemu arg  better in seabios. I haven't checked it that thorough I have to admit.

 

Link to comment

If I remember correctly, JonP mentioned many months ago in a forum post long forgotten, that he had much better luck with the arg format as opposed to the hostdev approach in regards to GPU... [disclaimer, I may have made all that up but I want to say I remember reading that]

 

I forgot I wrote this.....

 

Quite a nice detailed way of doing the method saarg has told us how to do....  What's worse is I was reading his post thinking, that's pretty cool.... Completely forgot, must be going senile...  ;D

Link to comment

If I remember correctly, JonP mentioned many months ago in a forum post long forgotten, that he had much better luck with the arg format as opposed to the hostdev approach in regards to GPU... [disclaimer, I may have made all that up but I want to say I remember reading that]

 

I forgot I wrote this.....

 

Quite a nice detailed way of doing the method saarg has told us how to do....  What's worse is I was reading his post thinking, that's pretty cool.... Completely forgot, must be going senile...  ;D

LOL  ;D

Link to comment

hello guys. Im having some problems passing through a USB pcie card (http://www.amazon.com/gp/product/B00FPIMICA?psc=1&redirect=true&ref_=oh_aui_detailpage_o01_s00)

 

i have attached a usb bluetooth device in the pcie card that i want to passthrough and it shows that is in bus 003:

 

Bus 003 Device 003: ID 0a5c:2198 Broadcom Corp. Bluetooth 3.0 Device

 

this is the result from readlink /sys/bus/usb/devices/usbX

 

root@Tower:~# readlink /sys/bus/usb/devices/usb1
../../../devices/pci0000:00/0000:00:14.0/usb1
root@Tower:~# readlink /sys/bus/usb/devices/usb2
../../../devices/pci0000:00/0000:00:14.0/usb2
root@Tower:~# readlink /sys/bus/usb/devices/usb3
../../../devices/pci0000:00/0000:00:1c.3/0000:04:00.0/0000:05:05.0/0000:08:00.0/usb3
root@Tower:~# readlink /sys/bus/usb/devices/usb4
../../../devices/pci0000:00/0000:00:1c.3/0000:04:00.0/0000:05:05.0/0000:08:00.0/usb4
root@Tower:~# readlink /sys/bus/usb/devices/usb5
../../../devices/pci0000:00/0000:00:1c.6/0000:0a:00.0/usb5
root@Tower:~# readlink /sys/bus/usb/devices/usb6
../../../devices/pci0000:00/0000:00:1c.6/0000:0a:00.0/usb6
root@Tower:~# readlink /sys/bus/usb/devices/usb7
../../../devices/pci0000:00/0000:00:1a.0/usb7
root@Tower:~# readlink /sys/bus/usb/devices/usb8
../../../devices/pci0000:00/0000:00:1d.0/usb8

 

this is the IOMMU Groups:

 

/sys/kernel/iommu_groups/0/devices/0000:00:00.0
/sys/kernel/iommu_groups/1/devices/0000:00:01.0
/sys/kernel/iommu_groups/1/devices/0000:01:00.0
/sys/kernel/iommu_groups/1/devices/0000:01:00.1
/sys/kernel/iommu_groups/2/devices/0000:00:14.0
/sys/kernel/iommu_groups/3/devices/0000:00:16.0
/sys/kernel/iommu_groups/4/devices/0000:00:19.0
/sys/kernel/iommu_groups/5/devices/0000:00:1a.0
/sys/kernel/iommu_groups/6/devices/0000:00:1b.0
/sys/kernel/iommu_groups/7/devices/0000:00:1c.0
/sys/kernel/iommu_groups/7/devices/0000:00:1c.2
/sys/kernel/iommu_groups/7/devices/0000:00:1c.3
/sys/kernel/iommu_groups/7/devices/0000:00:1c.6
/sys/kernel/iommu_groups/7/devices/0000:03:00.0
/sys/kernel/iommu_groups/7/devices/0000:04:00.0
/sys/kernel/iommu_groups/7/devices/0000:05:01.0
/sys/kernel/iommu_groups/7/devices/0000:05:03.0
/sys/kernel/iommu_groups/7/devices/0000:05:05.0
/sys/kernel/iommu_groups/7/devices/0000:05:07.0
/sys/kernel/iommu_groups/7/devices/0000:07:00.0
/sys/kernel/iommu_groups/7/devices/0000:08:00.0
/sys/kernel/iommu_groups/7/devices/0000:09:00.0
/sys/kernel/iommu_groups/7/devices/0000:0a:00.0
/sys/kernel/iommu_groups/8/devices/0000:00:1d.0
/sys/kernel/iommu_groups/9/devices/0000:00:1f.0
/sys/kernel/iommu_groups/9/devices/0000:00:1f.2
/sys/kernel/iommu_groups/9/devices/0000:00:1f.3

 

and this is the list of devices that i currently have on my unraid build (taken from system devices)

 

00:00.0 Host bridge: Intel Corporation 4th Gen Core Processor DRAM Controller (rev 06)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor PCI Express x16 Controller (rev 06)
00:14.0 USB controller: Intel Corporation 9 Series Chipset Family USB xHCI Controller
00:16.0 Communication controller: Intel Corporation 9 Series Chipset Family ME Interface #1
00:19.0 Ethernet controller: Intel Corporation Ethernet Connection (2) I218-V
00:1a.0 USB controller: Intel Corporation 9 Series Chipset Family USB EHCI Controller #2
00:1b.0 Audio device: Intel Corporation 9 Series Chipset Family HD Audio Controller
00:1c.0 PCI bridge: Intel Corporation 9 Series Chipset Family PCI Express Root Port 1 (rev d0)
00:1c.2 PCI bridge: Intel Corporation 9 Series Chipset Family PCI Express Root Port 3 (rev d0)
00:1c.3 PCI bridge: Intel Corporation 9 Series Chipset Family PCI Express Root Port 4 (rev d0)
00:1c.6 PCI bridge: Intel Corporation 9 Series Chipset Family PCI Express Root Port 7 (rev d0)
00:1d.0 USB controller: Intel Corporation 9 Series Chipset Family USB EHCI Controller #1
00:1f.0 ISA bridge: Intel Corporation 9 Series Chipset Family Z97 LPC Controller
00:1f.2 SATA controller: Intel Corporation 9 Series Chipset Family SATA Controller [AHCI Mode]
00:1f.3 SMBus: Intel Corporation 9 Series Chipset Family SMBus Controller
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Caicos [Radeon HD 6450/7450/8450 / R5 230 OEM]
01:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Caicos HDMI Audio [Radeon HD 6400 Series]
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 11)
04:00.0 PCI bridge: ASMedia Technology Inc. Device 1184
05:01.0 PCI bridge: ASMedia Technology Inc. Device 1184
05:03.0 PCI bridge: ASMedia Technology Inc. Device 1184
05:05.0 PCI bridge: ASMedia Technology Inc. Device 1184
05:07.0 PCI bridge: ASMedia Technology Inc. Device 1184
07:00.0 SATA controller: ASMedia Technology Inc. ASM1062 Serial ATA Controller (rev 02)
08:00.0 USB controller: Fresco Logic Device 1100 (rev 10)
09:00.0 SATA controller: ASMedia Technology Inc. ASM1062 Serial ATA Controller (rev 02)
0a:00.0 USB controller: ASMedia Technology Inc. ASM1042A USB 3.0 Host Controller

 

my 2 main questions are:

 

1- do i need to passthrough all the devices currently on group 7? if so, how do i make sure that all those devices are not critically importat for unraid to properly work? (my unraid usb is on bus 001)

 

2- which one is the right address for my bus 003? (as it shows ../../../devices/pci0000:00/0000:00:1c.3/0000:04:00.0/0000:05:05.0/0000:08:00.0/usb3)

 

PD: I'm passing it through to use it with El Capitan Virtual Machine.

 

thanks in advance for any help that can be provided. suggestions and/or corrections are very welcome.

 

Edit: I have figured it out.

 

First I had to enable the option "PCIe ACS Override" on VM Manager under settings. Second, I was using the wrong method to Pass it through because I'm using this method in a q35 machine (Mac OS X El Capitan). I was using the Hostdev method and I needed to use the qemu:arg method.

 

Wrong (Hostdev method):

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

 

Right (qemu:arg method):

    <qemu:arg value='-device'/>
    <qemu:arg value='vfio-pci,host=08:00.0,bus=root.1,addr=00.1'/>

 

Note that the addr=00.1 because in the addr=00.0 i have my GPU passed through.

 

Is now working like a charm. Hope it can help somebody.

Link to comment

Evening,

 

I've tried both methods of USB hub pass-through and neither will work with my keyboard and mouse but weirdly it will with a portable hard drive.

 

here is my XML

 

<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>

  <name>Ash</name>

  <uuid>ae944ea6-a892-a1a1-f512-6c076484b968</uuid>

  <description>Ashly's machine</description>

  <metadata>

    <vmtemplate name="Custom" icon="windows.png" os="windows"/>

  </metadata>

  <memory unit='KiB'>8388608</memory>

  <currentMemory unit='KiB'>8388608</currentMemory>

  <memoryBacking>

    <nosharepages/>

    <locked/>

  </memoryBacking>

  <vcpu placement='static'>6</vcpu>

  <cputune>

    <vcpupin vcpu='0' cpuset='0'/>

    <vcpupin vcpu='1' cpuset='1'/>

    <vcpupin vcpu='2' cpuset='2'/>

    <vcpupin vcpu='3' cpuset='3'/>

    <vcpupin vcpu='4' cpuset='4'/>

    <vcpupin vcpu='5' cpuset='5'/>

  </cputune>

  <os>

    <type arch='x86_64' machine='pc-i440fx-2.3'>hvm</type>

  </os>

  <features>

    <acpi/>

    <apic/>

    <hyperv>

      <relaxed state='on'/>

      <vapic state='on'/>

      <spinlocks state='on' retries='8191'/>

    </hyperv>

  </features>

  <cpu mode='host-passthrough'>

    <topology sockets='1' cores='6' threads='1'/>

  </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/bin/qemu-system-x86_64</emulator>

    <disk type='file' device='disk'>

      <driver name='qemu' type='raw' cache='writeback'/>

      <source file='/mnt/disk1/Ash/Ash/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='disk'>

      <driver name='qemu' type='raw' cache='writeback'/>

      <source file='/mnt/disk1/Storage/Ash/vdisk2.img'/>

      <target dev='hdd' bus='virtio'/>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>

    </disk>

    <disk type='file' device='cdrom'>

      <driver name='qemu' type='raw'/>

      <source file='/mnt/disk1/ISO's/virtio-win-0.1.112.iso'/>

      <target dev='hda' bus='ide'/>

      <readonly/>

      <boot order='2'/>

      <address type='drive' controller='0' bus='0' target='0' unit='0'/>

    </disk>

    <controller type='usb' index='0'>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>

    </controller>

    <controller type='pci' index='0' model='pci-root'/>

    <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>

    <interface type='bridge'>

      <mac address='52:54:00:e8:9a:3e'/>

      <source bridge='br0'/>

      <model type='virtio'/>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>

    </interface>

    <serial type='pty'>

      <target port='0'/>

    </serial>

    <console type='pty'>

      <target type='serial' port='0'/>

    </console>

    <channel type='unix'>

      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/Ash.org.qemu.guest_agent.0'/>

      <target type='virtio' name='org.qemu.guest_agent.0'/>

      <address type='virtio-serial' controller='0' bus='0' port='1'/>

    </channel>

    <memballoon model='virtio'>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>

    </memballoon>

  </devices>

  <qemu:commandline>

    <qemu:arg value='-device'/>

    <qemu:arg value='ioh3420,bus=pci.0,addr=1c.0,multifunction=on,port=2,chassis=1,id=root.1'/>

    <qemu:arg value='-device'/>

    <qemu:arg value='vfio-pci,host=01:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on'/>

    <qemu:arg value='-device'/>

    <qemu:arg value='vfio-pci,host=06:00.0,bus=root.1,addr=00.1'/>

  </qemu:commandline>

</domain>

 

 

Two questions I would have would be related to ECHI Hand off settings and PCIe ACS Override.

 

Apart from this not working correctly everything else is perfect.

 

Cheers for the help.

 

Link to comment

I've tried both methods of USB hub pass-through and neither will work with my keyboard and mouse but weirdly it will with a portable hard drive.

 

Do you happen to have a different USB keyboard and mouse you could try? If the portable hard drive works then technically it is working, so the issue is most likely that keyboard and mouse. Does your keyboard/mouse manufacture have any additional software you can install? For example Logitech has their Setpoint software which I have found to be helpful with my devices.

Link to comment

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.