[Bug 218876] PCIE device crash when trying to pass through USB PCIe Card to virtual machine

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



https://bugzilla.kernel.org/show_bug.cgi?id=218876

--- Comment #6 from TJ (linux@xxxxxx) ---
Thanks for the logs. An overview of how devices are connected. The PCIE Root
port at address 00:09.0 (Bus:Device:Function) is the 'parent' of the USB host
controller on Bus 02:00.0.

The issue here appears to be that when the USB host controller is removed it
may actually go into D3Cold state. This actually removes power and, currently,
Linux kernel has no mechanism to control power on PCI bus [0].

There are three possible work-arounds I can think of worth testing:

  1. remove 00:09.0 and then rescan its parent root complex since that *may*
trigger power to be restored to the port (use the script I shared with you on
IRC via termbin)

  2. unbind [1] the xhci_hcd driver from the device *before* trying to start
the VM or loading vfio-pci (this could be scripted) so the device remains
powered:

  # echo 0000:02:0.0 > /sys/bus/pci/drivers/xhci_hcd/unbind

  3. avoid this altogether if the USB host controller is only ever wanted for
use in the guest virtual machine by reserving the device so the host's XHCI
controller driver never claims it via kernel command-line; something like:
vfio-pci.ids=1912:0014 - but this would require ensuring that vfio-pci was
loaded *very* early in the initrd processing to take control of the USB host
controller before xhci_hcd gets to it! I don't think there is an easy way to
ensure ordering the module load order for that aside from a custom udev rule
that loads vfio-pci for this device ID.



[0]
https://www.kernel.org/doc/html/latest/power/pci.html#native-pci-power-management

[1] https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-pci

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux