From: bugzilla-daemon@kernel.org
To: kvm@vger.kernel.org
Subject: [Bug 218876] PCIE device crash when trying to pass through USB PCIe Card to virtual machine
Date: Sat, 25 May 2024 13:49:01 +0000 [thread overview]
Message-ID: <bug-218876-28872-uejyK0cryi@https.bugzilla.kernel.org/> (raw)
In-Reply-To: <bug-218876-28872@https.bugzilla.kernel.org/>
https://bugzilla.kernel.org/show_bug.cgi?id=218876
--- Comment #6 from TJ (linux@iam.tj) ---
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.
next prev parent reply other threads:[~2024-05-25 13:49 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-22 19:31 [Bug 218876] New: PCIE device crash when trying to pass through USB Device to virtual machine bugzilla-daemon
2024-05-22 19:32 ` [Bug 218876] " bugzilla-daemon
2024-05-22 19:34 ` [Bug 218876] PCIE device crash when trying to pass through USB PCIe Card " bugzilla-daemon
2024-05-22 20:38 ` bugzilla-daemon
2024-05-23 14:35 ` bugzilla-daemon
2024-05-23 15:28 ` bugzilla-daemon
2024-05-23 15:28 ` bugzilla-daemon
2024-05-24 11:19 ` bugzilla-daemon
2024-05-25 13:49 ` bugzilla-daemon [this message]
2024-05-25 14:16 ` bugzilla-daemon
2024-05-25 14:20 ` bugzilla-daemon
2024-05-28 21:16 ` bugzilla-daemon
2024-05-29 10:42 ` bugzilla-daemon
2024-05-29 11:35 ` bugzilla-daemon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-218876-28872-uejyK0cryi@https.bugzilla.kernel.org/ \
--to=bugzilla-daemon@kernel.org \
--cc=kvm@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).