From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: <linux-usb@vger.kernel.org>, <gregkh@linuxfoundation.org>
Cc: mika.westerberg@linux.intel.com,
Mathias Nyman <mathias.nyman@linux.intel.com>
Subject: [PATCH 2/4] usb: Add tunneled parameter to usb device structure
Date: Wed, 19 Jun 2024 16:03:03 +0300 [thread overview]
Message-ID: <20240619130305.2617784-3-mathias.nyman@linux.intel.com> (raw)
In-Reply-To: <20240619130305.2617784-1-mathias.nyman@linux.intel.com>
Add 'tunneled' parameter to usb device structure to describe if a device
connection is tunneled over USB4 or connected directly using native
USB2/USB3.
Tunneled devices depend on USB4 NHI host to maintain the tunnel.
Knowledge about tunneled devices is important to ensure correct
suspend and resume order between USB4 hosts and tunneled devices.
i.e. make sure tunnel is up before the USB device using it resumes.
USB hosts such as xHCI have vendor specific ways to detect tunneled
connections. This 'tunneled' parameter can be set by USB3 host driver
during hcd->driver->update_device(hcd, udev) callback
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
---
drivers/usb/host/xhci.c | 3 ++-
include/linux/usb.h | 2 ++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index a85173098de1..e11251e3e4fc 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -4517,7 +4517,8 @@ static int xhci_update_device(struct usb_hcd *hcd, struct usb_device *udev)
if (hcd->speed >= HCD_USB3 && !udev->parent->parent) {
port = xhci->usb3_rhub.ports[udev->portnum - 1];
- if (xhci_port_is_tunneled(xhci, port))
+ udev->tunneled = xhci_port_is_tunneled(xhci, port);
+ if (udev->tunneled)
dev_dbg(&udev->dev, "tunneled over USB4 link\n");
else
dev_dbg(&udev->dev, "native USB 3.x link\n");
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 1913a13833f2..a4c5c09ea2bd 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -605,6 +605,7 @@ struct usb3_lpm_parameters {
* WUSB devices are not, until we authorize them from user space.
* FIXME -- complete doc
* @authenticated: Crypto authentication passed
+ * @tunneled: Connected to root port and tunneled over USB4
* @lpm_capable: device supports LPM
* @lpm_devinit_allow: Allow USB3 device initiated LPM, exit latency is in range
* @usb2_hw_lpm_capable: device can perform USB2 hardware LPM
@@ -685,6 +686,7 @@ struct usb_device {
unsigned have_langid:1;
unsigned authorized:1;
unsigned authenticated:1;
+ unsigned tunneled:1;
unsigned lpm_capable:1;
unsigned lpm_devinit_allow:1;
unsigned usb2_hw_lpm_capable:1;
--
2.25.1
next prev parent reply other threads:[~2024-06-19 13:01 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-19 13:03 [PATCH 0/4] Add device links between tunneled USB3 devices and USB4 Host Mathias Nyman
2024-06-19 13:03 ` [PATCH 1/4] xhci: Add USB4 tunnel detection for USB3 devices on Intel hosts Mathias Nyman
2024-06-19 13:03 ` Mathias Nyman [this message]
2024-06-19 13:03 ` [PATCH 3/4] usb: acpi: add device link between tunneled USB3 device and USB4 Host Interface Mathias Nyman
2024-06-19 13:03 ` [PATCH 4/4] thunderbolt: Don't create device link from USB4 Host Interface to USB3 xHC host Mathias Nyman
2024-06-20 6:41 ` [PATCH 0/4] Add device links between tunneled USB3 devices and USB4 Host Mika Westerberg
2024-06-20 18:36 ` Mario Limonciello
2024-06-21 6:19 ` Mika Westerberg
2024-06-21 16:30 ` Mario Limonciello
2024-06-24 4:59 ` Mika Westerberg
2024-06-24 18:41 ` Mario Limonciello
2024-06-25 5:02 ` Mika Westerberg
2024-06-25 14:37 ` Mathias Nyman
2024-06-25 14:45 ` Mika Westerberg
2024-06-25 14:55 ` Mario Limonciello
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=20240619130305.2617784-3-mathias.nyman@linux.intel.com \
--to=mathias.nyman@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-usb@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox