<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/thunderbolt/tb.h, branch linux-5.4.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.4.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.4.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2019-06-12T10:30:46Z</updated>
<entry>
<title>thunderbolt: Make sure device runtime resume completes before taking domain lock</title>
<updated>2019-06-12T10:30:46Z</updated>
<author>
<name>Mika Westerberg</name>
</author>
<published>2019-05-28T15:56:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4f7c2e0d8765a0266b920c66ffc495fde44c1ec8'/>
<id>urn:sha1:4f7c2e0d8765a0266b920c66ffc495fde44c1ec8</id>
<content type='text'>
When a device is authorized from userspace by writing to authorized
attribute we first take the domain lock and then runtime resume the
device in question. There are two issues with this.

First is that the device connected notifications are blocked during this
time which means we get them only after the authorization operation is
complete. Because of this the authorization needed flag from the
firmware notification is not reflecting the real authorization status
anymore. So what happens is that the "authorized" keeps returning 0 even
if the device was already authorized properly.

Second issue is that each time the controller is runtime resumed the
connection_id field of device connected notification may be different
than in the previous resume. We need to use the latest connection_id
otherwise the firmware rejects the authorization command.

Fix these by moving runtime resume operations to happen before the
domain lock is taken, and waiting for the updated device connected
notification from the firmware before we allow runtime resume of a
device to complete.

While there add missing locking to tb_switch_nvm_read().

Fixes: 09f11b6c99fe ("thunderbolt: Take domain lock in switch sysfs attribute callbacks")
Reported-by: Pengfei Xu &lt;pengfei.xu@intel.com&gt;
Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>thunderbolt: Make priority unsigned in struct tb_path</title>
<updated>2019-04-25T09:18:27Z</updated>
<author>
<name>Nathan Chancellor</name>
</author>
<published>2019-04-24T18:34:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=37209783c73a47692dbf1e6b2dba0d07f6ce24b3'/>
<id>urn:sha1:37209783c73a47692dbf1e6b2dba0d07f6ce24b3</id>
<content type='text'>
Clang warns:

drivers/thunderbolt/tunnel.c:504:17: warning: implicit truncation from
'int' to bit-field changes value from 5 to -3
[-Wbitfield-constant-conversion]
        path-&gt;priority = 5;
                       ^ ~
1 warning generated.

The priority member in struct tb_path is only ever assigned a positive
number:

$ rg -n priority drivers/thunderbolt/path.c
drivers/thunderbolt/tunnel.c:99:        path-&gt;priority = 3;
drivers/thunderbolt/tunnel.c:308:       path-&gt;priority = 2;
drivers/thunderbolt/tunnel.c:323:       path-&gt;priority = 1;
drivers/thunderbolt/tunnel.c:504:       path-&gt;priority = 5;

Furthermore, that value is only assigned to an unsigned integer in
tb_path_activate (the priority member in struct tb_regs_hop).

Fixes: 44242d6c9703 ("thunderbolt: Add support for DMA tunnels")
Link: https://github.com/ClangBuiltLinux/linux/issues/454
Signed-off-by: Nathan Chancellor &lt;natechancellor@gmail.com&gt;
Reviewed-by: Nick Desaulniers &lt;ndesaulniers@google.com&gt;
Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>thunderbolt: Make __TB_[SW|PORT]_PRINT take const parameters</title>
<updated>2019-04-18T08:18:53Z</updated>
<author>
<name>Mika Westerberg</name>
</author>
<published>2019-03-06T17:23:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b323a98f9b9b3e345e325dbfdb515900c61df312'/>
<id>urn:sha1:b323a98f9b9b3e345e325dbfdb515900c61df312</id>
<content type='text'>
The printing macros do not modify the passed object so make them
const. While there make tb_route() to take const parameter as well.

Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>thunderbolt: Add support for DMA tunnels</title>
<updated>2019-04-18T08:18:53Z</updated>
<author>
<name>Mika Westerberg</name>
</author>
<published>2018-09-28T13:35:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=44242d6c9703208e7e7abd6b4dbb258a930dd01a'/>
<id>urn:sha1:44242d6c9703208e7e7abd6b4dbb258a930dd01a</id>
<content type='text'>
In addition to PCIe and Display Port tunnels it is also possible to
create tunnels that forward DMA traffic from the host interface adapter
(NHI) to a NULL port that is connected to another domain through a
Thunderbolt cable. These tunnels can be used to carry software messages
such as networking packets.

To support this we introduce another tunnel type (TB_TUNNEL_DMA) that
supports paths from NHI to NULL port and back.

Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>thunderbolt: Run tb_xdp_handle_request() in system workqueue</title>
<updated>2019-04-18T08:18:53Z</updated>
<author>
<name>Mika Westerberg</name>
</author>
<published>2018-10-22T11:47:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=559c1e1e013437bf190469efbcbd8bc803285853'/>
<id>urn:sha1:559c1e1e013437bf190469efbcbd8bc803285853</id>
<content type='text'>
We run all XDomain requests during discovery in tb-&gt;wq and since it only
runs one work at the time it means that sending back reply to the other
domain may be delayed too much depending whether there is an active
XDomain discovery request running.

To make sure we can send reply to the other domain as soon as possible
run tb_xdp_handle_request() in system workqueue instead. Since the
device can be hot-removed in the middle we need to make sure the domain
structure is still around when the function is run so increase reference
count before we schedule the reply work.

Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>thunderbolt: Add support for Display Port tunnels</title>
<updated>2019-04-18T08:18:53Z</updated>
<author>
<name>Mika Westerberg</name>
</author>
<published>2018-09-17T13:30:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4f807e47ee9a75747d042a8eacf398f436da9452'/>
<id>urn:sha1:4f807e47ee9a75747d042a8eacf398f436da9452</id>
<content type='text'>
Display Port tunnels are somewhat more complex than PCIe tunnels as it
requires 3 tunnels (AUX Rx/Tx and Video). In addition we are not
supposed to create the tunnels immediately when a DP OUT is enumerated.
Instead we need to wait until we get hotplug event to that adapter port
or check if the port has HPD set before tunnels can be established. This
adds Display Port tunneling support to the software connection manager.

Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>thunderbolt: Generalize port finding routines to support all port types</title>
<updated>2019-04-18T08:18:53Z</updated>
<author>
<name>Mika Westerberg</name>
</author>
<published>2017-10-12T13:45:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e78db6f08b6a2a50eea9ed4146f019026491d63c'/>
<id>urn:sha1:e78db6f08b6a2a50eea9ed4146f019026491d63c</id>
<content type='text'>
We will be needing these routines to find Display Port adapters as well
so modify them to take port type as the second parameter.

Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>thunderbolt: Scan only valid NULL adapter ports in hotplug</title>
<updated>2019-04-18T08:18:53Z</updated>
<author>
<name>Mika Westerberg</name>
</author>
<published>2017-10-11T14:19:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=344e06430a72347b554a7fd98f3a961084f37be6'/>
<id>urn:sha1:344e06430a72347b554a7fd98f3a961084f37be6</id>
<content type='text'>
The only way to expand Thunderbolt topology is through the NULL adapter
ports (typically ports 1, 2, 3 and 4). There is no point handling
Thunderbolt hotplug events on any other port.

Add a helper function (tb_port_is_null()) that can be used to determine
if the port is NULL port, and use it in software connection manager code
when hotplug event is handled.

Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>thunderbolt: Add support for full PCIe daisy chains</title>
<updated>2019-04-18T08:18:53Z</updated>
<author>
<name>Mika Westerberg</name>
</author>
<published>2018-12-30T19:34:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=99cabbb006f1eb509e8bbc88c020c806017ed582'/>
<id>urn:sha1:99cabbb006f1eb509e8bbc88c020c806017ed582</id>
<content type='text'>
Currently the software connection manager (tb.c) has only supported
creating a single PCIe tunnel, no PCIe device daisy chaining has been
supported so far. This updates the software connection manager so that
it now can create PCIe tunnels for full chain of six devices.

Because PCIe allows DMA and opens possibility for DMA attacks we change
security level to "user" meaning that PCIe tunneling requires that the
userspace authorizes the devices first. This makes it possible to block
PCIe tunneling completely while still allowing other types of tunnels to
be automatically created.

Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>thunderbolt: Discover preboot PCIe paths the boot firmware established</title>
<updated>2019-04-18T08:18:53Z</updated>
<author>
<name>Mika Westerberg</name>
</author>
<published>2017-02-19T21:43:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0414bec5f39a3c73fa56474b1bcd899101c2727d'/>
<id>urn:sha1:0414bec5f39a3c73fa56474b1bcd899101c2727d</id>
<content type='text'>
In Apple Macs the boot firmware (EFI) connects all devices automatically
when the system is started, before it hands over to the OS. Instead of
ignoring we discover all those PCIe tunnels and record them using our
internal structures, just like we do when a device is connected after
the OS is already up.

By doing this we can properly tear down tunnels when devices are
disconnected. Also this allows us to resume the existing tunnels after
system suspend/resume cycle.

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