History log of /linux-6.15/drivers/thunderbolt/retimer.c (Results 1 – 25 of 30)
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
# ad79c278 05-Mar-2025 Mika Westerberg <[email protected]>

thunderbolt: Do not add non-active NVM if NVM upgrade is disabled for retimer

This is only used to write a new NVM in order to upgrade the retimer
firmware. It does not make sense to expose it if up

thunderbolt: Do not add non-active NVM if NVM upgrade is disabled for retimer

This is only used to write a new NVM in order to upgrade the retimer
firmware. It does not make sense to expose it if upgrade is disabled.
This also makes it consistent with the router NVM upgrade.

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

show more ...


Revision tags: 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
# f1e8bf56 24-Dec-2024 Zijun Hu <[email protected]>

driver core: Constify API device_find_child() and adapt for various usages

Constify the following API:
struct device *device_find_child(struct device *dev, void *data,
int (*match)(struct device *

driver core: Constify API device_find_child() and adapt for various usages

Constify the following API:
struct device *device_find_child(struct device *dev, void *data,
int (*match)(struct device *dev, void *data));
To :
struct device *device_find_child(struct device *dev, const void *data,
device_match_t match);
typedef int (*device_match_t)(struct device *dev, const void *data);
with the following reasons:

- Protect caller's match data @*data which is for comparison and lookup
and the API does not actually need to modify @*data.

- Make the API's parameters (@match)() and @data have the same type as
all of other device finding APIs (bus|class|driver)_find_device().

- All kinds of existing device match functions can be directly taken
as the API's argument, they were exported by driver core.

Constify the API and adapt for various existing usages.

BTW, various subsystem changes are squashed into this commit to meet
'git bisect' requirement, and this commit has the minimal and simplest
changes to complement squashing shortcoming, and that may bring extra
code improvement.

Reviewed-by: Alison Schofield <[email protected]>
Reviewed-by: Takashi Sakamoto <[email protected]>
Acked-by: Uwe Kleine-König <[email protected]> # for drivers/pwm
Signed-off-by: Zijun Hu <[email protected]>
Reviewed-by: Jonathan Cameron <[email protected]>
Reviewed-by: Mathieu Poirier <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>

show more ...


Revision tags: v6.13-rc4, v6.13-rc3
# e34f1717 09-Dec-2024 Mario Limonciello <[email protected]>

thunderbolt: Don't display nvm_version unless upgrade supported

The read will never succeed if NVM wasn't initialized due to an unknown
format.

Add a new callback for visibility to only show when s

thunderbolt: Don't display nvm_version unless upgrade supported

The read will never succeed if NVM wasn't initialized due to an unknown
format.

Add a new callback for visibility to only show when supported.

Cc: [email protected]
Fixes: aef9c693e7e5 ("thunderbolt: Move vendor specific NVM handling into nvm.c")
Reported-by: Richard Hughes <[email protected]>
Closes: https://github.com/fwupd/fwupd/issues/8200
Signed-off-by: Mario Limonciello <[email protected]>
Signed-off-by: Mika Westerberg <[email protected]>

show more ...


Revision tags: v6.13-rc2, v6.13-rc1, v6.12, v6.12-rc7, v6.12-rc6, v6.12-rc5
# bf791751 24-Oct-2024 Mika Westerberg <[email protected]>

thunderbolt: Add only on-board retimers when !CONFIG_USB4_DEBUGFS_MARGINING

Normally there is no need to enumerate retimers on the other side of the
cable. This is only needed in special cases where

thunderbolt: Add only on-board retimers when !CONFIG_USB4_DEBUGFS_MARGINING

Normally there is no need to enumerate retimers on the other side of the
cable. This is only needed in special cases where user wants to run
receiver lane margining against the downstream facing port of a retimer.
Furthermore this might confuse the userspace tools such as fwupd because
it cannot read the information it expects from these retimers.

Fix this by changing the retimer enumeration code to add only on-board
retimers when CONFIG_USB4_DEBUGFS_MARGINING is not enabled.

Reported-by: AceLan Kao <[email protected]>
Tested-by: AceLan Kao <[email protected]>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219420
Cc: [email protected]
Fixes: ff6ab055e070 ("thunderbolt: Add receiver lane margining support for retimers")
Signed-off-by: Mika Westerberg <[email protected]>

show more ...


Revision tags: v6.12-rc4, v6.12-rc3, v6.12-rc2, v6.12-rc1
# e9e1b20f 25-Sep-2024 Mika Westerberg <[email protected]>

thunderbolt: Fix KASAN reported stack out-of-bounds read in tb_retimer_scan()

KASAN reported following issue:

BUG: KASAN: stack-out-of-bounds in tb_retimer_scan+0xffe/0x1550 [thunderbolt]
Read of

thunderbolt: Fix KASAN reported stack out-of-bounds read in tb_retimer_scan()

KASAN reported following issue:

BUG: KASAN: stack-out-of-bounds in tb_retimer_scan+0xffe/0x1550 [thunderbolt]
Read of size 4 at addr ffff88810111fc1c by task kworker/u56:0/11
CPU: 0 UID: 0 PID: 11 Comm: kworker/u56:0 Tainted: G U 6.11.0+ #1387
Tainted: [U]=USER
Workqueue: thunderbolt0 tb_handle_hotplug [thunderbolt]
Call Trace:
<TASK>
dump_stack_lvl+0x6c/0x90
print_report+0xd1/0x630
kasan_report+0xdb/0x110
__asan_report_load4_noabort+0x14/0x20
tb_retimer_scan+0xffe/0x1550 [thunderbolt]
tb_scan_port+0xa6f/0x2060 [thunderbolt]
tb_handle_hotplug+0x17b1/0x3080 [thunderbolt]
process_one_work+0x626/0x1100
worker_thread+0x6c8/0xfa0
kthread+0x2c8/0x3a0
ret_from_fork+0x3a/0x80
ret_from_fork_asm+0x1a/0x30

This happens because the loop variable still gets incremented by one so
max becomes 3 instead of 2, and this makes the second loop read past the
the array declared on the stack.

Fix this by assigning to max directly in the loop body.

Fixes: ff6ab055e070 ("thunderbolt: Add receiver lane margining support for retimers")
CC: [email protected]
Signed-off-by: Mika Westerberg <[email protected]>

show more ...


Revision tags: 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, 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, v6.8-rc6, v6.8-rc5, v6.8-rc4, v6.8-rc3, v6.8-rc2, v6.8-rc1, v6.7, v6.7-rc8, v6.7-rc7, v6.7-rc6, v6.7-rc5, v6.7-rc4, v6.7-rc3, v6.7-rc2, v6.7-rc1, 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, v6.5-rc5, 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
# ff6ab055 21-Mar-2023 Mika Westerberg <[email protected]>

thunderbolt: Add receiver lane margining support for retimers

Retimers support lane margining as well so make this available through
debugfs in the same way as we do for the USB4 ports. When this is

thunderbolt: Add receiver lane margining support for retimers

Retimers support lane margining as well so make this available through
debugfs in the same way as we do for the USB4 ports. When this is
enabled we also expose retimers on the other side of the cable because
typically margining is implemented only on direction towards the cable.
However, for the retimers on the other side of the cable we do not allow
NVM upgrade to avoid confusing the existing userspace (the same retimer
may now appear twice with different name) and is probably not a good
idea anyway.

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

show more ...


# 6d241fa0 20-Mar-2023 Mika Westerberg <[email protected]>

thunderbolt: Add sideband register access to debugfs

This makes it possible to read and write USB4 port and retimer sideband
registers through debugfs which is useful for debugging and manufacturing

thunderbolt: Add sideband register access to debugfs

This makes it possible to read and write USB4 port and retimer sideband
registers through debugfs which is useful for debugging and manufacturing
purposes. We add "sb_regs" debugfs attribute under each USB4 port and
retimer that is used to access the sideband.

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

show more ...


# e8241f66 16-Apr-2024 Mika Westerberg <[email protected]>

thunderbolt: Make usb4_port_sb_read/write() available outside of usb4.c

We need to call these from other files too so make them available
outside of usb4.c.

Signed-off-by: Mika Westerberg <mika.wes

thunderbolt: Make usb4_port_sb_read/write() available outside of usb4.c

We need to call these from other files too so make them available
outside of usb4.c.

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

show more ...


# d4d336f8 05-Apr-2024 Mika Westerberg <[email protected]>

thunderbolt: No need to loop over all retimers if access fails

When we read the NVM authentication status or unsetting the inbound SBTX
there is no point to continue the loop after first access to a

thunderbolt: No need to loop over all retimers if access fails

When we read the NVM authentication status or unsetting the inbound SBTX
there is no point to continue the loop after first access to a retimer
fails because there won't be any more retimers after this anyway so bail
out from the loops early.

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

show more ...


# 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 ...


# 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 ...


# 87200371 26-May-2023 Mika Westerberg <[email protected]>

thunderbolt: Enable/disable sideband depending on USB4 port offline mode

When USB4 port is in offline mode (this mean there is no device
attached) we want to keep the sideband up to make it possible

thunderbolt: Enable/disable sideband depending on USB4 port offline mode

When USB4 port is in offline mode (this mean there is no device
attached) we want to keep the sideband up to make it possible to
communicate with the retimers. In the same way there is no need to
enable sideband transactions when the USB4 port is not offline as they
are already up.

For this reason make the enabling/disabling depend on the USB4 port
offline status.

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

show more ...


# b7b83911 26-May-2023 Mika Westerberg <[email protected]>

thunderbolt: Do not send UNSET_INBOUND_SBTX when retimer NVM authentication started

Once retimer NVM authentication is started, sending UNSET_INBOUND_SBTX
will fail so avoid doing that. Only send it

thunderbolt: Do not send UNSET_INBOUND_SBTX when retimer NVM authentication started

Once retimer NVM authentication is started, sending UNSET_INBOUND_SBTX
will fail so avoid doing that. Only send it when we are writing an image
with not authentication or when the authentication failed early.

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

show more ...


# 1402ba08 26-May-2023 Mika Westerberg <[email protected]>

thunderbolt: Read retimer NVM authentication status prior tb_retimer_set_inbound_sbtx()

According to the USB4 retimer guide the correct order is immediately
after sending ENUMERATE_RETIMERS so updat

thunderbolt: Read retimer NVM authentication status prior tb_retimer_set_inbound_sbtx()

According to the USB4 retimer guide the correct order is immediately
after sending ENUMERATE_RETIMERS so update the code to follow this.

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

show more ...


# f1138fda 24-Mar-2023 Mika Westerberg <[email protected]>

thunderbolt: Drop retimer vendor check

This is not needed anymore as we already handle unknown vendor in NVM
functions.

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


Revision tags: v6.3-rc3, v6.3-rc2, v6.3-rc1
# cd0c1e58 02-Mar-2023 Gil Fine <[email protected]>

thunderbolt: Add missing UNSET_INBOUND_SBTX for retimer access

According to USB4 retimer specification, the process of firmware update
sequence requires issuing a SET_INBOUND_SBTX port operation tha

thunderbolt: Add missing UNSET_INBOUND_SBTX for retimer access

According to USB4 retimer specification, the process of firmware update
sequence requires issuing a SET_INBOUND_SBTX port operation that later
shall be followed by UNSET_INBOUND_SBTX port operation. This last step
is not currently issued by the driver but it is necessary to make sure
the retimers are put back to passthrough mode even during enumeration.

If this step is missing the link may not come up properly after
soft-reboot for example.

For this reason issue UNSET_INBOUND_SBTX after SET_INBOUND_SBTX for
enumeration and also when the NVM upgrade is run.

Reported-by: Christian Schaubschläger <[email protected]>
Link: https://lore.kernel.org/linux-usb/[email protected]/
Cc: [email protected]
Signed-off-by: Gil Fine <[email protected]>
Signed-off-by: Mika Westerberg <[email protected]>

show more ...


Revision tags: v6.2, v6.2-rc8, v6.2-rc7, v6.2-rc6, v6.2-rc5, v6.2-rc4, v6.2-rc3, v6.2-rc2
# 23257cfc 29-Dec-2022 Mika Westerberg <[email protected]>

thunderbolt: Do not call PM runtime functions in tb_retimer_scan()

We cannot call PM runtime functions in tb_retimer_scan() because it will
also be called when retimers are scanned from userspace (h

thunderbolt: Do not call PM runtime functions in tb_retimer_scan()

We cannot call PM runtime functions in tb_retimer_scan() because it will
also be called when retimers are scanned from userspace (happens when
there is no device connected on ChromeOS for instance) and at the same
USB4 port runtime resume hook. This leads to hang because neither can
proceed.

Fix this by runtime resuming USB4 ports in tb_scan_port() instead. This
makes sure the ports are runtime PM active when retimers are added under
it while avoiding the reported hang as well.

Reported-by: Utkarsh Patel <[email protected]>
Fixes: 1e56c88adecc ("thunderbolt: Runtime resume USB4 port when retimers are scanned")
Cc: [email protected]
Acked-by: Yehezkel Bernat <[email protected]>
Signed-off-by: Mika Westerberg <[email protected]>

show more ...


Revision tags: v6.2-rc1
# c28f3d80 23-Dec-2022 Utkarsh Patel <[email protected]>

thunderbolt: Do not report errors if on-board retimers are found

Currently we return an error even if on-board retimers are found and
that's not expected. Fix this to return an error only if there w

thunderbolt: Do not report errors if on-board retimers are found

Currently we return an error even if on-board retimers are found and
that's not expected. Fix this to return an error only if there was one
and 0 otherwise.

Fixes: 1e56c88adecc ("thunderbolt: Runtime resume USB4 port when retimers are scanned")
Cc: [email protected]
Signed-off-by: Utkarsh Patel <[email protected]>
Signed-off-by: Mika Westerberg <[email protected]>

show more ...


Revision tags: 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, v6.0, v6.0-rc7
# 8283fb57 22-Sep-2022 Andy Shevchenko <[email protected]>

thunderbolt: Convert to use sysfs_emit()/sysfs_emit_at() APIs

Follow the advice of the Documentation/filesystems/sysfs.rst and show()
should only use sysfs_emit() or sysfs_emit_at() when formatting

thunderbolt: Convert to use sysfs_emit()/sysfs_emit_at() APIs

Follow the advice of the Documentation/filesystems/sysfs.rst and show()
should only use sysfs_emit() or sysfs_emit_at() when formatting the value
to be returned to user space.

While at it, use Elvis operator in some cases.

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

show more ...


Revision tags: v6.0-rc6, v6.0-rc5, v6.0-rc4
# aef9c693 02-Sep-2022 Szuying Chen <[email protected]>

thunderbolt: Move vendor specific NVM handling into nvm.c

As there will be more USB4 devices that support NVM firmware upgrade from
various vendors, it makes sense to split out the Intel specific NV

thunderbolt: Move vendor specific NVM handling into nvm.c

As there will be more USB4 devices that support NVM firmware upgrade from
various vendors, it makes sense to split out the Intel specific NVM
image handling from the generic code. This moves the Intel specific NVM
handling into a new structure that will be matched by the device type
and the vendor ID. Do this for both routers and retimers.

This makes it easier to extend the NVM support to cover new vendors and
NVM image formats in the future.

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

show more ...


# 8b02b2da 03-Sep-2022 Mika Westerberg <[email protected]>

thunderbolt: Provide tb_retimer_nvm_read() analogous to tb_switch_nvm_read()

As we are moving the NVM vendor specifics into nvm.c we need to deal
witht he retimer NVM formats too. For this reason pr

thunderbolt: Provide tb_retimer_nvm_read() analogous to tb_switch_nvm_read()

As we are moving the NVM vendor specifics into nvm.c we need to deal
witht he retimer NVM formats too. For this reason provide retimer
specific function that can be used to read the contents of the NVM and
rename the internal ones accordingly analogous to what we do with
routers.

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

show more ...


# 5424e1bf 02-Sep-2022 Szuying Chen <[email protected]>

thunderbolt: Extend NVM version fields to 32-bits

In order to support non-Intel NVM image formats extend the NVM major and
minor version to 32-bits to better accommondate different versioning
scheme

thunderbolt: Extend NVM version fields to 32-bits

In order to support non-Intel NVM image formats extend the NVM major and
minor version to 32-bits to better accommondate different versioning
schemes.

No functional impact.

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

show more ...


Revision tags: v6.0-rc3, v6.0-rc2, v6.0-rc1, v5.19, v5.19-rc8, v5.19-rc7, v5.19-rc6, v5.19-rc5, v5.19-rc4, v5.19-rc3, v5.19-rc2, v5.19-rc1, v5.18, v5.18-rc7, v5.18-rc6, v5.18-rc5, v5.18-rc4, v5.18-rc3, v5.18-rc2, v5.18-rc1, v5.17, v5.17-rc8, v5.17-rc7, v5.17-rc6, v5.17-rc5, v5.17-rc4, v5.17-rc3, v5.17-rc2, v5.17-rc1, v5.16, v5.16-rc8, v5.16-rc7, v5.16-rc6, v5.16-rc5, v5.16-rc4, v5.16-rc3, v5.16-rc2
# 1e56c88a 15-Nov-2021 Mika Westerberg <[email protected]>

thunderbolt: Runtime resume USB4 port when retimers are scanned

Sometimes when plugging in a USB4 device we might see following error:

thunderbolt 1-0:3.1: runtime PM trying to activate child dev

thunderbolt: Runtime resume USB4 port when retimers are scanned

Sometimes when plugging in a USB4 device we might see following error:

thunderbolt 1-0:3.1: runtime PM trying to activate child device 1-0:3.1 but parent (usb4_port3) is not active

This happens because the parent USB4 port was still runtime suspended.
Fix this by runtime resuming the USB4 port before scanning the retimers
below it.

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

show more ...


Revision tags: v5.16-rc1, v5.15, v5.15-rc7, v5.15-rc6, v5.15-rc5, v5.15-rc4, v5.15-rc3, v5.15-rc2, v5.15-rc1, v5.14, v5.14-rc7, v5.14-rc6, v5.14-rc5, v5.14-rc4, v5.14-rc3, v5.14-rc2, v5.14-rc1, v5.13, v5.13-rc7, v5.13-rc6, v5.13-rc5, v5.13-rc4, v5.13-rc3, v5.13-rc2, v5.13-rc1, v5.12
# 25335b30 21-Apr-2021 Mika Westerberg <[email protected]>

thunderbolt: Check for NVM authentication status after the operation started

If the NVM authentication fails immediately, like if the firmware
detects that the image is not valid for some reason, be

thunderbolt: Check for NVM authentication status after the operation started

If the NVM authentication fails immediately, like if the firmware
detects that the image is not valid for some reason, better to read the
status once and if set to non-zero fail the operation accordingly.

Signed-off-by: Mika Westerberg <[email protected]>
Reviewed-by: Greg Kroah-Hartman <[email protected]>

show more ...


Revision tags: v5.12-rc8
# faa1c615 12-Apr-2021 Rajmohan Mani <[email protected]>

thunderbolt: Add WRITE_ONLY and AUTHENTICATE_ONLY NVM operations for retimers

The same way we support these two operations for USB4 routers we can
extend the retimer NVM operations to support retime

thunderbolt: Add WRITE_ONLY and AUTHENTICATE_ONLY NVM operations for retimers

The same way we support these two operations for USB4 routers we can
extend the retimer NVM operations to support retimers also.

Signed-off-by: Rajmohan Mani <[email protected]>
Co-developed-by: Mika Westerberg <[email protected]>
Signed-off-by: Mika Westerberg <[email protected]>
Reviewed-by: Greg Kroah-Hartman <[email protected]>

show more ...


12