From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (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 C42A93A599C for ; Tue, 12 May 2026 13:58:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778594321; cv=none; b=jtq3t14QWYGT/9DuEBsUbcCqw1ZQU4guPFlIKedNyHKPahltlLVu7qQEK82eQWuTAKlbuH+JPRKdOXJUr0SWTOnvJ33H7DK3LYHMC3vTOrufrRi8zW4tQ+2BlPZcC/9gXd58WiO5esrK8SfdfQ/fxmDubFH0PvktwUbL8bGPaA0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778594321; c=relaxed/simple; bh=J+JMZRqK9ZOguzeozFmWapNCXk2xSTLcc+FBiwf1pUw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=TbAZmV+G+G1NPMZE3trwP/GvQIaXG5lZu7/JYYCB1N8JvCIlWIPbch4kbmgriIMgRsqetM4XPmBAifdPhWMM7MPn1F2vVJ7Ro8vl1JwW45xKA7Ru0wDPKEuZKQMpmVONwmM4bbKHSx4BeKEoQZiM4v+JIN/h1AnA3IXRuLd15BA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=l0mTunX1; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Pqa+cs+P; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="l0mTunX1"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Pqa+cs+P" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 64CAgjXD3446216 for ; Tue, 12 May 2026 13:58:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= Iy7wYeD/e941NJ/F1ItwLJIww/GpkLrZlGMXR1RDBfc=; b=l0mTunX1SdL/ZcR3 z2E4hwalKWkqgMd8hqze3fETLkJDflpbKMC1SmVqfqYMt7hMQVTdJlJLTPJPSaBj To1Zu2n1KFCLIwvqaMQE4L0Xn2dClF5oGWg+KuzokVLKI2lVIodZ7asZaCheqIM9 FXrHPh5oXdBY4Cd5kV6/PivVen+eqJUp+qXELZjy6+o3Fetl7IHbGHg6K9TjldU4 GEwLwIoUq5y3fzeCBU6EJ424pXW3VejQ9rbEtQUBafZ6x7QKyVamH4l5C3uK8fTI wsM52CYQo18+bYCUSsRoyrWs9Z0xNOg9Q6tDwPgk8x3YWObkTaSZjFcZOxmRQW+I vyd5oA== Received: from mail-vk1-f198.google.com (mail-vk1-f198.google.com [209.85.221.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4e3nv0khup-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 12 May 2026 13:58:38 +0000 (GMT) Received: by mail-vk1-f198.google.com with SMTP id 71dfb90a1353d-56f8a5c02b4so489146e0c.2 for ; Tue, 12 May 2026 06:58:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1778594318; x=1779199118; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Iy7wYeD/e941NJ/F1ItwLJIww/GpkLrZlGMXR1RDBfc=; b=Pqa+cs+P9kXFRXV4qBov/G1F9NIPhdktdPzoGPA/QzCUeXz9PHl0TiO+5/aoyji9x4 DX077PlLqzxcpgc6w2NrIh9c7EsMC9zllyA0qI+uMoQG3ll/jgHpb0PFWleFTKijiUHT 7yuH+68lYvyDsexq1SzArEelV0zmub2uHHA/eQW6uwq904xfx5Q+9m2WNpWyG5UL0VXs ZZHqjzV+A7QFQ4oXJ+VX7agqoommArs5uG4gAdDjrgjcKnVqx2BNx62MBr/yIt1lbOt7 ubmYb5Z2UfOygGyEHfS1R3q/ZXdbe0YJKBM9MiwZZj2arzb8B5eJwQboXSGHy1SR78s5 tTbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778594318; x=1779199118; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Iy7wYeD/e941NJ/F1ItwLJIww/GpkLrZlGMXR1RDBfc=; b=fPKYpc/Rxgfnom3jpWQQ6nVz7gqeHDvJ1ApC9SQtw8HdNLAUUvgIncoW4yZ99tIkMc YEvlpMBQVzw5WggJ1WZ9v3tVZSQLsa0V28dyHPDGymhgKBqsAcbJUyOyniKnt82yyb2R 91eOKCtQqI00b3d+OeCwSoECTBnq0IajC+jAisyeUrx9fWpjJ2K8LnnPoKjEgv2Cz5Jl M5U+2/dfXIr2SmUcbKM+YeAkBbTSAYD+ZNVV60/2tOAKPyN5Mu/jAgYXRHlYeYajkJO8 k+5T2tz/YU+wtXV6LxrQx3NdN0AwySxid2IkvIRFcLIOr7cZ5XvLFlojRnY9DAUQQ1Kn KO2w== X-Forwarded-Encrypted: i=1; AFNElJ/UMN/4XvO/c0K24a//qYM7M3w4BsgRv2uX8EK5B7WkUuAvG+kdLTJ0Q/wm+cqpSlX0E0revVCx8Gjxe4o=@vger.kernel.org X-Gm-Message-State: AOJu0Ywckbt5eqzOpGtC/IvDMCEzQJ+UPDVTHt/hcK1zdmZL/A1N1BH+ PIy9ShIWowptXLcwPNDWPkSQInptv5zalI2UWGnivmypvDNE6gCFl3E9qFfbzK6uG+TluXhUho9 yuRFts3tHGipO/+L/teVsqChPWJk5UUFT9mIHaJKd5fJUsS2XHvOS3+GC4m+f9Gk7jrQ= X-Gm-Gg: Acq92OEoKE+jf7h2O1MvOijMjyldVSbo0X0mgMpaLykrZGwPe/mC1uFNYeeycHs+LrH nxYSIRwm3/WZwxVgho9y5II5+gw3f9b48JW7fkZp0ZiD5bRw+QRMyAKbIQFASqOhjitDNdyEHwz 6e0FnD5b9I0I0YEAT/w2ofEw+zB/+DPIZBW8Hh0syhkWmbxHI6LRlF/E3qTFT3ruNvpwTQFSUVw Jcgz5c0TdLXg9oa5ulzrS0WTvBni6rgnOgEeSDjZ4XrbqsnNzAKgAIShtPo8qzNsfRDRaFFZvgS JRXhpEL8FyMzFs/SP4KKTimx8DRU0rnCvQQTX9wGTYvjPVADBdNtTLbBK4KoUdKNr5A343a861A xf9aQTEg+287sOkNQHDwOY0e3vn+iS0bKY0GYjIH3WW3R3oK8ZM8xoqbG9qzuwQYNSGMAsUyU5t hhKGI= X-Received: by 2002:a05:6122:3a96:b0:575:1f1f:758d with SMTP id 71dfb90a1353d-5755b0ac2a9mr4561143e0c.0.1778594317869; Tue, 12 May 2026 06:58:37 -0700 (PDT) X-Received: by 2002:a05:6122:3a96:b0:575:1f1f:758d with SMTP id 71dfb90a1353d-5755b0ac2a9mr4561137e0c.0.1778594317407; Tue, 12 May 2026 06:58:37 -0700 (PDT) Received: from [192.168.119.254] (078088045245.garwolin.vectranet.pl. [78.88.45.245]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-bcfac35c47asm352195166b.1.2026.05.12.06.58.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 May 2026 06:58:36 -0700 (PDT) Message-ID: <253ad0dc-1fc3-4e6f-841b-c7e9fd7320c7@oss.qualcomm.com> Date: Tue, 12 May 2026 15:58:34 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 2/4] thunderbolt: Separate out common NHI bits To: Mika Westerberg Cc: Konrad Dybcio , Andreas Noever , Mika Westerberg , Yehezkel Bernat , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, usb4-upstream@oss.qualcomm.com, Raghavendra Thoorpu References: <20260428-topic-usb4_nonpcie_prepwork-v2-0-452fb9d63f77@oss.qualcomm.com> <20260428-topic-usb4_nonpcie_prepwork-v2-2-452fb9d63f77@oss.qualcomm.com> <20260504065402.GB6785@black.igk.intel.com> <7aab3f25-7609-499a-b701-8301719b9a82@oss.qualcomm.com> <20260512132008.GC84797@black.igk.intel.com> <80e0bd64-c99d-4dee-9417-3036f72658f2@oss.qualcomm.com> <20260512135433.GD84797@black.igk.intel.com> Content-Language: en-US From: Konrad Dybcio In-Reply-To: <20260512135433.GD84797@black.igk.intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Authority-Analysis: v=2.4 cv=V+xNF+ni c=1 sm=1 tr=0 ts=6a03320e cx=c_pps a=1Os3MKEOqt8YzSjcPV0cFA==:117 a=FpWmc02/iXfjRdCD7H54yg==:17 a=IkcTkHD0fZMA:10 a=NGcC8JguVDcA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=Um2Pa8k9VHT-vaBCBUpS:22 a=kj6NfxSqUhuuyZWD8T0A:9 a=QEXdDO2ut3YA:10 a=hhpmQAJR8DioWGSBphRh:22 X-Proofpoint-GUID: kMBJpSi6jIQHmSw1VlcojtTwJe5YliTJ X-Proofpoint-ORIG-GUID: kMBJpSi6jIQHmSw1VlcojtTwJe5YliTJ X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTEyMDE0NiBTYWx0ZWRfX0rCS94AEVvY/ TE1RcpPYe72EuBua8KtdPYHXLWNJ+7CoUdv9B/nurhn0iTFYRxMRyqFXwv3Nor+ctpdWA8PjHeH 6NCRcb/PJ+p8YzYAlxN7OgWaFaaEYkv+lohCgVbVpaS+sz0RlyhX0+wu13DVACvZGSTuL0Ckk6U MF3k1Xlb34Uloxbb+bVt2IVntTCYXnG1u6/1oYEPozPgn8tZ0H4cbGKCwrSPr5o3Rt5/FQBixIR fCvPte9CVZUyxIWdjKaefGM4Bg5TCd07aajWZk/B6XeOdA1DWnCUAcQm4ZcVl514cpT0ZShyyqp ygenz9J06Ez2gucMiSdEwTHkUFzYxa3GucBeFQy3m9XrL79NUId4CcPAw4li+OXt/SY1aHY9B3V P/wjZunpZV/d9IIzVNtTNDFHpmqlsKP8qvLU/UGNfA4kgYFi3cJabf4fuGSCJ7CquNBoa8gt6pB 5kNZbPDCoyrKveKgxMg== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-05-11_05,2026-05-08_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 spamscore=0 impostorscore=0 clxscore=1015 bulkscore=0 malwarescore=0 priorityscore=1501 adultscore=0 lowpriorityscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605050000 definitions=main-2605120146 On 5/12/26 3:54 PM, Mika Westerberg wrote: > On Tue, May 12, 2026 at 03:43:12PM +0200, Konrad Dybcio wrote: >> On 5/12/26 3:20 PM, Mika Westerberg wrote: >>> On Tue, May 12, 2026 at 03:06:58PM +0200, Konrad Dybcio wrote: >>>> On 5/4/26 8:54 AM, Mika Westerberg wrote: >>>>> Hi, >> >> [...] >> >>>>>> +/* >>>>>> + * During suspend the Thunderbolt controller is reset and all PCIe >>>>>> + * tunnels are lost. The NHI driver will try to reestablish all tunnels >>>>>> + * during resume. This adds device links between the tunneled PCIe >>>>>> + * downstream ports and the NHI so that the device core will make sure >>>>>> + * NHI is resumed first before the rest. >>>>>> + */ >>>>>> +bool tb_apple_add_links(struct tb_nhi *nhi) >>>>> >>>>> Okay you moved it here good. I think we can call it in nhi_pci_probe() >>>>> directly so no need to expose outside. >>>> >>>> Yeah that seems like a good idea. It's already there, behind N calls >>>> in the software CM case. >>>> >>>> Do we have to check the CM type though, or do you think it'd be fine >>>> to just call it unconditionally? (either because there are presumably >>>> no Apple machines with ICM or because these devlinks would be harmless?) >>> >>> I think you can call it unconditionally. It only does something for TB1-2 >>> Apple systems. >>> >>> For Apple TB3 we used to start ICM firmware but this was changed as the >>> driver learned SW CM. However, we never setup any device links so this >>> would not change anything. >> >> OK. I'm keeping tb_acpi_add_link() as-is, since that's both bus- and >> arch-independent. >> >> However, doing just something like: >> >> diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c >> index cb5d028de3bc..f5ddc8ddb8bb 100644 >> --- a/drivers/thunderbolt/tb.c >> +++ b/drivers/thunderbolt/tb.c >> @@ -3327,7 +3327,7 @@ struct tb *tb_probe(struct tb_nhi *nhi) >> * before the PCIe/USB stack is resumed so complain here if we >> * found them missing. >> */ >> - if (!tb_apple_add_links(nhi) && !tb_acpi_add_links(nhi)) >> + if (!tb_acpi_add_links(nhi)) >> tb_warn(tb, "device links to tunneled native ports are missing!\n"); >> >> >> diff --git a/drivers/thunderbolt/pci.c b/drivers/thunderbolt/pci.c >> index ca50e3584cac..e0abd1d503c5 100644 >> --- a/drivers/thunderbolt/pci.c >> +++ b/drivers/thunderbolt/pci.c >> @@ -294,6 +294,8 @@ static int nhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) >> >> pci_set_master(pdev); >> >> + tb_apple_add_links(nhi) >> + >> return nhi_probe(&nhi_pci->nhi); >> } >> >> >> Will cause the warning to show up. And adding something like >> `nhi->device_links_done` is a little ugly.. Ideas? > > Ah in Qualcomm case? We are going to add tb_of_add_links() as well, right (or > something along thoese lines)? Then tb.c does: > > if (!tb_acpi_add_links(nhi) && !tb_of_add_links(nhi)) > tb_warn(tb, "device links to tunneled native ports are missing!\n"); > > In the meantime it is okay to have that warn because we really do want to > have those links in place :) No no, I meant that with the diff above, tb_apple_add_links() failing would not lead to any warning messages, and it would always hit the warning in tb.c (because these two are now checked independently) Konrad