Threadripper USB Passthrough glitch

Hi,

I have built a Threadripper home server with the following spec:

OS: Proxmox 5.3
CPU: 1920X
RAM: 64GB ECC
MB: Asrock X399 Professional Gaming @ BIOS 3.30
GPU: Inno3D 1050Ti
HBA: SAS9305-16i

SVM, ACS, PCIe ARI, IOMMU, SR-IOV Enabled in BIOS.

GPU Passthrough works very well using vBIOS patcher, however I met a glitch when passing USB Controller. Both USB controllers are isolated in their IOMMU group.

IOMMU group 22: [1022:145c] 08:00.3 USB controller: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) USB 3.0 Host Controller
IOMMU group 40: [1022:145c] 42:00.3 USB controller: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) USB 3.0 Host Controller

I passed one of them to the VM, but if there is anything plugged in the USB port when VM start, the whole system will hang. It works if I unplug the USB device and replug it after VM start. VM reboot is not affected.

By default USB Controllers are using xhci_hcd driver, it seems like xhci_hcd has trouble when passing control to vfio_pci with device attached.

To resolve this issue I had to use a script:

echo 0000:42:00.3 > /sys/bus/pci/devices/0000:42:00.3/driver/unbind
echo 0000:42:00.3 > /sys/bus/pci/drivers/vfio-pci/bind
echo 0x1022 0x145c > /sys/bus/pci/drivers/vfio-pci/new_id

Has anyone met this issue ? Since no one mentioned this problem when passing USB with Threadripper.

ive had a similar issue before. it seemed to me to be xhci_hcd causing issues when being unbound. i solved it by loading vfio-pci at boot time via rc.local and never letting xhci_hcd get bound to the USB controller.