Re: [PATCH 1/2] usb: host: xhci: Allow non-Intel usb_link_tunnel_mode reporting

From: Konrad Dybcio

Date: Thu May 07 2026 - 06:40:59 EST


On 5/5/26 2:14 PM, Mika Westerberg wrote:
> Hi,
>
> On Tue, May 05, 2026 at 10:55:04AM +0200, Konrad Dybcio wrote:
>> From: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
>>
>> The Thunderbolt framework relies on the USB core to create device links
>> for tunneled ports, so that the USB3 controller is only kept
>> runtime-resumed for the duration of the tunneling.
>>
>> Currently, retrieving that information is only possibe on Intel XHCI
>> hosts, through a vendor-specific capability. Extend xhci-plat to allow
>> plumbing a custom one.
>>
>> Signed-off-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
>> ---
>> drivers/usb/host/xhci-hub.c | 4 ++--
>> drivers/usb/host/xhci-plat.c | 2 ++
>> drivers/usb/host/xhci-plat.h | 1 +
>> drivers/usb/host/xhci.c | 6 +++++-
>> drivers/usb/host/xhci.h | 5 ++++-
>> 5 files changed, 14 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
>> index bacd0ddd0d09..09e5da912066 100644
>> --- a/drivers/usb/host/xhci-hub.c
>> +++ b/drivers/usb/host/xhci-hub.c
>> @@ -750,7 +750,7 @@ static int xhci_exit_test_mode(struct xhci_hcd *xhci)
>> }
>>
>> /**
>> - * xhci_port_is_tunneled() - Check if USB3 connection is tunneled over USB4
>> + * xhci_port_tunnel_mode() - Check if USB3 connection is tunneled over USB4
>> * @xhci: xhci host controller
>> * @port: USB3 port to be checked.
>> *
>> @@ -764,7 +764,7 @@ static int xhci_exit_test_mode(struct xhci_hcd *xhci)
>> * detecting USB3 over USB4 tunnels. USB_LINK_NATIVE or USB_LINK_TUNNELED
>> * otherwise.
>> */
>> -enum usb_link_tunnel_mode xhci_port_is_tunneled(struct xhci_hcd *xhci,
>> +enum usb_link_tunnel_mode xhci_port_tunnel_mode(struct xhci_hcd *xhci,
>> struct xhci_port *port)
>
> I'm wondering if this could be:
>
> bool xhci_port_is_tunneled()
>
> becase if I understand correctly that's the only information we need e.g is
> it going over tunnel or not.

It was originally introduced as a tristate enum in:

f46a6e165197 ("usb: Add tunnel_mode parameter to usb device structure")

but the usefulness of USB_LINK_UNKNOWN is limited to a dev_dbg() print..
I don't really have strong opinions either way

Konrad