summaryrefslogtreecommitdiff
path: root/drivers/thunderbolt
AgeCommit message (Collapse)AuthorFilesLines
2024-01-18Merge tag 'usb-6.8-rc1' of ↵Linus Torvalds10-60/+177
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb Pull USB / Thunderbolt updates from Greg KH: "Here is the big set of USB and Thunderbolt changes for 6.8-rc1. Included in here are the following: - Thunderbolt subsystem and driver updates for USB 4 hardware and issues reported by real devices - xhci driver updates - dwc3 driver updates - uvc_video gadget driver updates - typec driver updates - gadget string functions cleaned up - other small changes All of these have been in the linux-next tree for a while with no reported issues" * tag 'usb-6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (169 commits) usb: typec: tipd: fix use of device-specific init function usb: typec: tipd: Separate reset for TPS6598x usb: mon: Fix atomicity violation in mon_bin_vma_fault usb: gadget: uvc: Remove nested locking usb: gadget: uvc: Fix use are free during STREAMOFF usb: typec: class: fix typec_altmode_put_partner to put plugs dt-bindings: usb: dwc3: Limit num-hc-interrupters definition dt-bindings: usb: xhci: Add num-hc-interrupters definition xhci: add support to allocate several interrupters USB: core: Use device_driver directly in struct usb_driver and usb_device_driver arm64: dts: mediatek: mt8195: Add 'rx-fifo-depth' for cherry usb: xhci-mtk: fix a short packet issue of gen1 isoc-in transfer dt-bindings: usb: mtk-xhci: add a property for Gen1 isoc-in transfer issue arm64: dts: qcom: msm8996: Remove PNoC clock from MSS arm64: dts: qcom: msm8996: Remove AGGRE2 clock from SLPI arm64: dts: qcom: msm8998: Remove AGGRE2 clock from SLPI arm64: dts: qcom: msm8939: Drop RPM bus clocks arm64: dts: qcom: sdm630: Drop RPM bus clocks arm64: dts: qcom: qcs404: Drop RPM bus clocks arm64: dts: qcom: msm8996: Drop RPM bus clocks ...
2024-01-02Merge tag 'thunderbolt-for-v6.8-rc1' of ↵Greg Kroah-Hartman9-59/+176
git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt into char-misc-next Mika writes: thunderbolt: Changes for v6.8 merge window This includes following USB4/Thunderbolt changes for the v6.8 merge window: - Intel Lunar Lake support - PCIe tunneling improvements - DisplayPort tunneling improvements - Asymmetric switching improvements - Couple of minor fixes and cleanups. All these have been in linux-next with no reported issues. * tag 'thunderbolt-for-v6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt: thunderbolt: Reduce retry timeout to speed up boot for some devices thunderbolt: Keep link as asymmetric if preferred by hardware thunderbolt: Add support for Intel Lunar Lake thunderbolt: Disable PCIe extended encapsulation upon teardown properly thunderbolt: Make PCIe tunnel setup and teardown follow CM guide thunderbolt: Improve logging when DisplayPort resource is added due to hotplug thunderbolt: Use tb_dp_read_cap() to read DP_COMMON_CAP as well thunderbolt: Disable CL states only when actually needed thunderbolt: Transition link to asymmetric only when both sides support it thunderbolt: Log XDomain link speed and width thunderbolt: Move width_name() helper to tb.h thunderbolt: Handle lane bonding of Gen 4 XDomain links properly thunderbolt: Unwind TMU configuration if tb_switch_set_tmu_mode_params() fails thunderbolt: Remove duplicated re-assignment of pointer 'out'
2023-12-22thunderbolt: Reduce retry timeout to speed up boot for some devicesWerner Sembach1-1/+1
This is a followup to "thunderbolt: Workaround an IOMMU fault on certain systems with Intel Maple Ridge". It seems like the timeout can be reduced to 250ms. This reduces the overall delay caused by the retires to ~1s. This is about the time other things being initialized in parallel need anyway*, so like this the effective boot time is no longer compromised. *I only had a single device available for my measurements: A Clevo X170KM-G desktop replacement notebook. Signed-off-by: Werner Sembach <wse@tuxedocomputers.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-12-22thunderbolt: Keep link as asymmetric if preferred by hardwareGil Fine3-7/+36
In case of the link is brought up as asymmetric (due to hardware preference), we honor that and don't transition it to symmetric, unless a router with symmetric link got plugged below, in the topology (and a bandwidth allows transition to symmetric). Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-12-20thunderbolt: make tb_bus_type constGreg Kroah-Hartman1-1/+1
Now that the driver core can properly handle constant struct bus_type, move the tb_bus_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime. Cc: Andreas Noever <andreas.noever@gmail.com> Cc: Michael Jamet <michael.jamet@intel.com> Cc: Yehezkel Bernat <YehezkelShB@gmail.com> Cc: <linux-usb@vger.kernel.org> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Link: https://lore.kernel.org/r/2023121904-utopia-broadcast-06d1@gregkh Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-14thunderbolt: Add support for Intel Lunar LakeMika Westerberg2-0/+6
Intel Lunar Lake has similar integrated Thunderbolt/USB4 controller as Intel Meteor Lake with some small differences in the host router (it has 3 DP IN adapters for instance). Add the Intel Lunar Lake PCI IDs to the driver list of supported devices. Tested-by: Pengfei Xu <pengfei.xu@intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-12-14thunderbolt: Disable PCIe extended encapsulation upon teardown properlyGil Fine1-3/+15
In case of PCIe tunnel teardown (including if caused by router unplug), PCIe extended encapsulation bit should be cleared in downstream and upstream routers accordingly. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-12-14thunderbolt: Make PCIe tunnel setup and teardown follow CM guideGil Fine1-3/+10
The USB4 Connection Manager guide suggests that the PCIe paths are enabled from the upstream adapter to the downstream adapter and vice versa on disable so make the driver follows this sequence. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-12-14thunderbolt: Improve logging when DisplayPort resource is added due to hotplugGil Fine1-1/+1
To allow us differentiate how DisplayPort resource is added to the DisplayPort resources list make the debug log to append "hotplug" when this was due to an actual hotplug. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-12-14thunderbolt: Use tb_dp_read_cap() to read DP_COMMON_CAP as wellMika Westerberg1-6/+7
There is no point doing this separately as the register layout is the same. For this reason rename tb_dp_read_dprx() to tb_dp_wait_dprx() and call tb_dp_read_cap() instead. While there add debug log if the DPRX capability read times out. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-12-14thunderbolt: Disable CL states only when actually neededMika Westerberg1-8/+18
If there is not going to be an actual transition to asymmetric or symmetric, there is no point to disable and re-enable CL states either. So instead disable them only when we know that an actual transition is going to take place. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-12-14thunderbolt: Transition link to asymmetric only when both sides support itGil Fine1-6/+10
We can transition Gen 4 link to asymmetric only when both sides of the link support it in the required direction. For this reason make sure that the downstream adapter also supports asymmetric link before starting the transition. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-12-14thunderbolt: Log XDomain link speed and widthGil Fine1-0/+5
In the same way we do for routers. This is useful for debugging purposes. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-12-14thunderbolt: Move width_name() helper to tb.hGil Fine2-18/+18
We are going to use it in subsequent patches, so make it available outside of switch.c. Also, change the name to tb_width_name() to follow the naming conventions. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-12-14thunderbolt: Handle lane bonding of Gen 4 XDomain links properlyGil Fine2-3/+48
Gen 4 links come up as bonded already so we are not supposed to initiate lane bonding on them. However, we should still update the port structures accordingly. Split these into their own functions to make it easier to follow. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-12-14thunderbolt: Unwind TMU configuration if tb_switch_set_tmu_mode_params() failsMika Westerberg1-1/+1
Dan reported that the kernel test robot found an issue with the TMU code namely in tb_switch_tmu_change_mode() where we should actually go back to the previous mode in case of failure instead of just returning back the error. Fix this by unwinding the configuration as we do with the other error paths in this function. Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Closes: https://lore.kernel.org/r/202311030814.AXtCk7PO-lkp@intel.com/ Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-12-08thunderbolt: Fix minimum allocated USB 3.x and PCIe bandwidthGil Fine1-5/+5
With the current bandwidth allocation we end up reserving too much for the USB 3.x and PCIe tunnels that leads to reduced capabilities for the second DisplayPort tunnel. Fix this by decreasing the USB 3.x allocation to 900 Mb/s which then allows both tunnels to get the maximum HBR2 bandwidth. This way, the reserved bandwidth for USB 3.x and PCIe, would be 1350 Mb/s (taking weights of USB 3.x and PCIe into account). So bandwidth allocations on a link are: USB 3.x + PCIe tunnels => 1350 Mb/s DisplayPort tunnel #1 => 17280 Mb/s DisplayPort tunnel #2 => 17280 Mb/s Total consumed bandwidth is 35910 Mb/s. So that all the above can be tunneled on a Gen 3 link (which allows maximum of 36000 Mb/s). Fixes: 582e70b0d3a4 ("thunderbolt: Change bandwidth reservations to comply USB4 v2") Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-11-27thunderbolt: Fix memory leak in margining_port_remove()Yaxiong Tian1-1/+1
The dentry returned by debugfs_lookup() needs to be released by calling dput() which is missing in margining_port_remove(). Fix this by calling debugfs_lookup_and_remove() that combines both and avoids the memory leak. Fixes: d0f1e0c2a699 ("thunderbolt: Add support for receiver lane margining") Cc: stable@vger.kernel.org Signed-off-by: Yaxiong Tian <tianyaxiong@kylinos.cn> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-11-17thunderbolt: Only add device router DP IN to the head of the DP resource listMika Westerberg1-1/+11
When pairing DP IN and DP OUT adapters for DisplayPort tunneling, we should prioritize the possible external GPU DP IN adapters to take advantage of the its capabilities. However the commit in question did this for host router DP IN adapters too and that changes ordering of the initial DP IN resources in such way that resuming from suspend may end up using different resource and that may confuse the user. Fix this so that we only put DP IN adapters of device routers to the top of the resource list and leave host routers as is. Fixes: 274baf695b08 ("thunderbolt: Add DP IN added last in the head of the list of DP resources") Reported-by: Pengfei Xu <pengfei.xu@intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-11-17thunderbolt: Send uevent after asymmetric/symmetric switchMika Westerberg1-2/+2
We should send uevent to userspace whenever the link speed or width changes but tb_switch_asym_enable() and tb_switch_asym_disable() set the sw->link_width already so tb_switch_update_link_attributes() never noticed the change. Fix this so that we let tb_switch_update_link_attributes() update the fields accordingly. Fixes: 81af2952e606 ("thunderbolt: Add support for asymmetric link") Reported-by: Pengfei Xu <pengfei.xu@intel.com> Tested-by: Pengfei Xu <pengfei.xu@intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-11-17thunderbolt: Set lane bonding bit only for downstream portGil Fine1-1/+1
Fix the lane bonding procedure to follow the steps described in USB4 Connection Manager guide. Hence, set the lane bonding bit only for downstream port. This is needed for certain ASMedia device, otherwise lane bonding fails and the device disconnects. Cc: stable@vger.kernel.org Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-11-14thunderbolt: Remove duplicated re-assignment of pointer 'out'Colin Ian King1-2/+0
The pointer 'out' is initialized and then a few statements later being re-assigned the same value. The second re-assignment is redundant and can be removed. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-11-04Merge tag 'usb-6.7-rc1' of ↵Linus Torvalds12-387/+1299
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb Pull USB/Thunderbolt updates from Greg KH: "Here is the "big" set of USB and Thunderbolt changes for 6.7-rc1. Nothing really major in here, just lots of constant development for new hardware. Included in here are: - Thunderbolt (i.e. USB4) fixes for reported issues and support for new hardware types and devices - USB typec additions of new drivers and cleanups for some existing ones - xhci cleanups and expanded tracing support and some platform specific updates - USB "La Jolla Cove Adapter (LJCA)" support added, and the gpio, spi, and i2c drivers for that type of device (all acked by the respective subsystem maintainers.) - lots of USB gadget driver updates and cleanups - new USB dwc3 platforms supported, as well as other dwc3 fixes and cleanups - USB chipidea driver updates - other smaller driver cleanups and additions, full details in the shortlog All of these have been in the linux-next tree for a while with no reported problems" * tag 'usb-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (167 commits) usb: gadget: uvc: Add missing initialization of ssp config descriptor usb: storage: set 1.50 as the lower bcdDevice for older "Super Top" compatibility usb: raw-gadget: report suspend, resume, reset, and disconnect events usb: raw-gadget: don't disable device if usb_ep_queue fails usb: raw-gadget: properly handle interrupted requests usb:cdnsp: remove TRB_FLUSH_ENDPOINT command usb: gadget: aspeed_udc: Convert to platform remove callback returning void dt-bindings: usb: fsa4480: Add compatible for OCP96011 usb: typec: fsa4480: Add support to swap SBU orientation dt-bindings: usb: fsa4480: Add data-lanes property to endpoint usb: typec: tcpm: Fix NULL pointer dereference in tcpm_pd_svdm() Revert "dt-bindings: usb: Add bindings for multiport properties on DWC3 controller" Revert "dt-bindings: usb: qcom,dwc3: Add bindings for SC8280 Multiport" thunderbolt: Fix one kernel-doc comment usb: gadget: f_ncm: Always set current gadget in ncm_bind() usb: core: Remove duplicated check in usb_hub_create_port_device usb: typec: tcpm: Add additional checks for contaminant arm64: dts: rockchip: rk3588s: Add USB3 host controller usb: dwc3: add optional PHY interface clocks dt-bindings: usb: add rk3588 compatible to rockchip,dwc3 ...
2023-10-27Merge tag 'thunderbolt-for-v6.7-rc1' of ↵Greg Kroah-Hartman12-387/+1299
git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt into usb-next Mika writes: thunderbolt: Changes for v6.7 merge window This includes following USB4/Thunderbolt changes for the v6.7 merge window: - Configure asymmetric link if the DisplayPort bandwidth requires so - Enable path power management packet support for USB4 v2 routers - Make the bandwidth reservations to follow the USB4 v2 connection manager guide suggestions - DisplayPort tunneling improvements - Small cleanups and improvements around the driver. All these have been in linux-next with no reported issues. * tag 'thunderbolt-for-v6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt: (25 commits) thunderbolt: Fix one kernel-doc comment thunderbolt: Configure asymmetric link if needed and bandwidth allows thunderbolt: Add support for asymmetric link thunderbolt: Introduce tb_switch_depth() thunderbolt: Introduce tb_for_each_upstream_port_on_path() thunderbolt: Introduce tb_port_path_direction_downstream() thunderbolt: Set path power management packet support bit for USB4 v2 routers thunderbolt: Change bandwidth reservations to comply USB4 v2 thunderbolt: Make is_gen4_link() available to the rest of the driver thunderbolt: Use weight constants in tb_usb3_consumed_bandwidth() thunderbolt: Use constants for path weight and priority thunderbolt: Add DP IN added last in the head of the list of DP resources thunderbolt: Create multiple DisplayPort tunnels if there are more DP IN/OUT pairs thunderbolt: Log NVM version of routers and retimers thunderbolt: Use tb_tunnel_xxx() log macros in tb.c thunderbolt: Expose tb_tunnel_xxx() log macros to the rest of the driver thunderbolt: Use tb_tunnel_dbg() where possible to make logging more consistent thunderbolt: Fix typo of HPD bit for Hot Plug Detect thunderbolt: Fix typo in enum tb_link_width kernel-doc thunderbolt: Fix debug log when DisplayPort adapter not available for pairing ...
2023-10-24thunderbolt: Fix one kernel-doc commentYang Li1-1/+1
Fix a spelling errors in kernel doc comment, silence the warning: drivers/thunderbolt/tb.c:760: warning: expecting prototype for tb_maximum_banwidth(). Prototype was for tb_maximum_bandwidth() instead Reported-by: Abaci Robot <abaci@linux.alibaba.com> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=7048 Signed-off-by: Yang Li <yang.lee@linux.alibaba.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-10-20thunderbolt: Configure asymmetric link if needed and bandwidth allowsGil Fine1-123/+558
USB4 v2 spec defines a Gen 4 link that can operate as an asymmetric 120/40G. When the link is asymmetric, the USB4 port on one side of the link operates with three TX lanes and one RX lane, while the USB4 port on the opposite side of the link operates with three RX lanes and one TX lane. Using asymmetric link we can get much more bandwidth from one direction and that allows us to support the new Ultra High Bit Rate DisplayPort modes (that consume up to 77.37 Gb/s). Add the basic logic for changing Gen 4 links to asymmetric and back following the below rules: 1) The default threshold is 45 Gb/s (tunable by asym_threshold) 2) When DisplayPort tunnel is established, or when there is bandwidth request through bandwidth allocation mode, the links can be transitioned to asymmetric or symmetric (depending on the required bandwidth). 3) Only DisplayPort bandwidth on a link, is taken into account when deciding whether a link is transitioned to asymmetric or symmetric 4) If bandwidth on a link is >= asym_threshold transition the link to asymmetric 5) If bandwidth on a link < asym_threshold transition the link to symmetric (unless the bandwidth request is above currently allocated on a tunnel). 6) If a USB4 v2 device router with symmetric link is connected, transition all the links above it to symmetric if the bandwidth allows. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Co-developed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-10-20thunderbolt: Add support for asymmetric linkGil Fine5-55/+381
USB4 v2 spec defines a Gen 4 link that can operate as an aggregated symmetric (80/80G) or asymmetric (120/40G). When the link is asymmetric, the USB4 port on one side of the link operates with three TX lanes and one RX lane, while the USB4 port on the opposite side of the link operates with three RX lanes and one TX lane. Add support for the asymmetric link and provide functions that can be used to transition the link to asymmetric and back. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Co-developed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-10-20thunderbolt: Introduce tb_switch_depth()Mika Westerberg2-2/+11
This is useful helper to find out the depth of a connected router. Convert the existing users to call this helper instead of open-coding. No functional changes. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-10-20thunderbolt: Introduce tb_for_each_upstream_port_on_path()Mika Westerberg1-0/+15
This is useful when walking over upstream lane adapters over given path. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-10-20thunderbolt: Introduce tb_port_path_direction_downstream()Gil Fine3-10/+25
Introduce tb_port_path_direction_downstream() to check if path from source adapter to destination adapter is directed towards downstream. Convert existing users to call this helper instead of open-coding. No functional changes. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-10-20thunderbolt: Set path power management packet support bit for USB4 v2 routersMika Westerberg4-13/+34
USB4 v2 spec allows USB4 links that are part of a pass through tunnel (such as DisplayPort and USB 3.x Gen T) to enter lower CL states, which provide better power management. For this USB4 v2 routers in their path config space of lane 0 adapter include a new bit PMPS (PM packet support) that needs to be set. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-10-20thunderbolt: Change bandwidth reservations to comply USB4 v2Gil Fine3-3/+76
USB4 v2 Connection Manager guide (section 6.1.2.3) suggests to reserve bandwidth in a sligthly different manner. It suggests to keep minimum of 1500 Mb/s for each path that carry a bulk traffic. Here we change the bandwidth reservations to comply to the above for USB 3.x and PCIe protocols over Gen 4 link, taking weights into account (that's 1500 Mb/s for PCIe and 3000 Mb/s for USB 3.x). For Gen 3 and below we use the existing reservation. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-10-20thunderbolt: Make is_gen4_link() available to the rest of the driverGil Fine2-7/+30
Rework the function to return the link generation, update the name to tb_port_get_link_generation(), and make available to the rest of the driver. This is needed in the subsequent patches. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-10-20thunderbolt: Use weight constants in tb_usb3_consumed_bandwidth()Mika Westerberg1-3/+6
Instead of magic numbers use the constants we introduced in the previous commit to make the code more readable. No functional changes. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-10-20thunderbolt: Use constants for path weight and priorityMika Westerberg1-12/+27
Makes it easier to follow and update. No functional changes. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-10-17Merge tag 'thunderbolt-for-v6.6-rc7' of ↵Greg Kroah-Hartman1-4/+6
git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt into usb-linus Mika writes: thunderbolt: Fix for v6.6-rc7 This includes a single commit that fixes a memory leak when DisplayPort bandwidth allocation request is being handled by the driver. This has been in linux-next with no reported issues. * tag 'thunderbolt-for-v6.6-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt: thunderbolt: Call tb_switch_put() once DisplayPort bandwidth request is finished
2023-10-13thunderbolt: Add DP IN added last in the head of the list of DP resourcesGil Fine1-1/+1
If DP IN on device router exist, position it at the beginning of the DP resources list, so that it is used before DP IN on host router. This way external GPU will be prioritized when pairing DP IN and DP OUT for DisplayPort tunnel setup. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-10-13thunderbolt: Create multiple DisplayPort tunnels if there are more DP IN/OUT ↵Gil Fine1-9/+17
pairs Currently we only create one DisplayPort tunnel even if there would be more DP IN/OUT pairs available. Specifically this happens when a router is unplugged and we check if a new DisplayPort tunnel can be created. To cover this create tunnels as long as we find suitable DP IN/OUT pairs. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-10-13thunderbolt: Log NVM version of routers and retimersGil Fine2-0/+2
This is useful when debugging possible issues. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-10-13thunderbolt: Use tb_tunnel_xxx() log macros in tb.cMika Westerberg1-22/+28
Now that the macros are available we can use them in tb.c. This makes the log output more consistent. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-10-13thunderbolt: Expose tb_tunnel_xxx() log macros to the rest of the driverMika Westerberg2-22/+28
In order to allow more consistent logging of tunnel related information make these logging macros available to the rest of the driver. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-10-13thunderbolt: Use tb_tunnel_dbg() where possible to make logging more consistentMika Westerberg1-35/+30
This makes it easier to find out the tunnel in question. Also drop a couple of lines that generate duplicate information. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-10-13thunderbolt: Fix typo of HPD bit for Hot Plug DetectGil Fine2-6/+6
Fix typo of HPD bit stands for Hot Plug Detect. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-10-13thunderbolt: Fix debug log when DisplayPort adapter not available for pairingGil Fine1-4/+3
Fix debug log when looking for a DisplayPort adapter pair of DP IN and DP OUT. In case of no DP adapter available, log the type of the DP adapter that is not available. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-10-13thunderbolt: Check for unplugged router in tb_switch_clx_disable()Mika Westerberg1-0/+3
There is no point disabling CL states if the router is unplugged so in that case return early. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-10-13thunderbolt: Make tb_switch_clx_is_supported() staticMika Westerberg2-23/+22
This function is not used outside of clx.c so make it static. No functional changes. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-10-13thunderbolt: Get rid of usb4_usb3_port_actual_link_rate()Mika Westerberg4-42/+2
It turns out there is no need to use the actual link rate when reclaiming bandwidth for USB 3.x. The reason is that we use consumed bandwidth which is coming from xHCI when releasing bandwidth (for example for DisplayPort tunneling) and this can be anything between 1000 Mb/s to maximum, so when reclaiming we can just bump it up back to maximum instead of actual link rate (which is always <= maximum). This allows us to get rid of couple of unnecessary lines of code. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-10-13thunderbolt: dma_test: Use enum tb_link_widthMika Westerberg1-9/+5
Since we have it, use it in the DMA test driver as well. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-10-05thunderbolt: Call tb_switch_put() once DisplayPort bandwidth request is finishedGil Fine1-4/+6
When handling DisplayPort bandwidth request tb_switch_find_by_route() is called and it returns a router structure with reference count increased. In order to avoid resource leak call tb_switch_put() when finished. Fixes: 6ce3563520be ("thunderbolt: Add support for DisplayPort bandwidth allocation mode") Cc: stable@vger.kernel.org Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2023-09-15thunderbolt: Apply USB 3.x bandwidth quirk only in software connection managerMika Westerberg1-0/+3
This is not needed when firmware connection manager is run so limit this to software connection manager. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>