On 9/4/2024 00:00, Mika Westerberg wrote:
Hi,
On Tue, Sep 03, 2024 at 10:35:00AM -0500, Mario Limonciello wrote:
On 8/30/2024 10:26, Mathias Nyman wrote:
The relationship between a USB4 Host Interface providing USB3 tunnels,
and tunneled USB3 devices is not represented in device hierarchy.
This caused issues with power managment as devices may suspend and
resume in incorrect order.
A device link between the USB4 Host Interface and the USB3 xHCI was
originally added to solve this, preventing the USB4 Host Interface from
suspending if the USB3 xHCI Host was still active.
This unfortunately also prevents USB4 Host Interface from suspending even
if the USB3 xHCI Host is only serving native non-tunneled USB devices.
Improve the current powermanagement situation by creating device links
directly from tunneled USB3 devices to the USB4 Host Interface they depend
on instead of a device link between the hosts.
This way USB4 host may suspend when the last tunneled device is
disconnected.
Intel xHCI hosts are capable of reporting if connected USB3 devices are
tunneled via vendor specific capabilities.
Use this until a standard way is available.
v2:
Create device link by default if xHC host is not capable of tunnel
detection but the USB3 ports have tunnel capability reported in ACPI
_DSD object
Mathias Nyman (4):
xhci: Add USB4 tunnel detection for USB3 devices on Intel hosts
usb: Add tunnel_mode parameter to usb device structure
usb: acpi: add device link between tunneled USB3 device and USB4 Host
Interface
thunderbolt: Don't create device link from USB4 Host Interface to USB3
xHC host
drivers/thunderbolt/acpi.c | 40 ++++++------------------
drivers/usb/core/usb-acpi.c | 53 ++++++++++++++++++++++++++++++++
drivers/usb/host/xhci-ext-caps.h | 5 +++
drivers/usb/host/xhci-hub.c | 36 ++++++++++++++++++++++
drivers/usb/host/xhci.c | 14 +++++++++
drivers/usb/host/xhci.h | 3 +-
include/linux/usb.h | 8 +++++
7 files changed, 128 insertions(+), 31 deletions(-)
Hello,
I had a try with this version of the series but I'm missing a device link
from XHCI controller after applying it.
Before series these are the two links (6.11-rc6):
consumer:pci:0000:00:03.1 ->
../../../virtual/devlink/pci:0000:c4:00.5--pci:0000:00:03.1
consumer:pci:0000:c4:00.3 ->
../../../virtual/devlink/pci:0000:c4:00.5--pci:0000:c4:00.3
After 6.11-rc6 + v2 series only this link:
consumer:pci:0000:00:03.1 ->
../../../virtual/devlink/pci:0000:c4:00.5--pci:0000:00:03.1
Do you have device connected? The link will now be created only when
there is a device router with USB 3.x hub/device connected.
Ah thanks for clarifying.
I connected a TBT4-UDZ and I see another link show up now.
0000:c4:00.6/consumer:usb:8-1 ->
../../../virtual/devlink/pci:0000:c4:00.6--usb:8-1
However, something seems wrong with runtime PM when the device is
disconnected. Let me show you:
❯ ls -l /sys/bus/pci/drivers/thunderbolt/*/consumer*
lrwxrwxrwx 1 root root 0 Sep 4 12:33
/sys/bus/pci/drivers/thunderbolt/0000:c4:00.5/consumer:pci:0000:00:03.1
-> ../../../virtual/devlink/pci:0000:c4:00.5--pci:0000:00:03.1/
lrwxrwxrwx 1 root root 0 Sep 4 12:33
/sys/bus/pci/drivers/thunderbolt/0000:c4:00.6/consumer:pci:0000:00:04.1
-> ../../../virtual/devlink/pci:0000:c4:00.6--pci:0000:00:04.1/
❯ cat /sys/bus/pci/drivers/thunderbolt/*/power/runtime_status
suspended
suspended
(connect dock)
❯ ls -l /sys/bus/pci/drivers/thunderbolt/*/consumer*
lrwxrwxrwx 1 root root 0 Sep 4 12:33
/sys/bus/pci/drivers/thunderbolt/0000:c4:00.5/consumer:pci:0000:00:03.1
-> ../../../virtual/devlink/pci:0000:c4:00.5--pci:0000:00:03.1/
lrwxrwxrwx 1 root root 0 Sep 4 12:33
/sys/bus/pci/drivers/thunderbolt/0000:c4:00.6/consumer:pci:0000:00:04.1
-> ../../../virtual/devlink/pci:0000:c4:00.6--pci:0000:00:04.1/
lrwxrwxrwx 1 root root 0 Sep 4 12:34
/sys/bus/pci/drivers/thunderbolt/0000:c4:00.6/consumer:usb:8-1 ->
../../../virtual/devlink/pci:0000:c4:00.6--usb:8-1/
❯ cat /sys/bus/pci/drivers/thunderbolt/*/power/runtime_status
suspended
active
(unconnect dock and wait at least autosuspend_delay)
❯ ls -l /sys/bus/pci/drivers/thunderbolt/*/consumer*
lrwxrwxrwx 1 root root 0 Sep 4 12:33
/sys/bus/pci/drivers/thunderbolt/0000:c4:00.5/consumer:pci:0000:00:03.1
-> ../../../virtual/devlink/pci:0000:c4:00.5--pci:0000:00:03.1/
lrwxrwxrwx 1 root root 0 Sep 4 12:33
/sys/bus/pci/drivers/thunderbolt/0000:c4:00.6/consumer:pci:0000:00:04.1
-> ../../../virtual/devlink/pci:0000:c4:00.6--pci:0000:00:04.1/
❯ cat /sys/bus/pci/drivers/thunderbolt/*/power/runtime_status
suspended
active
I would have expected the USB4 host router to go back into runtime PM,
but it doesn't anymore until I reboot the system.