I tried to pass through a USB controller to my virtual machine using it’s PCI ID but it crashes my computer on VM boot.
The ID looks like it’s a part of a group of five other devices but the IOMMU group script shows that they’re using separate groups.
IOMMU group script:
#!/bin/bash
shopt -s nullglob
for g in $(find /sys/kernel/iommu_groups/* -maxdepth 0 -type d | sort -V); do
echo "IOMMU Group ${g##*/}:"
for d in $g/devices/*; do
echo -e "\t$(lspci -nns ${d##*/})"
done;
done;
Script output:
IOMMU Group 20:
30:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Cezanne [Radeon Vega Series / Radeon Vega Mobile Series] [1002:1638] (rev c8)
IOMMU Group 21:
30:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Renoir/Cezanne HDMI/DP Audio Controller [1002:1637]
IOMMU Group 22:
30:00.2 Encryption controller [1080]: Advanced Micro Devices, Inc. [AMD] Raven/Raven2/FireFlight/Renoir/Cezanne Platform Security Processor [1022:15df]
IOMMU Group 23:
30:00.3 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne USB 3.1 [1022:1639]
IOMMU Group 24:
30:00.4 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne USB 3.1 [1022:1639]
IOMMU Group 25:
30:00.6 Audio device [0403]: Advanced Micro Devices, Inc. [AMD] Family 17h/19h/1ah HD Audio Controller [1022:15e3]
To connect it to my VM I attempted to attach the USB controller to vfio-pci using modprobe on boot but lspci showed that it wasn’t.
/etc/modprobe.d/vfio.conf
options vfio-pci ids=1022:1639
30:00.3 USB controller: Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne USB 3.1 (prog-if 30 [XHCI])
Subsystem: Micro-Star International Co., Ltd. [MSI] Device 7d54
Flags: bus master, fast devsel, latency 0, IRQ 71, IOMMU group 23
Memory at fc900000 (64-bit, non-prefetchable) [size=1M]
Capabilities: <access denied>
Kernel driver in use: xhci_hcd