Help getting passthru for specific usb host


Recommended Posts

I'm making progress getting GPU passthru working, but now I need usb as well to get input devices to the VM (mouse/keyboard).

 

I bought a hot-swap tray with included usb3 (http://www.microcenter.com/product/392923/25_-_35_Hot_Swap_Rack_w-_Key_Lock_and_SuperSpeed_USB_30_Hub).  I'm thinking that rather than forward a specific usb input device (since the VM won't start if the device isn't present), I would rather forward the usb3 hub itself.  I assume this would then passthru any device attached to the hub?

 

However, the hub attaches to the usb3 internal connector on my motherboard.  So it isn't showing up in lspci. 

 

Seems like I have two options.

1) Is there a way to tell from the lspci output which controller the hub is attached to?  I could then passthru that whole controller, which would include the hub.

2) Pass the hub by itself.  The problem here is that it is showing up in lsusb as a generic "Linux Foundation 3.0 root hub", which can have duplicate vendor/product id's with any other usb hub.  I'm not sure how to specific the product/vendor plus the bus/device.

 

I'd appreciate any recommendations on how to proceed.

 

Thanks!

Link to comment

OK, couple things.  A USB hub doesn't show up in lspci because its not a PCI device.  Its another USB device.  Also, passing through the hub doesn't pass through the devices attached to it either.

 

Now as far as passing through your USB controller, this is a bit trickier and dangerous because passing through the controller that the unRAID USB stick is plugged into will result in /boot disappearing (therefore requiring a reboot of the server and will trigger an unclean shutdown).

 

The other tricky part is that many motherboards have settings (in the BIOS) for ehci and xhci (and handoff) and these settings aren't very clear.  Depending on your motherboard though, tweaking these settings can result in multiple USB controllers appearing and can be set to split the USB ports between them.  When done right, you can make your USB flash device attach to one controller and then pass through the other controller as a PCI device directly.  That would enable you to achieve exactly what you're looking for.

 

Can you post a printout of what shows up under the PCI devices section of the web GUI?  Goto tools -> system devices and you'll see that. Do the same for you USB devices as well please...

 

Link to comment

Thanks for all of the info!

 

Attached is a pic of the system devices.

 

root@Tower2:/mnt/btrfs/VM/Win7# lsusb -t
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
    |__ Port 2: Dev 3, If 0, Class=Mass Storage, Driver=usb-storage, 5000M  [b]<--Not unRAID[/b]
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M
    |__ Port 1: Dev 5, If 0, Class=Hub, Driver=hub/3p, 12M
        |__ Port 2: Dev 6, If 0, Class=Human Interface Device, Driver=usbhid, 12M
        |__ Port 3: Dev 7, If 0, Class=Human Interface Device, Driver=usbhid, 12M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/8p, 480M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M
        |__ Port 1: Dev 3, If 0, Class=Mass Storage, Driver=usb-storage, 480M [b]<--Pretty sure unRAID[/b]

devices.PNG.bfab35964bea28a78b830975120d932c.PNG

Link to comment

So I found this stackoverflow question which seems to be trying to tell which pci device is linked to a specific usb port.

 

So I plugged in a 2nd flash drive (named "Test" instead of "UNRAID") into a port I was hoping to pass thru.

 

blkid | grep -i test

tells me this is /dev/sdi1

 

blkid | grep -i unraid

tells me unRAID is /dev/sda1

 

lspci | grep -i usb
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/C210 Series Chipset Family USB Enhanced Host Controller #2 (rev 04)
00:1d.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1 (rev 04)

Shows three usb controllers

 

Now figure out which is which

ls -al /sys/block/sda

lrwxrwxrwx 1 root root 0 Oct 12 12:34 /sys/block/sda -> ../devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1:1.0/host0/target0:0:0/0:0:0:0/block/sda/

ls -al /sys/block/sdi

lrwxrwxrwx 1 root root 0 Oct  5 03:50 /sys/block/sdi -> ../devices/pci0000:00/0000:00:14.0/usb4/4-2/4-2:1.0/host10/target10:0:0/10:0:0:0/block/sdi/

 

Looking at the red text (and comparing to lspci output) I can see that unRAID is on a different controller than my "test" usb.  So I can pass thru the usb controller 0000:00:14.0 - the xHCI controller.

 

I'll post back if it works.  I wanted to post this while it was still fresh.

Link to comment

So I found this stackoverflow question which seems to be trying to tell which pci device is linked to a specific usb port.

 

So I plugged in a 2nd flash drive (named "Test" instead of "UNRAID") into a port I was hoping to pass thru.

 

blkid | grep -i test

tells me this is /dev/sdi1

 

blkid | grep -i unraid

tells me unRAID is /dev/sda1

 

lspci | grep -i usb
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/C210 Series Chipset Family USB Enhanced Host Controller #2 (rev 04)
00:1d.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1 (rev 04)

Shows three usb controllers

 

Now figure out which is which

ls -al /sys/block/sda

lrwxrwxrwx 1 root root 0 Oct 12 12:34 /sys/block/sda -> ../devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1:1.0/host0/target0:0:0/0:0:0:0/block/sda/

ls -al /sys/block/sdi

lrwxrwxrwx 1 root root 0 Oct  5 03:50 /sys/block/sdi -> ../devices/pci0000:00/0000:00:14.0/usb4/4-2/4-2:1.0/host10/target10:0:0/10:0:0:0/block/sdi/

 

Looking at the red text (and comparing to lspci output) I can see that unRAID is on a different controller than my "test" usb.  So I can pass thru the usb controller 0000:00:14.0 - the xHCI controller.

 

I'll post back if it works.  I wanted to post this while it was still fresh.

 

Interesting!  Definitely want to see if this works for you.  If so, we could put that logic into the webGui in the future to help folks more easily accomplish the same objective.  Thanks for sharing!!

Link to comment

Well, partial success.  The controller shows up in the VM (I have to use remote desktop to check, BTW), but in device manager it is showing up as not having a driver.  Windows can't automatically find drivers.

 

I wasn't sure what to put for address, so I have

    <qemu:arg value='-device'/>
    <qemu:arg value='vfio-pci,host=00:14.0,bus=root.1'/>

 

Also, it seems like the vfio-bind in my go script isn't "taking" for some reason - I have to manually enter the command once unRAID is running.

 

Any suggestions for these two issues?

 

 

Link to comment

LOL

 

I was nervous about installing the mobo drivers, since I wasn't passing through everything.  That didn't last too long, and installing the USB3 driver fixed it.  I am not sure about resets, so instead of restarting, I shutdown the vm, then shutdown unRAID and will bring them both up for off. 

 

BTW, I've told unRAID not to automatically start the array while I'm testing.  So I need to run:

/etc/rc.d/rc.libvirt start
vfio-bind 0000:01:00.0 0000:01:00.1 0000:00:14.0

then I manually start my VM with

virsh create <vm.xml>

Link to comment

Not working (as in no groups listed in /dev/vfio).  My go script is:

#!/bin/bash
mkdir -p /mnt/btrfs
mount /dev/disk/by-id/ata-TOSHIBA_THNSNH128GBST_231S10DWTE4Y-part1 /mnt/btrfs

# Start the Management Utility
/usr/local/sbin/emhttp &
vfio-bind 0000:01:00.0 0000:01:00.1 0000:00:14.0
/boot/unmenu/uu

cd /boot/packages && find . -name '*.auto_install' -type f -print | sort | xargs -n1 sh -c

 

I see the following in the log:

Oct 12 18:17:12 Tower2 logger: Starting go script
Oct 12 18:17:12 Tower2 kernel: BTRFS: device fsid 69be0add-8368-4d88-935d-f2db1e71b57a devid 1 transid 567 /dev/sdh1
Oct 12 18:17:12 Tower2 kernel: BTRFS info (device sdh1): disk space caching is enabled
Oct 12 18:17:12 Tower2 emhttp: unRAID System Management Utility version 6.0-beta10a
Oct 12 18:17:12 Tower2 emhttp: Copyright (C) 2005-2014, Lime Technology, LLC
Oct 12 18:17:12 Tower2 emhttp: shcmd (1): mkdir -p /boot/config/plugins/webGui
Oct 12 18:17:12 Tower2 kernel: BTRFS: detected SSD devices, enabling SSD mode
Oct 12 18:17:12 Tower2 emhttp: shcmd (2): mkdir -p /boot/config/shares
Oct 12 18:17:12 Tower2 unmenu-status: Starting unmenu web-server

So I see "Starting go script" and "Starting unmenu" with nothing about vfio-bind.  So I'm officially confused!

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.