<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/thunderbolt/switch.c, branch v5.10.78</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v5.10.78</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v5.10.78'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2021-09-18T11:40:27+00:00</updated>
<entry>
<title>thunderbolt: Fix port linking by checking all adapters</title>
<updated>2021-09-18T11:40:27+00:00</updated>
<author>
<name>Sanjay R Mehta</name>
<email>sanju.mehta@amd.com</email>
</author>
<published>2021-08-03T12:34:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=491c8be21993bdb63f36dba3b7004d8bce6a83ff'/>
<id>urn:sha1:491c8be21993bdb63f36dba3b7004d8bce6a83ff</id>
<content type='text'>
[ Upstream commit 42716425ad7e1b6529ec61c260c11176841f4b5f ]

In tb_switch_default_link_ports(), while linking of ports,
only odd-numbered ports (1,3,5..) are considered and even-numbered
ports are not considered.

AMD host router has lane adapters at 2 and 3 and link ports at adapter 2
is not considered due to which lane bonding gets disabled.

Hence added a fix such that all ports are considered during
linking of ports.

Signed-off-by: Basavaraj Natikar &lt;Basavaraj.Natikar@amd.com&gt;
Signed-off-by: Sanjay R Mehta &lt;sanju.mehta@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: Initialize HopID IDAs in tb_switch_alloc()</title>
<updated>2021-03-25T08:04:15+00:00</updated>
<author>
<name>Mika Westerberg</name>
<email>mika.westerberg@linux.intel.com</email>
</author>
<published>2021-02-10T14:06:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f4ca082e3f59f1c3a4d4b7ec383131fd18ce1b69'/>
<id>urn:sha1:f4ca082e3f59f1c3a4d4b7ec383131fd18ce1b69</id>
<content type='text'>
commit 781e14eaa7d168dc07d2a2eea5c55831a5bb46f3 upstream.

If there is a failure before the tb_switch_add() is called the switch
object is released by tb_switch_release() but at that point HopID IDAs
have not yet been initialized. So we see splat like this:

BUG: spinlock bad magic on CPU#2, kworker/u8:5/115
...
Workqueue: thunderbolt0 tb_handle_hotplug
Call Trace:
 dump_stack+0x97/0xdc
 ? spin_bug+0x9a/0xa7
 do_raw_spin_lock+0x68/0x98
 _raw_spin_lock_irqsave+0x3f/0x5d
 ida_destroy+0x4f/0x127
 tb_switch_release+0x6d/0xfd
 device_release+0x2c/0x7d
 kobject_put+0x9b/0xbc
 tb_handle_hotplug+0x278/0x452
 process_one_work+0x1db/0x396
 worker_thread+0x216/0x375
 kthread+0x14d/0x155
 ? pr_cont_work+0x58/0x58
 ? kthread_blkcg+0x2e/0x2e
 ret_from_fork+0x1f/0x40

Fix this by always initializing HopID IDAs in tb_switch_alloc().

Fixes: 0b2863ac3cfd ("thunderbolt: Add functions for allocating and releasing HopIDs")
Cc: stable@vger.kernel.org
Reported-by: Chiranjeevi Rapolu &lt;chiranjeevi.rapolu@intel.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>Merge tag 'thunderbolt-for-v5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt into usb-next</title>
<updated>2020-09-30T07:42:36+00:00</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2020-09-30T07:42:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=59ee364bafb2690ebdd1ea5793c2fdb2ea27433a'/>
<id>urn:sha1:59ee364bafb2690ebdd1ea5793c2fdb2ea27433a</id>
<content type='text'>
Mika writes:

thunderbolt: Changes for v5.10 merge window

This includes following Thunderbolt/USB4 changes for v5.10 merge window:

  * A couple of optimizations around Tiger Lake force power logic and
    NHI (Native Host Interface) LC (Link Controller) mailbox command
    processing

  * Power management improvements for Software Connection Manager

  * Debugfs support

  * Allow KUnit tests to be enabled also when Thunderbolt driver is
    configured as module.

  * Few minor cleanups and fixes

All these have been in linux-next with no reported issues.

* tag 'thunderbolt-for-v5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt: (37 commits)
  thunderbolt: Capitalize comment on top of QUIRK_FORCE_POWER_LINK_CONTROLLER
  thunderbolt: Correct tb_check_quirks() kernel-doc
  thunderbolt: Log correct zeroX entries in decode_error()
  thunderbolt: Handle ERR_LOCK notification
  thunderbolt: Use "if USB4" instead of "depends on" in Kconfig
  thunderbolt: Allow KUnit tests to be built also when CONFIG_USB4=m
  thunderbolt: Only stop control channel when entering freeze
  thunderbolt: debugfs: Fix uninitialized return in counters_write()
  thunderbolt: Add debugfs interface
  thunderbolt: No need to warn in TB_CFG_ERROR_INVALID_CONFIG_SPACE
  thunderbolt: Introduce tb_switch_is_tiger_lake()
  thunderbolt: Introduce tb_switch_is_ice_lake()
  thunderbolt: Check for Intel vendor ID when identifying controller
  thunderbolt: Introduce tb_port_is_nhi()
  thunderbolt: Introduce tb_switch_next_cap()
  thunderbolt: Introduce tb_port_next_cap()
  thunderbolt: Move struct tb_cap_any to tb_regs.h
  thunderbolt: Add runtime PM for Software CM
  thunderbolt: Create device links from ACPI description
  ACPI: Export acpi_get_first_physical_node() to modules
  ...
</content>
</entry>
<entry>
<title>thunderbolt: Add debugfs interface</title>
<updated>2020-09-03T09:21:08+00:00</updated>
<author>
<name>Gil Fine</name>
<email>gil.fine@intel.com</email>
</author>
<published>2020-06-29T17:30:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=54e418106c765c5f3c378c770b0f8518632830da'/>
<id>urn:sha1:54e418106c765c5f3c378c770b0f8518632830da</id>
<content type='text'>
This adds debugfs interface that can be used for debugging possible
issues in hardware/software. It exposes router and adapter config spaces
through files like this:

  /sys/kernel/debug/thunderbolt/&lt;DEVICE&gt;/regs
  /sys/kernel/debug/thunderbolt/&lt;DEVICE&gt;/&lt;PORT1&gt;/regs
  /sys/kernel/debug/thunderbolt/&lt;DEVICE&gt;/&lt;PORT1&gt;/path
  /sys/kernel/debug/thunderbolt/&lt;DEVICE&gt;/&lt;PORT1&gt;/counters
  /sys/kernel/debug/thunderbolt/&lt;DEVICE&gt;/&lt;PORT2&gt;/regs
  /sys/kernel/debug/thunderbolt/&lt;DEVICE&gt;/&lt;PORT2&gt;/path
  /sys/kernel/debug/thunderbolt/&lt;DEVICE&gt;/&lt;PORT2&gt;/counters
  ...

The "regs" is either the router or port configuration space register
dump. The "path" is the port path configuration space and "counters" is
the optional counters configuration space.

These files contains one register per line so it should be easy to use
normal filtering tools to find the registers of interest if needed.

The router and adapter regs file becomes writable when
CONFIG_USB4_DEBUGFS_WRITE is enabled (which is not supposed to be done
in production systems) and in this case the developer can write "offset
value" lines there to modify the hardware directly. For convenience this
also supports the long format the read side produces (but ignores the
additional fields). The counters file can be written even when
CONFIG_USB4_DEBUGFS_WRITE is not enabled and it is only used to clear
the counter values.

Signed-off-by: Gil Fine &lt;gil.fine@intel.com&gt;
Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
Reviewed-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>thunderbolt: Introduce tb_port_is_nhi()</title>
<updated>2020-09-03T09:21:08+00:00</updated>
<author>
<name>Mika Westerberg</name>
<email>mika.westerberg@linux.intel.com</email>
</author>
<published>2020-07-25T07:32:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a3cfebdc1b3ab379646f61f095102f7d2b8f6f31'/>
<id>urn:sha1:a3cfebdc1b3ab379646f61f095102f7d2b8f6f31</id>
<content type='text'>
This is useful if one needs to check if adapter (port) is the host
interface (NHI). Make tb_port_alloc_hopid() take advantage of this.

Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
Reviewed-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>thunderbolt: Add runtime PM for Software CM</title>
<updated>2020-09-03T09:06:42+00:00</updated>
<author>
<name>Mika Westerberg</name>
<email>mika.westerberg@linux.intel.com</email>
</author>
<published>2020-06-05T11:25:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6ac6faee5d7d7d1676a3188286438bed2dadd863'/>
<id>urn:sha1:6ac6faee5d7d7d1676a3188286438bed2dadd863</id>
<content type='text'>
This adds runtime PM support for the Software Connection Manager parts
of the driver. This allows to save power when either there is no device
attached at all or there is a device attached and all following
conditions are true:

  - Tunneled PCIe root/downstream ports are runtime suspended
  - Tunneled USB3 ports are runtime suspended
  - No active DisplayPort stream
  - No active XDomain connection

For the first two we take advantage of device links that were added in
previous patch. Difference for the system sleep case is that we also
enable wakes when something is geting plugged in/out of the Thunderbolt
ports.

Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>thunderbolt: Enable wakes from system suspend</title>
<updated>2020-09-03T09:06:42+00:00</updated>
<author>
<name>Mika Westerberg</name>
<email>mika.westerberg@linux.intel.com</email>
</author>
<published>2019-12-06T16:36:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b2911a593a705e54adde6d06d4657c1ff2f16583'/>
<id>urn:sha1:b2911a593a705e54adde6d06d4657c1ff2f16583</id>
<content type='text'>
In order for the router and the whole domain to wake up from system
suspend states we need to enable wakes for the connected routers. For
device routers we enable wakes from PCIe and USB 3.x. This allows
devices such as keyboards connected to USB 3.x hub that is tunneled to
wake the system up as expected. For all routers we enabled wake on USB4
for each connected ports. This is used to propagate the wake from router
to another.

Do the same for legacy routers through link controller vendor specific
registers as documented in USB4 spec chapter 13.

While there correct kernel-doc of usb4_switch_set_sleep() -- it does not
enable wakes instead there is a separate function (usb4_switch_set_wake())
that does.

Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>thunderbolt: Disable lane 1 for XDomain connection</title>
<updated>2020-09-03T09:06:41+00:00</updated>
<author>
<name>Mika Westerberg</name>
<email>mika.westerberg@linux.intel.com</email>
</author>
<published>2020-02-21T10:11:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=341d45188a7800ae3bc18558d62020787b78397e'/>
<id>urn:sha1:341d45188a7800ae3bc18558d62020787b78397e</id>
<content type='text'>
USB4 spec mandates that the lane 1 should be disabled if lanes are not
bonded. For host-to-host connections (XDomain) we don't support lane
bonding so in order to be compatible with the spec, disable lane 1 when
another host is connected.

Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>thunderbolt: Set port configured for both ends of the link</title>
<updated>2020-09-03T09:06:41+00:00</updated>
<author>
<name>Mika Westerberg</name>
<email>mika.westerberg@linux.intel.com</email>
</author>
<published>2020-04-02T09:42:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e28178bf566cf7281b513856aa71a8d41aa81154'/>
<id>urn:sha1:e28178bf566cf7281b513856aa71a8d41aa81154</id>
<content type='text'>
Both ends of the link needs to have this set. Otherwise the link is not
re-established properly after sleep. Now since it is possible to have
mixed USB4 and Thunderbolt 1, 2 and 3 devices we need to split the link
configuration functionality to happen per port so we can pick the
correct implementation.

Signed-off-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>thunderbolt: Configure link after lane bonding is enabled</title>
<updated>2020-09-03T09:06:41+00:00</updated>
<author>
<name>Mika Westerberg</name>
<email>mika.westerberg@linux.intel.com</email>
</author>
<published>2020-04-02T11:50:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=de4620391786513a6971029b61663563c4b7b961'/>
<id>urn:sha1:de4620391786513a6971029b61663563c4b7b961</id>
<content type='text'>
During testing it was noticed that the link is not properly restored
after the domain exits sleep if the link configured bits are set before
lane bonding is enabled. The USB4 spec does not say in which order these
need to be set but setting link configured afterwards makes the link
restoration work so we do that instead.

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