An error occurred fetching the project authors.
- 09 Jun, 2023 1 commit
-
-
Gil Fine authored
Introduce tb_switch_downstream_port() helper function that returns the downstream port of a parent switch that is connected to the upstream port of specified switch. From now on, we use it all across the driver where applicable. While there fix a whitespace in comment and rename 'downstream' to 'down' to be consistent with the rest of the driver. Signed-off-by:
Gil Fine <gil.fine@intel.com> Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com>
-
- 09 Sep, 2022 1 commit
-
-
Gil Fine authored
Add support for Maple Ridge discrete USB4 host controller from Intel which has a single USB4 port (versus the already supported dual port Maple Ridge USB4 host controller). Cc: stable@vger.kernel.org Signed-off-by:
Gil Fine <gil.fine@intel.com> Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com>
-
- 22 Aug, 2022 1 commit
-
-
Mika Westerberg authored
Intel Meteor Lake has the same integrated Thunderbolt/USB4 controller as Intel Alder Lake. Add the Intel Meteor Lake PCI IDs to the driver list of supported devices. Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com>
-
- 06 Jun, 2022 1 commit
-
-
George D Sworo authored
Intel Raptor Lake has the same integrated Thunderbolt/USB4 controller as Intel Alder Lake. By default it is still using firmware based connection manager so we can use most of the Alder Lake flows. Signed-off-by:
George D Sworo <george.d.sworo@intel.com> Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com>
-
- 15 Dec, 2021 1 commit
-
-
Xiaoke Wang authored
kmemdup() may return NULL if there is not enough memory available. Check this and bail out early in this case. While there move INIT_WORK() to happen after we have allocated all the memory needed for the event handling to avoid doing unnecessary work. Signed-off-by:
Xiaoke Wang <xkernel.wang@foxmail.com> Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com>
-
- 11 Jun, 2021 2 commits
-
-
Azhar Shaikh authored
Alder Lake has the same integrated Thunderbolt/USB4 controller as Intel Tiger Lake. By default it is still using firmware based connection manager so we can use most of the Tiger Lake flows. Add the Alder Lake PCI IDs to the driver list of supported devices. Signed-off-by:
Azhar Shaikh <azhar.shaikh@intel.com> Reviewed-by:
Yehezkel Bernat <YehezkelShB@gmail.com> Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com>
-
Gil Fine authored
In Intel Tiger Lake and beyond it takes some time after the force power is set until the firmware connection manager is ready. So instead of reading it once we poll it for 10ms before giving up. Signed-off-by:
Gil Fine <gil.fine@intel.com> Reviewed-by:
Yehezkel Bernat <YehezkelShB@gmail.com> Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com>
-
- 18 Mar, 2021 2 commits
-
-
Mika Westerberg authored
Currently we have had an artificial limitation of a single DMA tunnel per XDomain connection. However, hardware wise there is no such limit and software based connection manager can take advantage of all the DMA rings available on the host to establish tunnels. For this reason make the tb_xdomain_[enable|disable]_paths() to take the DMA ring and HopID as parameter instead of storing them in the struct tb_xdomain. We also add API functions to allocate input and output HopIDs of the XDomain connection that the service drivers can use instead of hard-coding. Also convert the two existing service drivers over to this API. Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com>
-
Mika Westerberg authored
When the firmware connection manager is not proxying between the software and the hardware we can decrease the timeout for control packets significantly. The USB4 spec recommends 10 ms +- 1 ms but we use slightly larger value (100 ms) which is recommendation from Intel Thunderbolt firmware folks. When firmware connection manager is running then we keep using the existing 5000 ms. To implement this we move the control channel allocation to tb_domain_alloc(), and pass the timeout from that function to the tb_ctl_alloc(). Then make both connection manager implementations pass the timeout when they alloc the domain structure. While there update kernel-doc of struct tb_ctl to match the reality. Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com>
-
- 04 Feb, 2021 1 commit
-
-
Mika Westerberg authored
This allows disabling XDomain protocol completely if the user does not plan to use the USB4/Thunderbolt peer-to-peer functionality, or for security reasons. XDomain protocol is enabled by default but with this commit it is possible to disable it by passing "xdomain=0" as module parameter (or through the kernel command line). Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com> Acked-by:
Yehezkel Bernat <YehezkelShB@gmail.com>
-
- 28 Jan, 2021 1 commit
-
-
Lee Jones authored
Fixes the following W=1 kernel build warning(s): drivers/thunderbolt/icm.c:122: warning: Function parameter or member 'xdomain_connected' not described in 'icm' drivers/thunderbolt/icm.c:122: warning: Function parameter or member 'xdomain_disconnected' not described in 'icm' 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 Signed-off-by:
Lee Jones <lee.jones@linaro.org> Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com>
-
- 07 Jan, 2021 1 commit
-
-
Mika Westerberg authored
The tb_dbg() call is using %#x that already adds the 0x prefix so don't duplicate it. Fixes: 9039387e ("thunderbolt: Add USB4 router operation proxy for firmware connection manager") Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by:
Yehezkel Bernat <YehezkelShB@gmail.com>
-
- 30 Nov, 2020 5 commits
-
-
Mika Westerberg authored
Maple Ridge is first discrete USB4 host controller from Intel. It comes with firmware based connection manager and the flows are similar as used in Intel Titan Ridge. Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com>
-
Mika Westerberg authored
Intel Maple Ridge and Tiger Lake connection manager firmware implements a USB4 router operation proxy that should be used instead of direct register access to avoid races with the firmware. This is supported in all firmwares where the protocol version field returned in the driver ready response is 3 (or higher). This adds the USB4 router proxy operations support to the driver so that we first check the protocol version and if it is 3 (or higher) the USB4 router operation is run through the firmware provided proxy. Otherwise the native version is used. Most USB4 router proxy operations are pretty straightforward except NVM_AUTH where the firmware only responds once the router is restarted but before it sends device connected notification. To support this we split the operation so that the reply is received asynchronously and stored to struct icm. This last reply is then returned in icm_usb4_switch_nvm_authenticate_status() if available. Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com>
-
Mika Westerberg authored
When doing device firmware upgrade the device will disconnect for a while and then reconnect back. Keep the parent device (and the whole domain) powered for a while so we don't need to runtime resume immediately when the device is connected back after the device upgrade completes. Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com>
-
Mika Westerberg authored
This makes it easier to figure out whether the driver is using firmware or software based connection manager implementation. Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com>
-
Mika Westerberg authored
This makes the kernel-doc to match the ordering and also this is better place for it, not between upstream_port and vnd_cap that are used together. Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com>
-
- 19 Nov, 2020 1 commit
-
-
Mika Westerberg authored
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 <paulian@marinca.net> Fixes: 4f7c2e0d ("thunderbolt: Make sure device runtime resume completes before taking domain lock") Cc: stable@vger.kernel.org Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
- 06 Nov, 2020 1 commit
-
-
Mika Westerberg authored
Intel Tiger Lake-H has the same Thunderbolt/USB4 controller as Tiger Lake-LP. Add the Tiger Lake-H PCI IDs to the driver list of supported devices. Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com>
-
- 03 Sep, 2020 1 commit
-
-
Mika Westerberg authored
In Tiger Lake the Firmware CM is always enabled (so bit 0 is always set) but it may be in "pass through" mode which means it requires Software CM instead. This can be determined by checking bit 31 instead. Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com>
-
- 23 Apr, 2020 1 commit
-
-
Mika Westerberg authored
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 <mika.westerberg@linux.intel.com> Acked-by:
Yehezkel Bernat <yehezkelshb@gmail.com>
-
- 14 Feb, 2020 1 commit
-
-
Gustavo A. R. Silva authored
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 76497732 ("cxgb3/l2t: Fix undefined behaviour") Signed-off-by:
Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com>
-
- 02 Nov, 2019 2 commits
-
-
Mika Westerberg authored
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 <mika.westerberg@linux.intel.com>
-
Mika Westerberg authored
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 <mika.westerberg@linux.intel.com>
-
- 01 Nov, 2019 2 commits
-
-
Mika Westerberg authored
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 <mika.westerberg@linux.intel.com>
-
Mika Westerberg authored
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 <mika.westerberg@linux.intel.com>
-
- 26 Aug, 2019 2 commits
-
-
Mika Westerberg authored
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 <raanan.avargil@intel.com> Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by:
Yehezkel Bernat <YehezkelShB@gmail.com> Tested-by:
Mario Limonciello <mario.limonciello@dell.com>
-
Mika Westerberg authored
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 <mika.westerberg@linux.intel.com> Reviewed-by:
Yehezkel Bernat <YehezkelShB@gmail.com> Tested-by:
Mario Limonciello <mario.limonciello@dell.com>
-
- 14 Jun, 2019 1 commit
-
-
Mika Westerberg authored
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 ->cio_reset() callback with corresponding implementations for Alpine and Titan Ridge. Fixes: c4630d6a ("thunderbolt: Start firmware on Titan Ridge Apple systems") Reported-by:
Peter Bowen <pzb@amazon.com> Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com>
-
- 12 Jun, 2019 1 commit
-
-
Mika Westerberg authored
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: 09f11b6c ("thunderbolt: Take domain lock in switch sysfs attribute callbacks") Reported-by:
Pengfei Xu <pengfei.xu@intel.com> Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com>
-
- 18 Apr, 2019 6 commits
-
-
Mika Westerberg authored
Titan Ridge flow to start the firmware is the same as Alpine Ridge so we can do the same on Titan Ridge based Apple systems. Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com>
-
Mika Westerberg authored
Now that the driver can handle every possible tunnel types there is no point to log everything as info level so turn these to happen at debug level instead. While at it remove duplicated tunnel activation log message (tb_tunnel_activate() calls tb_tunnel_restart() which print the same message) and add one missing '\n' termination. Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com>
-
Mika Westerberg authored
In order to detect possible connections to other domains we need to be able to find out why tb_switch_alloc() fails so make it return ERR_PTR() instead. This allows the caller to differentiate between errors such as -ENOMEM which comes from the kernel and for instance -EIO which comes from the hardware when trying to access the possible switch. Convert all the current call sites to handle this properly. Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com>
-
Mika Westerberg authored
Currently the driver only assigns remote port for the primary port if in case of dual link. This makes things such as walking from one port to another more complex than necessary because the code needs to change from secondary to primary port if the path that is established is created using secondary links. In order to always assign both remote pointers we need to prevent the scanning code from following the secondary link. Failing to do that might cause problems as the same switch may be enumerated twice (or removed in case of unplug). Handle that properly by introducing a new function tb_port_has_remote() that returns true only for the primary port. We also update tb_is_upstream_port() to support both dual link ports, make it take const port pointer and move it below tb_upstream_port() to keep similar functions close. Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com>
-
Mika Westerberg authored
Maximum depth in Thunderbolt topology is 6 so make sure it is not possible to allocate switches that exceed the depth limit. While at it update tb_switch_alloc() to use upper/lower_32_bits() following tb_switch_alloc_safe_mode(). Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com>
-
Mika Westerberg authored
tb_switch_find_by_route() does the same already so use it instead and remove duplicated get_switch_at_route(). Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by:
Lukas Wunner <lukas@wunner.de>
-
- 28 Mar, 2019 1 commit
-
-
Aditya Pakki authored
uuid in add_switch is allocted via kmemdup which can fail. The patch logs the error and cleans up the allocated memory for switch. Signed-off-by:
Aditya Pakki <pakki001@umn.edu> Reviewed-by:
Mukesh Ojha <mojha@codeaurora.org> Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com>
-
- 02 Oct, 2018 2 commits
-
-
Mika Westerberg authored
This gets rid of the licence boilerplate duplicated in each file. While there fix doubled space in domain.c author line. No functional changes intended. Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com> Acked-by:
Yehezkel Bernat <yehezkelshb@gmail.com> Signed-off-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Mika Westerberg authored
If there is a long chain of devices connected when the driver is loaded ICM sends device connected event for each and those are put to tb->wq for later processing. Now if the driver gets unloaded in the middle, so that the work queue is not yet empty it gets flushed by tb_domain_stop(). However, by that time the root switch is already removed so the driver crashes when it tries to dereference it in ICM event handling callbacks. Fix this by checking whether the root switch is already removed. If it is we know that the domain is stopped and we should merely skip handling the event. Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
- 25 Jul, 2018 1 commit
-
-
Mika Westerberg authored
When Thunderbolt host controller is set to RTD3 mode (Runtime D3) it is present all the time. Because of this it is important to runtime suspend the controller whenever possible. In case of ICM we have following rules which all needs to be true before the host controller can be put to D3: - The controller firmware reports to support RTD3 - All the connected devices announce support for RTD3 - There is no active XDomain connection Implement this using standard Linux runtime PM APIs so that when all the children devices are runtime suspended, the Thunderbolt host controller PCI device is runtime suspended as well. The ICM firmware then starts powering down power domains towards RTD3 but it can prevent this if it detects that there is an active Display Port stream (this is not visible to the software, though). The Thunderbolt host controller will be runtime resumed either when there is a remote wake event (device is connected or disconnected), or when there is access from userspace that requires hardware access. Signed-off-by:
Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-