History log of /linux-6.15/drivers/thunderbolt/switch.c (Results 1 – 25 of 202)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: v6.15, v6.15-rc7, v6.15-rc6, v6.15-rc5, v6.15-rc4, v6.15-rc3, v6.15-rc2, v6.15-rc1, v6.14, v6.14-rc7, v6.14-rc6, v6.14-rc5, v6.14-rc4, v6.14-rc3, v6.14-rc2, v6.14-rc1, v6.13, v6.13-rc7, v6.13-rc6, v6.13-rc5, v6.13-rc4, v6.13-rc3, v6.13-rc2, v6.13-rc1, v6.12, v6.12-rc7, v6.12-rc6, v6.12-rc5, v6.12-rc4, v6.12-rc3, v6.12-rc2, v6.12-rc1, v6.11, v6.11-rc7, v6.11-rc6, v6.11-rc5, v6.11-rc4, v6.11-rc3, v6.11-rc2, v6.11-rc1, v6.10, v6.10-rc7, v6.10-rc6, v6.10-rc5, v6.10-rc4
# e2006140 13-Jun-2024 Mika Westerberg <[email protected]>

thunderbolt: Mark XDomain as unplugged when router is removed

I noticed that when we do discrete host router NVM upgrade and it gets
hot-removed from the PCIe side as a result of NVM firmware authen

thunderbolt: Mark XDomain as unplugged when router is removed

I noticed that when we do discrete host router NVM upgrade and it gets
hot-removed from the PCIe side as a result of NVM firmware authentication,
if there is another host connected with enabled paths we hang in tearing
them down. This is due to fact that the Thunderbolt networking driver
also tries to cleanup the paths and ends up blocking in
tb_disconnect_xdomain_paths() waiting for the domain lock.

However, at this point we already cleaned the paths in tb_stop() so
there is really no need for tb_disconnect_xdomain_paths() to do that
anymore. Furthermore it already checks if the XDomain is unplugged and
bails out early so take advantage of that and mark the XDomain as
unplugged when we remove the parent router.

Cc: [email protected]
Signed-off-by: Mika Westerberg <[email protected]>

show more ...


Revision tags: v6.10-rc3, v6.10-rc2, v6.10-rc1, v6.9, v6.9-rc7, v6.9-rc6, v6.9-rc5, v6.9-rc4, v6.9-rc3, v6.9-rc2, v6.9-rc1, v6.8, v6.8-rc7
# dcd12aca 01-Mar-2024 Gil Fine <[email protected]>

thunderbolt: Avoid notify PM core about runtime PM resume

Currently we notify PM core about occurred wakes after any resume. This
is not actually needed after resume from runtime suspend. Hence, not

thunderbolt: Avoid notify PM core about runtime PM resume

Currently we notify PM core about occurred wakes after any resume. This
is not actually needed after resume from runtime suspend. Hence, notify
PM core about occurred wakes only after resume from system sleep. Also,
if the wake occurred in USB4 router upstream port, we don't notify the
PM core about it since it is not actually needed and can cause
unexpected autowake (e.g. if /sys/power/wakeup_count is used).

While there add the missing kernel-doc for tb_switch_resume().

Signed-off-by: Gil Fine <[email protected]>
Cc: [email protected]
Signed-off-by: Mika Westerberg <[email protected]>

show more ...


# c38fa07d 01-Mar-2024 Gil Fine <[email protected]>

thunderbolt: Fix wake configurations after device unplug

Currently we don't configure correctly the wake events after unplug of device
router. What can happen is that the downstream ports of host ro

thunderbolt: Fix wake configurations after device unplug

Currently we don't configure correctly the wake events after unplug of device
router. What can happen is that the downstream ports of host router will be
configured to wake on: USB4-wake and wake-on-disconnect, but not on
wake-on-connect. This may cause the later plugged device not to wake the
domain and fail in enumeration. Fix this by clearing downstream port's "USB4
Port is Configured" bit, after unplug of a device router.

Signed-off-by: Gil Fine <[email protected]>
Cc: [email protected]
Signed-off-by: Mika Westerberg <[email protected]>

show more ...


Revision tags: v6.8-rc6
# b8a73083 19-Feb-2024 Ricardo B. Marliere <[email protected]>

thunderbolt: Constify the struct device_type usage

Since commit aed65af1cc2f ("drivers: make device_type const"), the driver
core can properly handle constant struct device_type. Move the
tb_domain_

thunderbolt: Constify the struct device_type usage

Since commit aed65af1cc2f ("drivers: make device_type const"), the driver
core can properly handle constant struct device_type. Move the
tb_domain_type, tb_retimer_type, tb_switch_type, usb4_port_device_type,
tb_service_type and tb_xdomain_type variables to be constant structures as
well, placing it into read-only memory which can not be modified at
runtime.

Cc: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Ricardo B. Marliere <[email protected]>
Signed-off-by: Mika Westerberg <[email protected]>

show more ...


Revision tags: v6.8-rc5
# d3d17e23 12-Feb-2024 Mika Westerberg <[email protected]>

thunderbolt: Fix NULL pointer dereference in tb_port_update_credits()

Olliver reported that his system crashes when plugging in Thunderbolt 1
device:

BUG: kernel NULL pointer dereference, address:

thunderbolt: Fix NULL pointer dereference in tb_port_update_credits()

Olliver reported that his system crashes when plugging in Thunderbolt 1
device:

BUG: kernel NULL pointer dereference, address: 0000000000000020
#PF: supervisor read access in kernel mode
#PF: error_code(0x0000) - not-present page
PGD 0 P4D 0
Oops: 0000 [#1] PREEMPT SMP NOPTI
RIP: 0010:tb_port_do_update_credits+0x1b/0x130 [thunderbolt]
Call Trace:
<TASK>
? __die+0x23/0x70
? page_fault_oops+0x171/0x4e0
? exc_page_fault+0x7f/0x180
? asm_exc_page_fault+0x26/0x30
? tb_port_do_update_credits+0x1b/0x130
? tb_switch_update_link_attributes+0x83/0xd0
tb_switch_add+0x7a2/0xfe0
tb_scan_port+0x236/0x6f0
tb_handle_hotplug+0x6db/0x900
process_one_work+0x171/0x340
worker_thread+0x27b/0x3a0
? __pfx_worker_thread+0x10/0x10
kthread+0xe5/0x120
? __pfx_kthread+0x10/0x10
ret_from_fork+0x31/0x50
? __pfx_kthread+0x10/0x10
ret_from_fork_asm+0x1b/0x30
</TASK>

This is due the fact that some Thunderbolt 1 devices only have one lane
adapter. Fix this by checking for the lane 1 before we read its credits.

Reported-by: Olliver Schinagl <[email protected]>
Closes: https://lore.kernel.org/linux-usb/[email protected]/
Fixes: 81af2952e606 ("thunderbolt: Add support for asymmetric link")
Cc: [email protected]
Cc: Gil Fine <[email protected]>
Signed-off-by: Mika Westerberg <[email protected]>

show more ...


Revision tags: v6.8-rc4, v6.8-rc3, v6.8-rc2, v6.8-rc1
# dec6a613 11-Jan-2024 Christophe JAILLET <[email protected]>

thunderbolt: Remove usage of the deprecated ida_simple_xx() API

ida_alloc() and ida_free() should be preferred to the deprecated
ida_simple_get() and ida_simple_remove().

Note that the upper limit

thunderbolt: Remove usage of the deprecated ida_simple_xx() API

ida_alloc() and ida_free() should be preferred to the deprecated
ida_simple_get() and ida_simple_remove().

Note that the upper limit of ida_simple_get() is exclusive, but the one of
ida_alloc_range()/ida_alloc_max() is inclusive. So a -1 has been added
when needed.

Signed-off-by: Christophe JAILLET <[email protected]>
Signed-off-by: Mika Westerberg <[email protected]>

show more ...


# e8f1297b 14-Jan-2024 Mohammad Rahimi <[email protected]>

thunderbolt: Fix rollback in tb_port_lane_bonding_enable() for lane 1

If enabling lane bonding on lane 1 of a USB4 port results in an error,
the rollback should set TB_LINK_WIDTH_SINGLE for both lan

thunderbolt: Fix rollback in tb_port_lane_bonding_enable() for lane 1

If enabling lane bonding on lane 1 of a USB4 port results in an error,
the rollback should set TB_LINK_WIDTH_SINGLE for both lanes.

Signed-off-by: Mohammad Rahimi <[email protected]>
Signed-off-by: Mika Westerberg <[email protected]>

show more ...


# ec8162b3 13-Jan-2024 Sanath S <[email protected]>

thunderbolt: Make tb_switch_reset() support Thunderbolt 2, 3 and USB4 routers

Currently tb_switch_reset() only did something for Thunderbolt 1
devices. Expand this to support all generations, includ

thunderbolt: Make tb_switch_reset() support Thunderbolt 2, 3 and USB4 routers

Currently tb_switch_reset() only did something for Thunderbolt 1
devices. Expand this to support all generations, including USB4, and
both host and device routers.

Signed-off-by: Sanath S <[email protected]>
Signed-off-by: Mika Westerberg <[email protected]>

show more ...


# 01da6b99 13-Jan-2024 Sanath S <[email protected]>

thunderbolt: Introduce tb_port_reset()

Introduce a function that issues Downstream Port Reset to a USB4 port.
This supports Thunderbolt 2, 3 and USB4 routers.

Signed-off-by: Sanath S <Sanath.S@amd.

thunderbolt: Introduce tb_port_reset()

Introduce a function that issues Downstream Port Reset to a USB4 port.
This supports Thunderbolt 2, 3 and USB4 routers.

Signed-off-by: Sanath S <[email protected]>
Signed-off-by: Mika Westerberg <[email protected]>

show more ...


Revision tags: v6.7, v6.7-rc8, v6.7-rc7, v6.7-rc6, v6.7-rc5
# ba2a2a86 04-Dec-2023 Gil Fine <[email protected]>

thunderbolt: Keep link as asymmetric if preferred by hardware

In case of the link is brought up as asymmetric (due to hardware preference), we
honor that and don't transition it to symmetric, unless

thunderbolt: Keep link as asymmetric if preferred by hardware

In case of the link is brought up as asymmetric (due to hardware preference), we
honor that and don't transition it to symmetric, unless a router with symmetric
link got plugged below, in the topology (and a bandwidth allows transition to
symmetric).

Signed-off-by: Gil Fine <[email protected]>
Signed-off-by: Mika Westerberg <[email protected]>

show more ...


Revision tags: v6.7-rc4, v6.7-rc3, v6.7-rc2, v6.7-rc1
# 30c6759b 05-Nov-2023 Gil Fine <[email protected]>

thunderbolt: Move width_name() helper to tb.h

We are going to use it in subsequent patches, so make it available outside of
switch.c. Also, change the name to tb_width_name() to follow the naming
co

thunderbolt: Move width_name() helper to tb.h

We are going to use it in subsequent patches, so make it available outside of
switch.c. Also, change the name to tb_width_name() to follow the naming
conventions.

Signed-off-by: Gil Fine <[email protected]>
Signed-off-by: Mika Westerberg <[email protected]>

show more ...


# 5391bcfa 07-Nov-2023 Mika Westerberg <[email protected]>

thunderbolt: Send uevent after asymmetric/symmetric switch

We should send uevent to userspace whenever the link speed or width
changes but tb_switch_asym_enable() and tb_switch_asym_disable() set th

thunderbolt: Send uevent after asymmetric/symmetric switch

We should send uevent to userspace whenever the link speed or width
changes but tb_switch_asym_enable() and tb_switch_asym_disable() set the
sw->link_width already so tb_switch_update_link_attributes() never
noticed the change.

Fix this so that we let tb_switch_update_link_attributes() update the
fields accordingly.

Fixes: 81af2952e606 ("thunderbolt: Add support for asymmetric link")
Reported-by: Pengfei Xu <[email protected]>
Tested-by: Pengfei Xu <[email protected]>
Signed-off-by: Mika Westerberg <[email protected]>

show more ...


# 24d85bb3 07-Nov-2023 Gil Fine <[email protected]>

thunderbolt: Set lane bonding bit only for downstream port

Fix the lane bonding procedure to follow the steps described in USB4
Connection Manager guide. Hence, set the lane bonding bit only for
dow

thunderbolt: Set lane bonding bit only for downstream port

Fix the lane bonding procedure to follow the steps described in USB4
Connection Manager guide. Hence, set the lane bonding bit only for
downstream port. This is needed for certain ASMedia device, otherwise
lane bonding fails and the device disconnects.

Cc: [email protected]
Signed-off-by: Gil Fine <[email protected]>
Signed-off-by: Mika Westerberg <[email protected]>

show more ...


Revision tags: v6.6, v6.6-rc7, v6.6-rc6, v6.6-rc5, v6.6-rc4, v6.6-rc3, v6.6-rc2, v6.6-rc1, v6.5, v6.5-rc7, v6.5-rc6
# 81af2952 10-Aug-2023 Gil Fine <[email protected]>

thunderbolt: Add support for asymmetric link

USB4 v2 spec defines a Gen 4 link that can operate as an aggregated
symmetric (80/80G) or asymmetric (120/40G). When the link is asymmetric,
the USB4 por

thunderbolt: Add support for asymmetric link

USB4 v2 spec defines a Gen 4 link that can operate as an aggregated
symmetric (80/80G) or asymmetric (120/40G). When the link is asymmetric,
the USB4 port on one side of the link operates with three TX lanes and
one RX lane, while the USB4 port on the opposite side of the link
operates with three RX lanes and one TX lane.

Add support for the asymmetric link and provide functions that can be
used to transition the link to asymmetric and back.

Signed-off-by: Gil Fine <[email protected]>
Co-developed-by: Mika Westerberg <[email protected]>
Signed-off-by: Mika Westerberg <[email protected]>

show more ...


Revision tags: v6.5-rc5
# aa673d60 31-Jul-2023 Gil Fine <[email protected]>

thunderbolt: Make is_gen4_link() available to the rest of the driver

Rework the function to return the link generation, update the name to
tb_port_get_link_generation(), and make available to the re

thunderbolt: Make is_gen4_link() available to the rest of the driver

Rework the function to return the link generation, update the name to
tb_port_get_link_generation(), and make available to the rest of the
driver. This is needed in the subsequent patches.

Signed-off-by: Gil Fine <[email protected]>
Signed-off-by: Mika Westerberg <[email protected]>

show more ...


# d80d926c 20-Sep-2023 Gil Fine <[email protected]>

thunderbolt: Log NVM version of routers and retimers

This is useful when debugging possible issues.

Signed-off-by: Gil Fine <[email protected]>
Signed-off-by: Mika Westerberg <mika.westerber

thunderbolt: Log NVM version of routers and retimers

This is useful when debugging possible issues.

Signed-off-by: Gil Fine <[email protected]>
Signed-off-by: Mika Westerberg <[email protected]>

show more ...


# 6ed0b900 10-Aug-2023 Gil Fine <[email protected]>

thunderbolt: Fix typo of HPD bit for Hot Plug Detect

Fix typo of HPD bit stands for Hot Plug Detect.

Signed-off-by: Gil Fine <[email protected]>
Signed-off-by: Mika Westerberg <mika.westerbe

thunderbolt: Fix typo of HPD bit for Hot Plug Detect

Fix typo of HPD bit stands for Hot Plug Detect.

Signed-off-by: Gil Fine <[email protected]>
Signed-off-by: Mika Westerberg <[email protected]>

show more ...


# a9fdf5f9 22-Aug-2023 Mika Westerberg <[email protected]>

thunderbolt: Check that lane 1 is in CL0 before enabling lane bonding

Marek reported that when BlackMagic UltraStudio device is connected the
kernel repeatedly tries to enable lane bonding without s

thunderbolt: Check that lane 1 is in CL0 before enabling lane bonding

Marek reported that when BlackMagic UltraStudio device is connected the
kernel repeatedly tries to enable lane bonding without success making
the device non-functional. It looks like the device does not have lane 1
connected at all so even though it is enabled we should not try to bond
the lanes. For this reason check that lane 1 is in fact CL0 (connected,
active) before attempting to bond the lanes.

Reported-by: Marek Šanta <[email protected]>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217737
Cc: [email protected]
Signed-off-by: Mika Westerberg <[email protected]>

show more ...


Revision tags: v6.5-rc4, v6.5-rc3, v6.5-rc2, v6.5-rc1, v6.4, v6.4-rc7, v6.4-rc6, v6.4-rc5, v6.4-rc4, v6.4-rc3, v6.4-rc2, v6.4-rc1, v6.3, v6.3-rc7, v6.3-rc6, v6.3-rc5, v6.3-rc4, v6.3-rc3, v6.3-rc2, v6.3-rc1, v6.2, v6.2-rc8, v6.2-rc7, v6.2-rc6, v6.2-rc5, v6.2-rc4, v6.2-rc3, v6.2-rc2
# d589fd42 28-Dec-2022 Mika Westerberg <[email protected]>

thunderbolt: Check Intel vendor ID in tb_switch_get_generation()

Only Intel made Thunderbolt 1-3 devices so to avoid possible confusion
check for the Intel vendor ID before deciding the device gener

thunderbolt: Check Intel vendor ID in tb_switch_get_generation()

Only Intel made Thunderbolt 1-3 devices so to avoid possible confusion
check for the Intel vendor ID before deciding the device generation.
While there move the USB4 check to happen first.

Signed-off-by: Mika Westerberg <[email protected]>

show more ...


Revision tags: v6.2-rc1, v6.1, v6.1-rc8, v6.1-rc7, v6.1-rc6, v6.1-rc5, v6.1-rc4, v6.1-rc3, v6.1-rc2, v6.1-rc1
# d49b4f04 11-Oct-2022 Mika Westerberg <[email protected]>

thunderbolt: Add support for enhanced uni-directional TMU mode

This is new TMU mode introduced with the USB4 v2. This mode is simpler
than the existing ones and allows all CL states as well. Enable

thunderbolt: Add support for enhanced uni-directional TMU mode

This is new TMU mode introduced with the USB4 v2. This mode is simpler
than the existing ones and allows all CL states as well. Enable this for
all links where both side routers are v2 and keep the existing
functionality for the v1 and earlier links.

Currently only support the MedRes rate. We can add the HiFi rate later
too if it turns out to be useful.

Signed-off-by: Mika Westerberg <[email protected]>

show more ...


Revision tags: v6.0
# 14200a26 29-Sep-2022 Gil Fine <[email protected]>

thunderbolt: Announce USB4 v2 connection manager support

Program the CMUV (Connection Manager USB4 Version) field for USB4 v2 and
v1 routers according to the spec.

Signed-off-by: Gil Fine <gil.fine

thunderbolt: Announce USB4 v2 connection manager support

Program the CMUV (Connection Manager USB4 Version) field for USB4 v2 and
v1 routers according to the spec.

Signed-off-by: Gil Fine <[email protected]>
Signed-off-by: Mika Westerberg <[email protected]>

show more ...


# e111fb92 29-Sep-2022 Gil Fine <[email protected]>

thunderbolt: Add support for USB4 v2 80 Gb/s link

USB4 v2 bumps the per-lane speed up to 40 Gb/s. Also the lanes are
always bonded which gives 80 Gb/s symmetric link (and 120/40 Gb/s
asymmetric). Th

thunderbolt: Add support for USB4 v2 80 Gb/s link

USB4 v2 bumps the per-lane speed up to 40 Gb/s. Also the lanes are
always bonded which gives 80 Gb/s symmetric link (and 120/40 Gb/s
asymmetric). This updates the speed and width of routers and XDomain
connections to support the Gen 4 link. For now we keep the link as is
even if it is already asymmetric.

While there make tb_port_set_link_width() static.

Signed-off-by: Gil Fine <[email protected]>
Signed-off-by: Mika Westerberg <[email protected]>

show more ...


Revision tags: v6.0-rc7
# 6e21007d 22-Sep-2022 Gil Fine <[email protected]>

thunderbolt: Identify USB4 v2 routers

Add a new function usb4_switch_version() that can be used to figure out
the spec version of the router and make tb_switch_is_usb4() to use it as
well. Update th

thunderbolt: Identify USB4 v2 routers

Add a new function usb4_switch_version() that can be used to figure out
the spec version of the router and make tb_switch_is_usb4() to use it as
well. Update the uevent accordingly.

Signed-off-by: Gil Fine <[email protected]>
Signed-off-by: Mika Westerberg <[email protected]>

show more ...


# 2ad3e131 16-Dec-2022 Mika Westerberg <[email protected]>

thunderbolt: Do not touch lane 1 adapter path config space

It is not required to be implemented at all because USB4 does not use
lane 1 for tunneling except when aggregated with lane 0. For this rea

thunderbolt: Do not touch lane 1 adapter path config space

It is not required to be implemented at all because USB4 does not use
lane 1 for tunneling except when aggregated with lane 0. For this reason
do not try to read the path config space of USB4 lane 1 adapters.

Signed-off-by: Mika Westerberg <[email protected]>

show more ...


# 768e6fe6 24-May-2023 Mika Westerberg <[email protected]>

thunderbolt: Initialize CL states from the hardware

In case the boot firmware enabled any of them, read the currently
configured CL states and update the router structure accordingly.

Signed-off-by

thunderbolt: Initialize CL states from the hardware

In case the boot firmware enabled any of them, read the currently
configured CL states and update the router structure accordingly.

Signed-off-by: Mika Westerberg <[email protected]>

show more ...


123456789