USB/Mobo BT passthrough to VM (connects, then hangs)


Recommended Posts

I've tried passing through the motherboard bluetooth to my Windows 10 VM. The bluetooth drivers are installed and I can connect to bluetooth audio devices, which seem to work flawlessly. When I try to connect my bluetooth keyboard (CoolerMaster SK621), it can connect, and I can start typing right away, but if I stop typing for more than 3 seconds, it seems almost as if the keyboard or on-board bluetooth hangs. I've troubleshooted this with purchasing a USB BT dongle, the popular LogiLink BT0015, and I run into the same problem. Turning the keyboard off and on again results in the keyboard not being able to reconnect to the bluetooth. There are no errors or warnings in the system logs or the VM logs. I have all VT-d, SR-IOV and virtualization settings turned on in the server BIOS, turning XHCI-handoff off and on, legacy USB off and on, disabling CSM, I've tried changing the USB controller from 2.0 EHCI to qemu-xhci to nec-xhci, on both the USB BT and mobo BT, uninstalling and reinstalling the bluetooth drivers, installing the keyboard software portal from CoolerMaster, and using the solutions posted in New USB Pass Through Method with USB 3...Please Test and [Solved] Using 2 different USB Bluetooth devices (on separate virtual machines).

 

My Windows 10 XML:

<?xml version='1.0' encoding='UTF-8'?>
<domain type='kvm' id='5'>
  <name>Gaming PC</name>
  <uuid>7556cad4-bd43-0676-78cb-41676cfd47e7</uuid>
  <metadata>
    <vmtemplate xmlns="unraid" name="Windows 10" icon="windows.png" os="windows10"/>
  </metadata>
  <memory unit='KiB'>8388608</memory>
  <currentMemory unit='KiB'>8388608</currentMemory>
  <memoryBacking>
    <nosharepages/>
  </memoryBacking>
  <vcpu placement='static'>8</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='0'/>
    <vcpupin vcpu='1' cpuset='6'/>
    <vcpupin vcpu='2' cpuset='1'/>
    <vcpupin vcpu='3' cpuset='7'/>
    <vcpupin vcpu='4' cpuset='2'/>
    <vcpupin vcpu='5' cpuset='8'/>
    <vcpupin vcpu='6' cpuset='4'/>
    <vcpupin vcpu='7' cpuset='10'/>
  </cputune>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-q35-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/7556cad4-bd43-0676-78cb-41676cfd47e7_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='4' threads='2'/>
    <cache mode='passthrough'/>
  </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/Gaming PC/vdisk1.img' index='1'/>
      <backingStore/>
      <target dev='hdc' bus='virtio'/>
      <boot order='1'/>
      <alias name='virtio-disk2'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <alias name='usb'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <alias name='usb'/>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <alias name='usb'/>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x1' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <alias name='usb'/>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x2'/>
    </controller>
    <controller type='pci' index='3' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='3' port='0xa'/>
      <alias name='pci.3'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='4' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='4' port='0xb'/>
      <alias name='pci.4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x3'/>
    </controller>
    <controller type='pci' index='5' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='5' port='0xc'/>
      <alias name='pci.5'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x4'/>
    </controller>
    <controller type='pci' index='6' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='6' port='0xd'/>
      <alias name='pci.6'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x5'/>
    </controller>
    <controller type='pci' index='7' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='7' port='0xe'/>
      <alias name='pci.7'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x6'/>
    </controller>
    <controller type='pci' index='8' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='8' port='0xf'/>
      <alias name='pci.8'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x7'/>
    </controller>
    <controller type='pci' index='9' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='9' port='0x10'/>
      <alias name='pci.9'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <alias name='virtio-serial0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </controller>
    <controller type='sata' index='0'>
      <alias name='ide'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pcie-root'>
      <alias name='pcie.0'/>
    </controller>
    <controller type='pci' index='1' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='1' port='0x8'/>
      <alias name='pci.1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/>
    </controller>
    <controller type='pci' index='2' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='2' port='0x9'/>
      <alias name='pci.2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:7f:83:de'/>
      <source bridge='br0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/0'/>
      <target type='isa-serial' port='0'>
        <model name='isa-serial'/>
      </target>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/0'>
      <source path='/dev/pts/0'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/domain-5-Gaming PC/org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0' state='disconnected'/>
      <alias name='channel0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='mouse' bus='ps2'>
      <alias name='input0'/>
    </input>
    <input type='keyboard' bus='ps2'>
      <alias name='input1'/>
    </input>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
      </source>
      <alias name='hostdev0'/>
      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x01' slot='0x00' function='0x1'/>
      </source>
      <alias name='hostdev1'/>
      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x01' slot='0x00' function='0x2'/>
      </source>
      <alias name='hostdev2'/>
      <address type='pci' domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x01' slot='0x00' function='0x3'/>
      </source>
      <alias name='hostdev3'/>
      <address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
      </source>
      <alias name='hostdev4'/>
      <address type='pci' domain='0x0000' bus='0x08' slot='0x00' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x045e'/>
        <product id='0x02fe'/>
        <address bus='1' device='3'/>
      </source>
      <alias name='hostdev5'/>
      <address type='usb' bus='0' port='2'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x0a12'/>
        <product id='0x0001'/>
        <address bus='1' device='8'/>
      </source>
      <alias name='hostdev7'/>
      <address type='usb' bus='0' port='4'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x0b05'/>
        <product id='0x18a3'/>
        <address bus='1' device='11'/>
      </source>
      <alias name='hostdev8'/>
      <address type='usb' bus='0' port='5'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x1038'/>
        <product id='0x1290'/>
        <address bus='1' device='4'/>
      </source>
      <alias name='hostdev9'/>
      <address type='usb' bus='0' port='6'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x1038'/>
        <product id='0x1294'/>
        <address bus='1' device='6'/>
      </source>
      <alias name='hostdev10'/>
      <address type='usb' bus='0' port='1.1'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x1e71'/>
        <product id='0x170e'/>
        <address bus='1' device='7'/>
      </source>
      <alias name='hostdev11'/>
      <address type='usb' bus='0' port='1.2'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x1e71'/>
        <product id='0x2006'/>
        <address bus='1' device='9'/>
      </source>
      <alias name='hostdev12'/>
      <address type='usb' bus='0' port='1.3'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x046d'/>
        <product id='0xc539'/>
        <address bus='1' device='20'/>
      </source>
      <alias name='hostdev14'/>
      <address type='usb' bus='0' port='3'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x2516'/>
        <product id='0x0087'/>
        <address bus='1' device='22'/>
      </source>
      <alias name='hostdev15'/>
      <address type='usb' bus='0' port='1.4'/>
    </hostdev>
    <hub type='usb'>
      <alias name='hub0'/>
      <address type='usb' bus='0' port='1'/>
    </hub>
    <memballoon model='none'/>
  </devices>
  <seclabel type='dynamic' model='dac' relabel='yes'>
    <label>+0:+100</label>
    <imagelabel>+0:+100</imagelabel>
  </seclabel>
</domain>

My system devices:

PCI Devices and IOMMU Groups

IOMMU group 0:	[8086:3ec2] 00:00.0 Host bridge: Intel Corporation 8th Gen Core Processor Host Bridge/DRAM Registers (rev 07)
IOMMU group 1:	[8086:1901] 00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller (x16) (rev 07)
[10de:1f07] 01:00.0 VGA compatible controller: NVIDIA Corporation TU106 [GeForce RTX 2070 Rev. A] (rev a1)
[10de:10f9] 01:00.1 Audio device: NVIDIA Corporation TU106 High Definition Audio Controller (rev a1)
[10de:1ada] 01:00.2 USB controller: NVIDIA Corporation TU106 USB 3.1 Host Controller (rev a1)
[10de:1adb] 01:00.3 Serial bus controller [0c80]: NVIDIA Corporation TU106 USB Type-C UCSI Controller (rev a1)
IOMMU group 2:	[8086:3e92] 00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 630 (Desktop)
IOMMU group 3:	[8086:a36d] 00:14.0 USB controller: Intel Corporation Cannon Lake PCH USB 3.1 xHCI Host Controller (rev 10)
[8086:a36f] 00:14.2 RAM memory: Intel Corporation Cannon Lake PCH Shared SRAM (rev 10)
[8086:a370] 00:14.3 Network controller: Intel Corporation Wireless-AC 9560 [Jefferson Peak] (rev 10)
IOMMU group 4:	[8086:a360] 00:16.0 Communication controller: Intel Corporation Cannon Lake PCH HECI Controller (rev 10)
IOMMU group 5:	[8086:a352] 00:17.0 SATA controller: Intel Corporation Cannon Lake PCH SATA AHCI Controller (rev 10)
IOMMU group 6:	[8086:a340] 00:1b.0 PCI bridge: Intel Corporation Cannon Lake PCH PCI Express Root Port #17 (rev f0)
IOMMU group 7:	[8086:a338] 00:1c.0 PCI bridge: Intel Corporation Cannon Lake PCH PCI Express Root Port #1 (rev f0)
IOMMU group 8:	[8086:a330] 00:1d.0 PCI bridge: Intel Corporation Cannon Lake PCH PCI Express Root Port #9 (rev f0)
IOMMU group 9:	[8086:a305] 00:1f.0 ISA bridge: Intel Corporation Z390 Chipset LPC/eSPI Controller (rev 10)
[8086:a348] 00:1f.3 Audio device: Intel Corporation Cannon Lake PCH cAVS (rev 10)
[8086:a323] 00:1f.4 SMBus: Intel Corporation Cannon Lake PCH SMBus Controller (rev 10)
[8086:a324] 00:1f.5 Serial bus controller [0c80]: Intel Corporation Cannon Lake PCH SPI Controller (rev 10)
[8086:15bc] 00:1f.6 Ethernet controller: Intel Corporation Ethernet Connection (7) I219-V (rev 10)
IOMMU group 10:	[144d:a808] 04:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd NVMe SSD Controller SM981/PM981/PM983


CPU Thread Pairings

Pair 1:	cpu 0 / cpu 6
Pair 2:	cpu 1 / cpu 7
Pair 3:	cpu 2 / cpu 8
Pair 4:	cpu 3 / cpu 9
Pair 5:	cpu 4 / cpu 10
Pair 6:	cpu 5 / cpu 11


USB Devices

Bus 001 Device 001:	ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002:	ID 0451:2036 Texas Instruments, Inc. TUSB2036 Hub
Bus 001 Device 003:	ID 045e:02fe Microsoft Corp. XBOX ACC
Bus 001 Device 004:	ID 1038:1290 SteelSeries ApS
Bus 001 Device 005:	ID 05e3:0610 Genesys Logic, Inc. 4-port hub
Bus 001 Device 006:	ID 1038:1294 SteelSeries ApS
Bus 001 Device 007:	ID 1e71:170e NZXT NZXT USB Device
Bus 001 Device 008:	ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 001 Device 009:	ID 1e71:2006 NZXT NZXT USB Device
Bus 001 Device 011:	ID 0b05:18a3 ASUSTek Computer, Inc. AURA MOTHERBOARD
Bus 001 Device 013:	ID 8087:0aaa Intel Corp.
Bus 001 Device 020:	ID 046d:c539 Logitech, Inc.
Bus 002 Device 001:	ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 002:	ID 0781:5583 SanDisk Corp. Ultra Fit
Bus 002 Device 003:	ID 05e3:0612 Genesys Logic, Inc. Hub


SCSI Devices

[0:0:0:0]	disk    SanDisk  Ultra Fit        1.00  /dev/sda   15.3GB
[1:0:0:0]	disk    ATA      Samsung SSD 860  2B6Q  /dev/sdb   1.00TB
[2:0:0:0]	disk    ATA      ST2000LM003 HN-M 0001  /dev/sdc   2.00TB

 

PC info:

Intel i7-8086k
ASUS Z390-i ROG STRIX
NVIDIA RTX 2070 FE (passthrough)
2x8GB 3000MHz Corsair Vengeance LPX
Samsung 970 Evo 500GB NVMe x4 SSD (passthrough)
Samsung 860 Evo 1TB SSD

LMK if I've missed any info.

Link to comment
11 minutes ago, shplack said:

BUMP

Bluetooth audio works but keyboard doesn't suggests it's something specific to the keyboard.

I have lots of bluetooth stuff connected to my £5 USB Bluetooth dongle and no issue at all.

 

The "stop typing for 3s" sounds like your keyboard goes into standby / power saving too early. (or it runs out of battery).

Do you have a friend's PC / laptop to test your keyboard?


 

Link to comment
4 hours ago, testdasi said:

Bluetooth audio works but keyboard doesn't suggests it's something specific to the keyboard.

I have lots of bluetooth stuff connected to my £5 USB Bluetooth dongle and no issue at all.

 

The "stop typing for 3s" sounds like your keyboard goes into standby / power saving too early. (or it runs out of battery).

Do you have a friend's PC / laptop to test your keyboard?


 

The keyboard works fine in Windows 10 otherwise. It only has problems in the VM

Link to comment
22 minutes ago, testdasi said:

Then the only potential fix is to pass through a USB controller to the VM. Some devices just don't work with the libvirt virtual USB device.

I wish I could, using an mITX board with only the one USB controller 😅

Is that really the only way?

Link to comment
  • 8 months later...

I recently ran into this problem on a motherboard with no spare USB controllers or free PCIe slots so buying an expansion card or passing an existing controller through to the VM was not an option. In my case, I noticed that as long as the Bluetooth dongle was kept active all connected devices would remain attached and usable. I "solved" the issue in the Windows VM by running a Bluetooth scanning program which would constantly keep the Bluetooth connection active. I configured the scanner to run in the background as a Windows service which is kicked off on the login screen so that I am able to use my bluetooth keyboard and mouse to login to the VM.

This is the bluetooth scanning software I am using: https://www.nirsoft.net/utils/bluetooth_log_view.html
This solution was inspired by the following reddit post: https://www.reddit.com/r/VFIO/comments/hiwc5u/onboard_usb_bluetooth_passed_to_windows_10_guest/

 

For me, this solution is acceptable but suboptimal. I would prefer to find some way of fixing the underlying bluetooth-specific disconnect problems that occur when directly passing the dongle through to the VM. I have tried many approaches but am still hopeful there may be some VFIO options that could help.


Symptoms of the original problem

In my case, I also noticed that the bluetooth connection stopped responding to new events after a few seconds of inactivity but any existing events would still be processed. More specifically, on my bluetooth keyboard if I pressed and held down a key then a "key down event" would be sent and text would appear on screen but if I failed to lift my finger within ~3seconds the corresponding "key up event" would not be received and the VM would behave as though I was still pressing the key until I turned off bluetooth entirely. 

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.