From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: <gregkh@linuxfoundation.org>
Cc: <linux-usb@vger.kernel.org>,
mika.westerberg@linux.intel.com,
Mathias Nyman <mathias.nyman@linux.intel.com>,
Mario Limonciello <mario.limonciello@amd.com>,
Harry Wentland <harry.wentland@amd.com>
Subject: [PATCH] usb: acpi: fix boot hang due to early incorrect 'tunneled' USB3 device links
Date: Tue, 22 Oct 2024 15:37:42 +0300 [thread overview]
Message-ID: <20241022123742.3045707-1-mathias.nyman@linux.intel.com> (raw)
Fix a boot hang issue triggered when a USB3 device is incorrectly assumed
to be tunneled over USB4, thus attempting to create a device link between
the USB3 "consumer" device and the USB4 "supplier" Host Interface before
the USB4 side is properly bound to a driver.
This could happen if xhci isn't capable of detecting tunneled devices,
but ACPI tables contain all info needed to assume device is tunneled.
i.e. udev->tunnel_mode == USB_LINK_UNKNOWN.
If the USB4 host interface hasn't probed yet, then we know the USB3
device is not in a tunnel created by the USB4 Host Interface driver, so
don't try to create a device link in this case.
cc: Mario Limonciello <mario.limonciello@amd.com>
Fixes: f1bfb4a6fed6 ("usb: acpi: add device link between tunneled USB3 device and USB4 Host Interface")
Tested-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
---
drivers/usb/core/usb-acpi.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/usb/core/usb-acpi.c b/drivers/usb/core/usb-acpi.c
index 21585ed89ef8..9e1ec71881db 100644
--- a/drivers/usb/core/usb-acpi.c
+++ b/drivers/usb/core/usb-acpi.c
@@ -173,6 +173,17 @@ static int usb_acpi_add_usb4_devlink(struct usb_device *udev)
if (IS_ERR(nhi_fwnode))
return 0;
+ /*
+ * If USB4 Host interface driver isn't set up yet we can't be in a USB3
+ * tunnel created by it.
+ */
+ if (!nhi_fwnode->dev || !device_is_bound(nhi_fwnode->dev)) {
+ dev_info(&port_dev->dev, "%s probed before USB4 host interface\n",
+ dev_name(&port_dev->child->dev));
+ udev->tunnel_mode = USB_LINK_NATIVE;
+ return 0;
+ }
+
link = device_link_add(&port_dev->child->dev, nhi_fwnode->dev,
DL_FLAG_AUTOREMOVE_CONSUMER |
DL_FLAG_RPM_ACTIVE |
--
2.25.1
next reply other threads:[~2024-10-22 12:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-22 12:37 Mathias Nyman [this message]
2024-10-22 12:51 ` [PATCH] usb: acpi: fix boot hang due to early incorrect 'tunneled' USB3 device links Mario Limonciello
2024-10-22 13:22 ` Mika Westerberg
2024-10-23 12:12 ` Mathias Nyman
2024-10-23 16:50 ` Mario Limonciello
2024-10-23 18:07 ` Harry Wentland
2024-10-24 10:57 ` Mathias Nyman
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=20241022123742.3045707-1-mathias.nyman@linux.intel.com \
--to=mathias.nyman@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=harry.wentland@amd.com \
--cc=linux-usb@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=mika.westerberg@linux.intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.