[PATCH 6.6 00/14] Backport thunderbolt fix(es) from v6.9

From: Alexandru Gagniuc
Date: Tue Oct 01 2024 - 13:32:18 EST


From: Alexandru Gagniuc <mr.nuke.me@xxxxxxxxx>

These patches resolve thunderbolt issues on Intel Raptor Lake systems.
With a monitor connected to a HP Thunderbolt G4 dock, the display
sometimes stops working after resume.

The kernel reports an issue with the DisplayPort MST topology, the
full backtrace being pasted below. This failure is since v6.9-rc1 by
commit b4734507ac55 ("thunderbolt: Improve DisplayPort tunnel setup
process to be more robust"). The other commits are dependencies such
that all changes apply cleanly without needing modification.

Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.414673] UBSAN: shift-out-of-bounds in drivers/gpu/drm/display/drm_dp_mst_topology.c:4416:36
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.414674] shift exponent -1 is negative
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.414675] CPU: 0 PID: 145 Comm: kworker/0:2 Tainted: G U 6.6.16 #108
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.414677] Hardware name: HP HP Elite t660 Thin Client/8D05, BIOS W44 Ver. 00.14.00 07/19/2024
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.414678] Workqueue: events output_poll_execute [drm_kms_helper]
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.414695] Call Trace:
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.414697] <TASK>
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.414698] dump_stack_lvl+0x48/0x70
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.414703] dump_stack+0x10/0x20
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.414705] __ubsan_handle_shift_out_of_bounds+0x156/0x310
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.414708] ? krealloc+0x98/0x100
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.414711] ? drm_atomic_get_private_obj_state+0x167/0x1a0 [drm]
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.414733] drm_dp_atomic_release_time_slots.cold+0x17/0x3d [drm_display_helper]
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.414743] intel_dp_mst_atomic_check+0x9a/0x170 [i915]
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.414831] drm_atomic_helper_check_modeset+0x4bb/0xe20 [drm_kms_helper]
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.414842] ? __kmem_cache_alloc_node+0x1b3/0x320
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.414845] ? __ww_mutex_lock.constprop.0+0x39/0xa00
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.414848] intel_atomic_check+0x113/0x2b50 [i915]
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.414936] drm_atomic_check_only+0x692/0xb80 [drm]
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.414956] drm_atomic_commit+0x57/0xd0 [drm]
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.414972] ? _pfx__drm_printfn_info+0x10/0x10 [drm]
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.414999] drm_client_modeset_commit_atomic+0x1f1/0x230 [drm]
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.415019] drm_client_modeset_commit_locked+0x5b/0x170 [drm]
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.415038] ? mutex_lock+0x13/0x50
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.415040] drm_client_modeset_commit+0x27/0x50 [drm]
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.415058] __drm_fb_helper_restore_fbdev_mode_unlocked+0xd2/0x100 [drm_kms_helper]
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.415068] drm_fb_helper_hotplug_event+0x11a/0x140 [drm_kms_helper]
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.415077] intel_fbdev_output_poll_changed+0x6f/0xb0 [i915]
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.415156] output_poll_execute+0x23e/0x290 [drm_kms_helper]
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.415166] ? intelfb_dirty+0x41/0x80 [i915]
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.415236] process_one_work+0x178/0x360
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.415238] ? __pfx_worker_thread+0x10/0x10
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.415240] worker_thread+0x307/0x430
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.415241] ? __pfx_worker_thread+0x10/0x10
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.415242] kthread+0xf4/0x130
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.415245] ? __pfx_kthread+0x10/0x10
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.415247] ret_from_fork+0x43/0x70
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.415249] ? __pfx_kthread+0x10/0x10
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.415250] ret_from_fork_asm+0x1b/0x30
Sep 6 08:10:29 HP7c5758fc4d4f kernel: [ 89.415252] </TASK>

Gil Fine (8):
thunderbolt: Fix debug log when DisplayPort adapter not available for
pairing
thunderbolt: Create multiple DisplayPort tunnels if there are more DP
IN/OUT pairs
thunderbolt: Make is_gen4_link() available to the rest of the driver
thunderbolt: Change bandwidth reservations to comply USB4 v2
thunderbolt: Introduce tb_port_path_direction_downstream()
thunderbolt: Add support for asymmetric link
thunderbolt: Configure asymmetric link if needed and bandwidth allows
thunderbolt: Improve DisplayPort tunnel setup process to be more
robust

Mika Westerberg (6):
thunderbolt: Use tb_tunnel_dbg() where possible to make logging more
consistent
thunderbolt: Expose tb_tunnel_xxx() log macros to the rest of the
driver
thunderbolt: Use constants for path weight and priority
thunderbolt: Use weight constants in tb_usb3_consumed_bandwidth()
thunderbolt: Introduce tb_for_each_upstream_port_on_path()
thunderbolt: Introduce tb_switch_depth()

drivers/thunderbolt/switch.c | 328 +++++++++++---
drivers/thunderbolt/tb.c | 784 +++++++++++++++++++++++++++-------
drivers/thunderbolt/tb.h | 56 ++-
drivers/thunderbolt/tb_regs.h | 9 +-
drivers/thunderbolt/tunnel.c | 217 ++++++----
drivers/thunderbolt/tunnel.h | 26 +-
drivers/thunderbolt/usb4.c | 106 +++++
7 files changed, 1225 insertions(+), 301 deletions(-)

--
2.45.1