From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A8C33A5E6F for ; Wed, 27 May 2026 06:41:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.125.188.122 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779864110; cv=none; b=D4kOMjv04huEQl+cFf73P+4DT3wVbBwSDe/bSSOqdb9oTvc5vty5xaPvukuAgisEXiangKFy7dqn9k04iS2I4cSrKrHaJxTm+zvb1SrxcE1JTCc40+DKytdyIzx1O9fxEYaW+ek/j3uEqYRG+3jwZaztNmv4dTQjbg/6bHVY6TM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779864110; c=relaxed/simple; bh=NNUYMTCF+365bgC+7NpTKV7/7dhPFKfEp2//TaCS0Us=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=Ny0qUScOCoUUHKe2JAwdGuAM+APJafe1bzekGixHRjwUI3YknbYr9gEKWCTTWFRxBvZLJmxezabrft2NdLZofPJDJcG7ZvbySTyo8HaBw56DNwtOmMxKM+U5LXk3g5DF2VmrKqLAriBWWbSmH4xGhaawu+Gs+KFKxeqcCoy6EmA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=canonical.com; spf=pass smtp.mailfrom=canonical.com; dkim=pass (4096-bit key) header.d=canonical.com header.i=@canonical.com header.b=fIciVYPx; arc=none smtp.client-ip=185.125.188.122 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=canonical.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=canonical.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (4096-bit key) header.d=canonical.com header.i=@canonical.com header.b="fIciVYPx" Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id C98E23F7B0 for ; Wed, 27 May 2026 06:41:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20251003; t=1779864097; bh=JihqlByVD4zw3LBRcRqpkLVmflWTkP0ezaDlgML+dlo=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=fIciVYPx7gIr7RgXUlDMW5EbmXrFLBTFs3+U0nHUf0cmFMWg2WU5eoiAkPDrrNZb4 epQDlwnk6a3BYDFCso+c98zehkWWjp0wlybhvl/HI2DnvgqLHmF//P5docKAmlxVpc qZUd3jQLk3mAjl8hon2fSaclEKKnu5aIm9zuy0zeAmBfJmftg/CmwafTtHbcNQzU5i 1OH+Zh9d5LVZdvxH0ySPogJocWQpjOqd+gz889e/l1ZvT6Yaoh/GA0tUWM6cn5biAi 3cc1xusx845/lA9TFIVY6ByDx5uAtbdAHci0Ncm0e6bVj0wqeaPQ6F9nVqHAkR6x5g hitvv7KaSnxJ/ckZJtqapNevoV1/Dy7ZIELtMnzW2vj5AodUxTrcYHQajmo2Ate6+y CibbnPKWSQfWhSY1UbREvD2v6SjI6abEAr2wnREQbH3XWGutzBIS8Pt9G3OXXKQKmi C1AprfrVO/AUm3uo1NwtAzl1MF/xn3htCHwY4lwzKgIZ/OrsvZLemMZcHTf61PIQav VlrZdxPMdLQHPntv4oi504FoAcPDVOiFcjQRdkS47Y/uRh/7RGDmjXUefHuk2irWQy Xj5CGgMz4LHumcEvwjSaw6o40SvJdgn/AcYNV24Jv+e9ASWwGhIfOnytSsKI2usxUA jF/cOm+4YPLhsoaKyr4J1h/8= Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2bcc0a30d60so27157125ad.1 for ; Tue, 26 May 2026 23:41:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779864096; x=1780468896; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=JihqlByVD4zw3LBRcRqpkLVmflWTkP0ezaDlgML+dlo=; b=eUSfHK+qQgFrPVyLCR/iV4g7DC6ulxQ3ssvKIatHkpDHw/VlEcy+OjCmwIkyCYEkx6 YMHOOC1iG0CO7bIopIuwTaAZ7Y7AoOODsg4LtPy12p9JBnXBbZoxB9ye3bAlWLJz+LvW 6Tvt3gJKu1djOFwPQrX767nmOpcqzKlAUxrQkIki+aEzvPNvaDfPypZA13N0fTKv84qQ irpUSaLp6AkN1fHatb9OkRmfzLliwGb5Ws1Vq0Bc61HPC8Ayoj3TKnoN2KHosfZbstte 7nyBTNE9QAOPH14cPh1m6CNJev/1ZoRDPkEAoyGtv3k4XoN3f9AyY4Q9Ko+d97Eh3oyz 4Rmw== X-Forwarded-Encrypted: i=1; AFNElJ/KgwUkT5KSvqul6hYsxi4gXl5NJtA1oD/1qT4r7EqovmZweTCJvThxrz7CDad4Bp1BmnAb6nflg3HuzBY=@vger.kernel.org X-Gm-Message-State: AOJu0Yxi+nejJh6tM1/H/O3Nkn6eYPpJsIVNfnksCb4crNzBusPxMCAG Vdn2eIbtw0i3viwM59EbVd5sI8dldJdghSepsukLyJa4HWuirK5nMHxxiX/wO+S8Se5Dm3W+bzw t7zX54ADkUddhn7wsoLtuyo8NKJNM62ASmuzB8YCU3ir4nLKFRRq49gOFaDdW8ss9ud+tn8Vkpm V23zMZBQ== X-Gm-Gg: Acq92OGg4EYotL0Amllpdoy5IkS2fJjv7FKDonNCXj17t6Nk2XTVkPmei28MU3vB5rK o/sLOsytMAIH9gp9bYZiMuSqiYT40fT0Kz9eJCk8kLHRYFXoQdSFOLi2fQ88v41gPQuOrYH6GOK 3YIzNKllwp1gTUjQUytYyA77TNixWb486W5CouPgqaF7IJokpjuu68fpspD5Age5GPyoZaqe/fs 5VgjF8WrmQ6cpVBFZuhMW0N1rkb82BxC1gtmCCVTCyay5Sbz/ufq2kGtdDpG3DQ0iGzIcPg3fFx ZgjScwybPF7VQRPpWGoZbbo0Z7HPD9bB0XluxiUbQUDe+KQvB4XcMP0mMdo8AAZUKaw243Th+GG JF6b8LJZ9ufDKPAwsTtCLQCGLNdur83MEnwfL3cn+8/oFTMRiaXqLMdwoN4yAQ0fyN4DXvykb2K f+YW/Vuh76etXf5xrPP02ZTntTBCJP2VNTxoY2LWDLUfigXCaOdKMY6d7bELi8UlDU31YK9bXq3 20O+FEB X-Received: by 2002:a17:903:2ec3:b0:2ba:1e94:d03b with SMTP id d9443c01a7336-2beb06acd0fmr121668405ad.6.1779864096232; Tue, 26 May 2026 23:41:36 -0700 (PDT) X-Received: by 2002:a17:903:2ec3:b0:2ba:1e94:d03b with SMTP id d9443c01a7336-2beb06acd0fmr121668285ad.6.1779864095904; Tue, 26 May 2026 23:41:35 -0700 (PDT) Received: from an-XPS-15-9520.buildd (2001-b011-2008-658f-4fd7-7372-71f3-d446.dynamic-ip6.hinet.net. [2001:b011:2008:658f:4fd7:7372:71f3:d446]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2beb58fef85sm141361335ad.75.2026.05.26.23.41.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 May 2026 23:41:35 -0700 (PDT) From: ChunAn Wu To: mika.westerberg@linux.intel.com Cc: andreas.noever@gmail.com, michael.jamet@intel.com, YehezkelShB@gmail.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/1] thunderbolt: Defer DP tunnel teardown until display driver is ready Date: Wed, 27 May 2026 14:41:20 +0800 Message-Id: <20260527064121.173952-1-an.wu@canonical.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hi, On systems with Full Disk Encryption (LUKS), the Thunderbolt driver loads from initramfs early in boot and discovers the BIOS-established DP tunnel. It starts DPRX polling, waiting for the GPU driver to read DPCD from the connected monitor so the router firmware can set the DPRX_DONE bit. However, the GPU driver resides on the encrypted root filesystem and cannot load until the user enters the passphrase -- which takes an unbounded amount of time. The 12-second DPRX timeout fires, and tb_dp_resource_unavailable() permanently removes the DP IN adapter from dp_resources. The external display stays blank with no software recovery path -- only physically re-plugging the dock brings it back. This patch defers the DP tunnel teardown when no PCI display driver has bound yet. At DPRX timeout, we check whether any PCI display class (0x03xx) device has a driver. If not, the tunnel is torn down but the DP IN resource is kept in the available list. A PCI bus notifier watches for BUS_NOTIFY_BOUND_DRIVER on display class devices. When the GPU driver eventually binds, the notifier schedules a work item that calls tb_tunnel_dp() to re-establish the connection. By that point the GPU has already read DPCD during its probe, so DPRX_DONE is already set and the tunnel activates immediately. If a display driver is already bound when the timeout fires, the existing teardown behavior is preserved -- this indicates a real failure (bad cable, disconnected display, etc.) rather than a timing issue. Considerations: - All GPU drivers on x86 (i915, xe, amdgpu, nouveau) register as PCI drivers with base class 0x03, so a single PCI bus notifier covers all vendors with no GPU driver changes needed. - The notifier fires after probe() succeeds (BUS_NOTIFY_BOUND_DRIVER), which means the GPU has already initialized the display engine and performed DPCD reads -- the retry succeeds immediately. - On suspend/resume the existing tunnel re-establishment paths are used; this patch only affects the initial boot timing issue. Testing: - Hardware: Dell Pro Max 14 MC14250, Dell SD25TB5 Thunderbolt 5 Dock, external BenQ monitor, LUKS full disk encryption. - Reproduced the issue: TB loaded at T+1s, DPRX teardown at T+14s, i915 loaded at T+84s, display blank. - With the patch: TB loaded at T+1s, DPRX timeout at T+14s printed "not active, deferring until display driver loads", i915 loaded at T+72s, notifier triggered retry, display came up successfully. - Also tested with i915 blacklisted at boot and loaded via a systemd service after a 30-second delay to simulate the FDE gap in a controlled way. The 58-second gap between timeout and GPU loading was handled correctly. - Verified that dock hotplug (GPU already loaded) still works normally -- the display_bound flag is true and the existing code path is taken. ChunAn Wu (1): thunderbolt: Defer DP tunnel teardown until display driver is ready drivers/thunderbolt/tb.c | 97 ++++++++++++++++++++++++++++++++++------ 1 file changed, 89 insertions(+), 8 deletions(-) -- 2.34.1