USB Hubs on VMs


Recommended Posts

I looked on the forums and found a few queries but not any fixes.

 

I have a Windows 10 VM running on unRAID ver 6.2.4.

 

I have a wireless KB and mouse which runs via a dongle attached to an active USB extension. When I plug the dongle into the extension my KB and mouse works. When I plug in a USB hub, then the USB dongle the KB and mouse also works. However, nothing else I plug into the hub works. BT device, USB memory sticks, nothing, no response. If I unplug the hub and connected either the BT or USB memory stick onto the USB extension same response, nothing.

 

Any idea of how to get a USB hub to work?

 

I want to be able to utilise a variety of USB device on a VM.

Link to comment

Limitation of QEMU / KVM is that you cannot assign a USB hub to a VM, but you can assign individual devices on the hub to a VM.

 

Passthrough of a USB controller is the best method, but if you unable to do that, then check out either the Libvirt HotPlug USB plugin which will let you manually attach and detach devices to any VM by going to its UI, or there's also a script I wrote (in the additional scripts for the User Scripts plugin) which will scan a USB Bus (or the bus that a USB Hub is on) and automatically attach / detach devices to a VM as they are inserted / pulled automatically)

  • Upvote 1
Link to comment

So I have been looking to pass through a USB controller.

 

My unRAID runs on a Supermicro X10SL7-F motherboard which has three USB controllers.

 

When I run:

 

for usb_ctrl in $(find /sys/bus/usb/devices/usb* -maxdepth 0 -type l); do pci_path="$(dirname "$(realpath "${usb_ctrl}")")"; echo "Bus $(cat "${usb_ctrl}/busnum") --> $(basename $pci_path) (IOMMU group $(basename $(realpath $pci_path/iommu_group)))"; lsusb -s "$(cat "${usb_ctrl}/busnum"):"; echo; done

 

 

I can view devices and can identify which controller my unRAID USB key is attached to. The USB key with unRAID is attached to the USB port on the motherboard. When I plug in a new USB stick to the USB ports via the IO shield, re-run the command, it reports the USB key is on the same bus. Having tried all four USB ports via the IO shield they all show up on the same bus as my unRAID USB.

 

Trying the USB ports attached via the motherboard USB pins shows my new USB key in the same bus as the unRAID key. SO to me it looks like all my USB ports are on the same controller.

 

Is there something I have missed? Why would the MB have three USB controllers if all ports are on the one bus?

Link to comment

Unfortunately not as option as the Supermicro MB only has to PCI slots and both are being utilised. I am interested as to why the board has 3 USB controllers however all USB ports appear to be on the same bus.

Busses that devices are attached to can change depending upon the device.  As an example, I can plug flash drives in to the server all day long and they will always appear on the same bus associated with that port.  If I plug in a keyboard, then the bus changes....  And the bus that it changes to is handled by a different controller.  Just one of those things.

 

 

Link to comment

OK. That doesnt help me. So how do I determine which controller not to pass through as whenever I connect a USB device to a port and run:

 

for usb_ctrl in $(find /sys/bus/usb/devices/usb* -maxdepth 0 -type l); do pci_path="$(dirname "$(realpath "${usb_ctrl}")")"; echo "Bus $(cat "${usb_ctrl}/busnum") --> $(basename $pci_path) (IOMMU group $(basename $(realpath $pci_path/iommu_group)))"; lsusb -s "$(cat "${usb_ctrl}/busnum"):"; echo; done

 

At the moment the unRAID host USB shows on a particular controller but so does every other port I plug a USB device into. The other two USB controllers never show devices attached.

 

Do I just pass through any controller which the unRAID USB host isnt on?

Link to comment

You can try passing one through that isn't used by the stick.

 

But also bear in mind that many mother boards have tons of extra headers for USB that you may not have populated that could be the extra controllers that you're seeing, but not being able to get anything to recognize as being plugged into.

 

Note that AFAIK a USB3 port is always going to be a different controller than a USB2 port

Link to comment

There are three headers on the MB. One is USB3 and the other two are USB2. I have switched the front case USB connections to both of the MB USB headers and get the same result, device always shows in the same bus as the unRAID host USB.

 

I could try the USB3 header though I would have to try and find a USB3 header which has a PCI face plate.

 

Even though I have tried all the ports, except the USB3 header, and devices always show on the same bus (with the same controller). If I pass through a different controller to the unRAID USB host and then connect a USB device via the VM will it work? I thought USB ports were connected to a USB controller via hardware? Do the physical ports dynamically move between host controllers?

Link to comment

Can you post the results of -> lspci | grep USB

 

That command line does seem to work on my server, but have you tried what is here?

 

https://lime-technology.com/forum/index.php?topic=36768.0

 

 

 

Note that AFAIK a USB3 port is always going to be a different controller than a USB2 port

 

Just FYI, I have a Skylake system and it has 1 USB controller with 6 x USB3 rear ports, 1 x USB3 header and 2 x USB2 headers. I think having an all-in-one controller is new to Skylake on Intel platforms.

 

 

Link to comment

Note that AFAIK a USB3 port is always going to be a different controller than a USB2 port

 

Just FYI, I have a Skylake system and it has 1 USB controller with 6 x USB3 rear ports, 1 x USB3 header and 2 x USB2 headers. I think having an all-in-one controller is new to Skylake on Intel platforms.

Interesting...  Can you tell that I'm a fan of lower end hardware?  (Wife has never believed me when I say that I absolutely need the newest stuff or the world as we know it is going to come to a crashing halt)
Link to comment

Can you post the results of -> lspci | grep USB

 

That command line does seem to work on my server, but have you tried what is here?

 

https://lime-technology.com/forum/index.php?topic=36768.0

 

 

 

Note that AFAIK a USB3 port is always going to be a different controller than a USB2 port

 

Just FYI, I have a Skylake system and it has 1 USB controller with 6 x USB3 rear ports, 1 x USB3 header and 2 x USB2 headers. I think having an all-in-one controller is new to Skylake on Intel platforms.

 

lspci | grep USB reports:

 

00:14.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family US                                                  B xHCI (rev 05)

00:1a.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family US                                                  B EHCI #2 (rev 05)

00:1d.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family US                                                  B EHCI #1 (rev 05)

 

Also the report from command:

 

for usb_ctrl in $(find /sys/bus/usb/devices/usb* -maxdepth 0 -type l); do pci_path="$(dirname "$(realpath "${usb_ctrl}")")"; echo "Bus $(cat "${usb_ctrl}/busnum") --> $(basename $pci_path) (IOMMU group $(basename $(realpath $pci_path/iommu_group)))"; lsusb -s "$(cat "${usb_ctrl}/busnum"):"; echo; done

 

is:

 

Bus 1 --> 0000:00:1a.0 (IOMMU group 4)

Bus 001 Device 002: ID 8087:8008 Intel Corp.

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

 

Bus 2 --> 0000:00:1d.0 (IOMMU group 9)

Bus 002 Device 002: ID 8087:8000 Intel Corp.

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

 

Bus 3 --> 0000:00:14.0 (IOMMU group 3)

Bus 003 Device 005: ID 0557:2419 ATEN International Co., Ltd

Bus 003 Device 003: ID 0557:7000 ATEN International Co., Ltd Hub

Bus 003 Device 008: ID 14cd:8608 Super Top

Bus 003 Device 010: ID 046d:c534 Logitech, Inc. Unifying Receiver

Bus 003 Device 006: ID 14cd:8601 Super Top

Bus 003 Device 004: ID 1a40:0101 Terminus Technology Inc. Hub

Bus 003 Device 002: ID 13fe:4200 Kingston Technology Company Inc.

Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

 

Bus 4 --> 0000:00:14.0 (IOMMU group 3)

Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

 

I have been following the guide from Spaceinvader One:

 

 

 

 

Link to comment

With all USBs, other than the unRAID host USB the report is:

 

Bus 1 --> 0000:00:1a.0 (IOMMU group 4)

Bus 001 Device 002: ID 8087:8008 Intel Corp.

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

 

Bus 2 --> 0000:00:1d.0 (IOMMU group 9)

Bus 002 Device 002: ID 8087:8000 Intel Corp.

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

 

Bus 3 --> 0000:00:14.0 (IOMMU group 3)

Bus 003 Device 005: ID 0557:2419 ATEN International Co., Ltd

Bus 003 Device 003: ID 0557:7000 ATEN International Co., Ltd Hub

Bus 003 Device 002: ID 13fe:4200 Kingston Technology Company Inc.

Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

 

Bus 4 --> 0000:00:14.0 (IOMMU group 3)

Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

 

Link to comment
Interesting...  Can you tell that I'm a fan of lower end hardware?  (Wife has never believed me when I say that I absolutely need the newest stuff or the world as we know it is going to come to a crashing halt)

 

The Skylake stuff has been a big disappointment. It has randomly hard locked and I don't even capture anything appearing in the syslog. I made a few BIOS adjustments and it went about 40 days once but it keeps happening. Last time was after 25 days and I had started thinking maybe it's OK this time...

 

I've had unRAID running on 4 different AMD processor/motherboard combos without any stability issues. The last AMD setup would NOT let me install the video card drivers in a windows VM which is the reason for the Skylake. I tried EVERYTHING that I could find to fix that issue (which no-one else seemed to have) including both AMD and Nvidia cards.

Link to comment

I think the results are tricking you and it only has one USB controller, the 14 device. Possibly the 1a and 1d devices are some part of the interface in the processor chipset and the 14 device is actually the controller?

 

How would I determine if the board only has a single controller? The board is a Supermicro X10SL7-F with the C222 chipset. The manual doesn't speak about the USB controller at all.

Link to comment

Well, your testing has proved it's only a single controller and you can't split it.

 

Ok. So I understand what I am looking at. These are all the same device? I thought the different numbers at the start indicated a different device?

 

00:14.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family US                                                  B xHCI (rev 05)

00:1a.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family US                                                  B EHCI #2 (rev 05)

00:1d.0 USB controller: Intel Corporation 8 Series/C220 Series Chipset Family US                                                  B EHCI #1 (rev 05)

Link to comment
  • 1 month later...

Picked up a PCI USB controller. I have forwarded it to the VM but it won't start. I am getting the following message:

 

"internal error: process exited while connecting to monitor: 2017-04-15T04:22:29.755497Z qemu-system-x86_64: -device vfio-pci,host=01:00.0,id=hostdev1,bus=pci.0,addr=0x6: vfio: error, group 1 is not viable, please ensure all devices within the iommu_group are bound to their vfio bus driver.
2017-04-15T04:22:29.755526Z qemu-system-x86_64: -device vfio-pci,host=01:00.0,id=hostdev1,bus=pci.0,addr=0x6: vfio: failed to get group 1
2017-04-15T04:22:29.755536Z qemu-system-x86_64: -device vfio-pci,host=01:00.0,id=hostdev1,bus=pci.0,addr=0x6: Device initialization failed"

 

My Syslinux config is:

 

default /syslinux/menu.c32
menu title Lime Technology, Inc.
prompt 0
timeout 50
label unRAID OS
  menu default
  kernel /bzimage
  append vfio-pci.ids=1106:3483 pci-stub .ids=8086:1521 initrd=/bzroot
label unRAID OS GUI Mode
  kernel /bzimage
  append initrd=/bzroot,/bzroot-gui
label unRAID OS Safe Mode (no plugins, no GUI)
  kernel /bzimage
  append initrd=/bzroot unraidsafemode
label unRAID OS GUI Safe Mode (no plugins)
  kernel /bzimage
  append initrd=/bzroot,/bzroot-gui unraidsafemode
label Memtest86+
  kernel /memtest
 

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.