<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/thunderbolt/usb4.c, branch v6.12.80</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.12.80</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.12.80'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2025-07-24T06:56:21+00:00</updated>
<entry>
<title>thunderbolt: Fix wake on connect at runtime</title>
<updated>2025-07-24T06:56:21+00:00</updated>
<author>
<name>Mario Limonciello</name>
<email>mario.limonciello@amd.com</email>
</author>
<published>2025-06-19T21:38:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=17a6ea23890e4ac5dd350738edce475c3337e225'/>
<id>urn:sha1:17a6ea23890e4ac5dd350738edce475c3337e225</id>
<content type='text'>
commit 58d71d4242ce057955c783a14c82270c71f9e1e8 upstream.

commit 1a760d10ded37 ("thunderbolt: Fix a logic error in wake on connect")
fixated on the USB4 port sysfs wakeup file not working properly to control
policy, but it had an unintended side effect that the sysfs file controls
policy both at runtime and at suspend time. The sysfs file is supposed to
only control behavior while system is suspended.

Pass whether programming a port for runtime into usb4_switch_set_wake()
and if runtime then ignore the value in the sysfs file.

Cc: stable@vger.kernel.org
Reported-by: Alexander Kovacs &lt;Alexander.Kovacs@amd.com&gt;
Tested-by: Alexander Kovacs &lt;Alexander.Kovacs@amd.com&gt;
Fixes: 1a760d10ded37 ("thunderbolt: Fix a logic error in wake on connect")
Signed-off-by: Mario Limonciello &lt;mario.limonciello@amd.com&gt;
Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>thunderbolt: Fix a logic error in wake on connect</title>
<updated>2025-06-19T13:32:11+00:00</updated>
<author>
<name>Mario Limonciello</name>
<email>mario.limonciello@amd.com</email>
</author>
<published>2025-04-11T15:14:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=74aca5ca341de6b8ebe91f54925eea2c911de33f'/>
<id>urn:sha1:74aca5ca341de6b8ebe91f54925eea2c911de33f</id>
<content type='text'>
[ Upstream commit 1a760d10ded372d113a0410c42be246315bbc2ff ]

commit a5cfc9d65879c ("thunderbolt: Add wake on connect/disconnect
on USB4 ports") introduced a sysfs file to control wake up policy
for a given USB4 port that defaulted to disabled.

However when testing commit 4bfeea6ec1c02 ("thunderbolt: Use wake
on connect and disconnect over suspend") I found that it was working
even without making changes to the power/wakeup file (which defaults
to disabled). This is because of a logic error doing a bitwise or
of the wake-on-connect flag with device_may_wakeup() which should
have been a logical AND.

Adjust the logic so that policy is only applied when wakeup is
actually enabled.

Fixes: a5cfc9d65879c ("thunderbolt: Add wake on connect/disconnect on USB4 ports")
Signed-off-by: Mario Limonciello &lt;mario.limonciello@amd.com&gt;
Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>thunderbolt: Fix connection issue with Pluggable UD-4VPD dock</title>
<updated>2024-11-05T14:29:47+00:00</updated>
<author>
<name>Mika Westerberg</name>
<email>mika.westerberg@linux.intel.com</email>
</author>
<published>2024-11-05T07:19:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=bd646c768a934d28e574ee940d6759c7954a024d'/>
<id>urn:sha1:bd646c768a934d28e574ee940d6759c7954a024d</id>
<content type='text'>
Rick reported that his Pluggable USB4 dock does not work anymore after
upgrading to v6.10 kernel.

It looks like commit c6ca1ac9f472 ("thunderbolt: Increase sideband
access polling delay") makes the device router enumeration happen later
than what might be expected by the dock (although there is no such limit
in the USB4 spec) which probably makes it assume there is something
wrong with the high-speed link and reset it. After the link is reset the
same issue happens again and again.

For this reason lower the sideband access delay from 5ms to 1ms. This
seems to work fine according to Rick's testing.

Reported-by: Rick Lahaye &lt;rick@581238.xyz&gt;
Closes: https://lore.kernel.org/linux-usb/000f01db247b$d10e1520$732a3f60$@581238.xyz/
Tested-by: Rick Lahaye &lt;rick@581238.xyz&gt;
Fixes: c6ca1ac9f472 ("thunderbolt: Increase sideband access polling delay")
Cc: stable@vger.kernel.org
Acked-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Reviewed-by: Mario Limonciello &lt;mario.limonciello@amd.com&gt;
Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>thunderbolt: Improve software receiver lane margining</title>
<updated>2024-08-22T04:32:06+00:00</updated>
<author>
<name>R Kannappan</name>
<email>r.kannappan@intel.com</email>
</author>
<published>2024-07-19T18:37:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=10904df3f20cf36e418e78ab73c2fbcecda512b8'/>
<id>urn:sha1:10904df3f20cf36e418e78ab73c2fbcecda512b8</id>
<content type='text'>
USB4 specification defines the metadata needed to perform software
margining, as well as the necessary steps which include waiting for
dwell time.

- Add dwell_time attribute to set the wait time while performing
  margining and checking for link errors.
- Add error_counter attribute to configure error counter prior to
  margining test.
- Add voltage_time_offset attribute to set the voltage or time offset
  steps before performing the software margining test.
- Perform software margining test for dwell duration, break if there are
  link errors, stop the clocks and provide results.

Below is a minimalistic example how this can be used. Note these values
are just examples. The exact values in practice depend on host specific
capabilities and the type of measurement to be performed.

  # cd /sys/kernel/debug/thunderbolt/ROUTER/portX/margining/
  # echo software &gt; mode
  # echo 400 &gt; dwell_time
  # echo 1 &gt; run

As usual the results attribute contains the results of a succesfull run.

Signed-off-by: R Kannappan &lt;r.kannappan@intel.com&gt;
Co-developed-by: Rene Sapiens &lt;rene.sapiens@intel.com&gt;
Signed-off-by: Rene Sapiens &lt;rene.sapiens@intel.com&gt;
Co-developed-by: Aapo Vienamo &lt;aapo.vienamo@linux.intel.com&gt;
Signed-off-by: Aapo Vienamo &lt;aapo.vienamo@linux.intel.com&gt;
Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>thunderbolt: Add optional voltage offset range for receiver lane margining</title>
<updated>2024-08-22T04:32:06+00:00</updated>
<author>
<name>Rene Sapiens</name>
<email>rene.sapiens@intel.com</email>
</author>
<published>2024-07-19T18:37:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=9fafd46b39d140b7359b77e5fcc4c3130788df42'/>
<id>urn:sha1:9fafd46b39d140b7359b77e5fcc4c3130788df42</id>
<content type='text'>
Add optional extended voltage offset range support for software and
hardware margining as defined by the USB4 specification.

If supported, it can be enabled like below:

 # cd /sys/kernel/debug/thunderbolt/ROUTER/portX/margining/
 # echo Y &gt; optional_voltage_offset

Signed-off-by: Rene Sapiens &lt;rene.sapiens@intel.com&gt;
Co-developed-by: R Kannappan &lt;r.kannappan@intel.com&gt;
Signed-off-by: R Kannappan &lt;r.kannappan@intel.com&gt;
Co-developed-by: Aapo Vienamo &lt;aapo.vienamo@linux.intel.com&gt;
Signed-off-by: Aapo Vienamo &lt;aapo.vienamo@linux.intel.com&gt;
Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>thunderbolt: Consolidate margining parameters into a structure</title>
<updated>2024-08-22T04:32:06+00:00</updated>
<author>
<name>Rene Sapiens</name>
<email>rene.sapiens@intel.com</email>
</author>
<published>2024-07-19T18:37:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=81f848d28787b1f98f0526345c8f45f6dc1baf9e'/>
<id>urn:sha1:81f848d28787b1f98f0526345c8f45f6dc1baf9e</id>
<content type='text'>
Consolidate the hardware and software margining parameters into a single
structure to reduce the number of parameters passed to the margining
functions.

Signed-off-by: Rene Sapiens &lt;rene.sapiens@intel.com&gt;
Co-developed-by: Aapo Vienamo &lt;aapo.vienamo@linux.intel.com&gt;
Signed-off-by: Aapo Vienamo &lt;aapo.vienamo@linux.intel.com&gt;
Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>thunderbolt: Add missing usb4_port_sb_read() to usb4_port_sw_margin()</title>
<updated>2024-08-22T04:32:06+00:00</updated>
<author>
<name>Aapo Vienamo</name>
<email>aapo.vienamo@linux.intel.com</email>
</author>
<published>2024-07-19T18:37:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=24edc397047180210ace0da60577b4a3e3d2af39'/>
<id>urn:sha1:24edc397047180210ace0da60577b4a3e3d2af39</id>
<content type='text'>
Synchronize the operation completion by reading back the software
margining operation completion metadata into margining-&gt;results.

Signed-off-by: Aapo Vienamo &lt;aapo.vienamo@linux.intel.com&gt;
Co-developed-by: R Kannappan &lt;r.kannappan@intel.com&gt;
Signed-off-by: R Kannappan &lt;r.kannappan@intel.com&gt;
Co-developed-by: Rene Sapiens &lt;rene.sapiens@intel.com&gt;
Signed-off-by: Rene Sapiens &lt;rene.sapiens@intel.com&gt;
Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>thunderbolt: Add receiver lane margining support for retimers</title>
<updated>2024-06-17T09:47:12+00:00</updated>
<author>
<name>Mika Westerberg</name>
<email>mika.westerberg@linux.intel.com</email>
</author>
<published>2023-03-21T09:40:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ff6ab055e070d819f51196622e08f8941b6d2a4b'/>
<id>urn:sha1:ff6ab055e070d819f51196622e08f8941b6d2a4b</id>
<content type='text'>
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 &lt;mika.westerberg@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>thunderbolt: Make margining functions accept target and retimer index</title>
<updated>2024-06-17T09:47:12+00:00</updated>
<author>
<name>Mika Westerberg</name>
<email>mika.westerberg@linux.intel.com</email>
</author>
<published>2023-03-21T08:02:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0890fc36c70c8d5e80dc128c3a9d7a9122646869'/>
<id>urn:sha1:0890fc36c70c8d5e80dc128c3a9d7a9122646869</id>
<content type='text'>
In order to add lane margining support for retimers make the margining
functions take sideband target and retimer index as parameters. This
makes it possible to access both router and retimer sideband using the
same functions.

Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>thunderbolt: Make usb4_port_sb_read/write() available outside of usb4.c</title>
<updated>2024-06-17T09:47:11+00:00</updated>
<author>
<name>Mika Westerberg</name>
<email>mika.westerberg@linux.intel.com</email>
</author>
<published>2024-04-16T06:41:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e8241f66a812847853aa8c8a97b3492d152c6f23'/>
<id>urn:sha1:e8241f66a812847853aa8c8a97b3492d152c6f23</id>
<content type='text'>
We need to call these from other files too so make them available
outside of usb4.c.

Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
</content>
</entry>
</feed>
