<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/thunderbolt/icm.c, branch linux-5.9.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.9.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.9.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2020-12-11T12:22:08Z</updated>
<entry>
<title>thunderbolt: Fix use-after-free in remove_unplugged_switch()</title>
<updated>2020-12-11T12:22:08Z</updated>
<author>
<name>Mika Westerberg</name>
</author>
<published>2020-11-18T11:08:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=44de69467e37a94f574ce9025b490f164a1fb4f0'/>
<id>urn:sha1:44de69467e37a94f574ce9025b490f164a1fb4f0</id>
<content type='text'>
commit 600c0849cf86b75d86352f59745226273290986a upstream.

Paulian reported a crash that happens when a dock is unplugged during
hibernation:

[78436.228217] thunderbolt 0-1: device disconnected
[78436.228365] BUG: kernel NULL pointer dereference, address: 00000000000001e0
...
[78436.228397] RIP: 0010:icm_free_unplugged_children+0x109/0x1a0
...
[78436.228432] Call Trace:
[78436.228439]  icm_rescan_work+0x24/0x30
[78436.228444]  process_one_work+0x1a3/0x3a0
[78436.228449]  worker_thread+0x30/0x370
[78436.228454]  ? process_one_work+0x3a0/0x3a0
[78436.228457]  kthread+0x13d/0x160
[78436.228461]  ? kthread_park+0x90/0x90
[78436.228465]  ret_from_fork+0x1f/0x30

This happens because remove_unplugged_switch() calls tb_switch_remove()
that releases the memory pointed by sw so the following lines reference
to a memory that might be released already.

Fix this by saving pointer to the parent device before calling
tb_switch_remove().

Reported-by: Paulian Bogdan Marinca &lt;paulian@marinca.net&gt;
Fixes: 4f7c2e0d8765 ("thunderbolt: Make sure device runtime resume completes before taking domain lock")
Cc: stable@vger.kernel.org
Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
Reviewed-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>thunderbolt: Add support for Intel Tiger Lake</title>
<updated>2020-04-23T06:57:59Z</updated>
<author>
<name>Mika Westerberg</name>
</author>
<published>2018-09-14T09:58:37Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=57d8df68eb53cc15e5bdfc14bfb28a18543109eb'/>
<id>urn:sha1:57d8df68eb53cc15e5bdfc14bfb28a18543109eb</id>
<content type='text'>
Tiger Lake integrated Thunderbolt/USB4 controller is quite close to
Intel Ice Lake. By default it is still using firmware based connection
manager so we can use most of the Ice Lake flows in Tiger Lake as well.
We check if the firmware connection manager is running and in that case
use it, otherwise use the software based connection manager.

Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
Acked-by: Yehezkel Bernat &lt;yehezkelshb@gmail.com&gt;
</content>
</entry>
<entry>
<title>thunderbolt: icm: Replace zero-length array with flexible-array member</title>
<updated>2020-02-14T12:08:49Z</updated>
<author>
<name>Gustavo A. R. Silva</name>
</author>
<published>2020-02-11T23:20:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3084ea9ea88906576d0bfc0d66cb1735045266c8'/>
<id>urn:sha1:3084ea9ea88906576d0bfc0d66cb1735045266c8</id>
<content type='text'>
The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to declare
variable-length types such as these ones is a flexible array member[1][2],
introduced in C99:

struct foo {
        int stuff;
        struct boo array[];
};

By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last in the structure, which
will help us prevent some kind of undefined behavior bugs from being
inadvertenly introduced[3] to the codebase from now on.

This issue was found with the help of Coccinelle.

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")

Signed-off-by: Gustavo A. R. Silva &lt;gustavo@embeddedor.com&gt;
Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>thunderbolt: Do not start firmware unless asked by the user</title>
<updated>2019-11-02T09:13:31Z</updated>
<author>
<name>Mika Westerberg</name>
</author>
<published>2019-03-21T13:31:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=354a7a7716edb377953a324421915d7788e0bca9'/>
<id>urn:sha1:354a7a7716edb377953a324421915d7788e0bca9</id>
<content type='text'>
Since now we can do pretty much the same thing in the software
connection manager than the firmware would do, there is no point
starting it by default. Instead we can just continue using the software
connection manager.

Make it possible for user to switch between the two by adding a module
pararameter (start_icm) which is by default false. Having this ability
to enable the firmware may be useful at least when debugging possible
issues with the software connection manager implementation.

Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>thunderbolt: Add support for lane bonding</title>
<updated>2019-11-02T09:13:31Z</updated>
<author>
<name>Mika Westerberg</name>
</author>
<published>2019-03-21T17:03:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=91c0c12080d0f40ee7275485221b06b4e1e289e1'/>
<id>urn:sha1:91c0c12080d0f40ee7275485221b06b4e1e289e1</id>
<content type='text'>
Lane bonding allows aggregating two 10/20 Gb/s (depending on the
generation) lanes into a single 20/40 Gb/s bonded link. This allows
sharing the full bandwidth more efficiently. In order to establish lane
bonding we need to check that lane bonding is possible through link
controller and that both ends of the link actually supports 2x widths.
This also means that all the paths should be established through the
primary port so update tb_path_alloc() to handle this as well.

Lane bonding is supported starting from Falcon Ridge (2nd generation)
controllers.

We also expose the current speed and number of lanes under each device
except the host router following similar attribute naming than USB bus.
Expose speed and number of lanes for both directions to allow possibility
of asymmetric link in the future.

Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>thunderbolt: Refactor add_switch() into two functions</title>
<updated>2019-11-01T11:32:00Z</updated>
<author>
<name>Mika Westerberg</name>
</author>
<published>2019-10-08T16:03:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b5db76dba0642ea6f2391374f3b2b479014e5bf0'/>
<id>urn:sha1:b5db76dba0642ea6f2391374f3b2b479014e5bf0</id>
<content type='text'>
Currently add_switch() takes a huge amount of parameters that makes it
hard to maintain. Instead of passing all those parameters we can split
the function into two parts (alloc and add) and fill the additional
switch fields directly in the functions calling those.

While there remove redundant error logging in case kmemdup() fails.

No functional changes.

Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>thunderbolt: Add helper macro to iterate over switch ports</title>
<updated>2019-11-01T11:32:00Z</updated>
<author>
<name>Mika Westerberg</name>
</author>
<published>2019-09-30T11:07:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b433d0100562233b21beb13c0139feeff350bc68'/>
<id>urn:sha1:b433d0100562233b21beb13c0139feeff350bc68</id>
<content type='text'>
There are quite many places in the driver where we iterate over each
port in the switch. To make it bit more convenient, add a macro that can
be used to iterate over each port and convert existing call sites to use it.

This is based on code by Lukas Wunner.

No functional changes.

Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>thunderbolt: Add support for Intel Ice Lake</title>
<updated>2019-08-26T09:15:06Z</updated>
<author>
<name>Mika Westerberg</name>
</author>
<published>2018-01-16T20:19:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3cdb9446a117d5d63af823bde6fe6babc312e77b'/>
<id>urn:sha1:3cdb9446a117d5d63af823bde6fe6babc312e77b</id>
<content type='text'>
The Thunderbolt controller is integrated into the Ice Lake CPU itself
and requires special flows to power it on and off using force power bit
in NHI VSEC registers. Runtime PM (RTD3) and Sx flows also differ from
the discrete solutions. Now the firmware notifies the driver whether
RTD3 entry or exit are possible. The driver is responsible of sending
Go2Sx command through link controller mailbox when system enters Sx
states (suspend-to-mem/disk). Rest of the ICM firwmare flows follow
Titan Ridge.

Signed-off-by: Raanan Avargil &lt;raanan.avargil@intel.com&gt;
Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
Reviewed-by: Yehezkel Bernat &lt;YehezkelShB@gmail.com&gt;
Tested-by: Mario Limonciello &lt;mario.limonciello@dell.com&gt;
</content>
</entry>
<entry>
<title>thunderbolt: Move NVM upgrade support flag to struct icm</title>
<updated>2019-08-26T09:14:32Z</updated>
<author>
<name>Mika Westerberg</name>
</author>
<published>2018-01-16T20:30:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f437c24bf694b0293f835dea8c25e3a5c1433d07'/>
<id>urn:sha1:f437c24bf694b0293f835dea8c25e3a5c1433d07</id>
<content type='text'>
This is depends on the controller and on the platform/CPU we are
running. Move it to struct icm so we can set it per controller.

Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
Reviewed-by: Yehezkel Bernat &lt;YehezkelShB@gmail.com&gt;
Tested-by: Mario Limonciello &lt;mario.limonciello@dell.com&gt;
</content>
</entry>
<entry>
<title>thunderbolt: Implement CIO reset correctly for Titan Ridge</title>
<updated>2019-06-14T11:25:43Z</updated>
<author>
<name>Mika Westerberg</name>
</author>
<published>2019-05-31T10:31:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0d53827d7c172f1345140f7638fe658bda1bb25d'/>
<id>urn:sha1:0d53827d7c172f1345140f7638fe658bda1bb25d</id>
<content type='text'>
When starting ICM firmware on Apple systems we need to perform CIO reset
as part of the flow. However, it turns out that the reset register has
changed to another location in Titan Ridge.

Fix this by introducing -&gt;cio_reset() callback with corresponding
implementations for Alpine and Titan Ridge.

Fixes: c4630d6ae6e3 ("thunderbolt: Start firmware on Titan Ridge Apple systems")
Reported-by: Peter Bowen &lt;pzb@amazon.com&gt;
Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
</content>
</entry>
</feed>
