Received: by 2002:a05:7412:a9a3:b0:f9:327e:43ab with SMTP id o35csp93616rdh; Mon, 18 Dec 2023 05:27:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IEzT0cqNP/uFAH31w8jnW6vbpdnQys7d+xbpRMX7Bi+1oP4oCvqcdtTr1S6wof6o8OSP+Bq X-Received: by 2002:a0c:f981:0:b0:67a:a721:cb1a with SMTP id t1-20020a0cf981000000b0067aa721cb1amr17570169qvn.123.1702906069397; Mon, 18 Dec 2023 05:27:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702906069; cv=none; d=google.com; s=arc-20160816; b=wI+HMB11oWF76fhp43iXu2VCOTP9yttNxuCB67eZvPZR73E1uozcDjsgJ+Sr9BQXX/ gttDtipS0LNAciDV5uVE5xwSQOvCa/jjChN8iIJih/dILyaJvVVipNQ/NUkJQta0qQxt VsDFXDno0uBhbMhD7VUwgPtS8KXbzMX2NFTvjOU0r0WJbDyuNi6xf6zy0u+elbg99d6F WZA+2mMIujagq81JTYAarVf54MtVbxf4x6sp+z3ZgrOVTOGkzPTKcyOt5WDvoHuSMgkp Gi485GCoOK1kXoE9DxMSLGu29wG5UWz3t8yCe3fy9jt3lOcLQsP05SJCtKQnEXhjBeLj j7lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=fnS9Dv250cW0ak49bdWGXt5VSpQKt0znY0wws3RPgQ8=; fh=ofKj83/p/ZyZjEy4Cu0MWVt3rz9nUofCes9r4zzROyo=; b=ZuagprRug+oZA3IWO2HjYg3DzAZV3kPnzQv1LhRYK6JTj7fvl92dYD1y+WO+Z7KGOJ WkJ1TnyWjJvOUKTQotdu6DmOqPmHSGR5D9QmFNzIRV6/FVtGvFkCOaxCZfrnrG0xjZz2 KEdLJ8pGNLY+TOz0Y+v0QTL9e8A9VAfg8nsifuhYki5HXDKW+9TDRBKsZZjGxyvYNFLX qNxyswDVYOenAOMMj2OkdNpuY+URvSLPYidkt6bhhspSv73gRd48gHGNTt0HJX7e+ao/ uDxduBO8Jt5cd8wn9DMYfxc3vOjoG7ttZdD+TLBZ+mQGV9yZCZt2i0weFZ+/jeYXRgmP USfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BpLOR7b7; spf=pass (google.com: domain of linux-kernel+bounces-3743-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3743-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d14-20020a0cf0ce000000b0067abd18c974si4937316qvl.325.2023.12.18.05.27.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 05:27:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-3743-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BpLOR7b7; spf=pass (google.com: domain of linux-kernel+bounces-3743-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3743-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2ADCD1C24B42 for ; Mon, 18 Dec 2023 13:27:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7F5615D721; Mon, 18 Dec 2023 13:18:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="BpLOR7b7" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) (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 26280129EF6; Mon, 18 Dec 2023 13:18:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702905524; x=1734441524; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=/u5LGqruIqYB+yzW0Punt2bLuFOnz4Aw9zIFhQKw/x8=; b=BpLOR7b7798PuglGU6RLncb8RBz+didVEYza7WU/+/zC/9jY8rKzkxfJ i7MmqKpBKPtkOGiLwZDuXhjPyFjlM0x3PrqWeKP/fmgZl1tqGZdKfwmvE yc+GdLYOdYMpmnSsNEANnb4tEYJnro2Fy8QiUm29ATdiATu1ckbEzD1qT TjeZrOjCX516NnwChWbK6VIFbAN6/Tz9/ev2IzqmdHrJOYYlrORJi5ix7 MeejvEhx7B8TSCJ+O8ecGnWJB9p6Bh1uvvUAOfs9Zz/QxRUOjh5xruNmA TT+RDRbeVSvJ+TyjIdVj7HZrPPpkzj1nur24nQwbe8/k9Q/dWYDTKWpSf A==; X-IronPort-AV: E=McAfee;i="6600,9927,10927"; a="394379613" X-IronPort-AV: E=Sophos;i="6.04,285,1695711600"; d="scan'208";a="394379613" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Dec 2023 05:18:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10927"; a="779092371" X-IronPort-AV: E=Sophos;i="6.04,285,1695711600"; d="scan'208";a="779092371" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 18 Dec 2023 05:18:41 -0800 Received: by black.fi.intel.com (Postfix, from userid 1001) id 4696B387; Mon, 18 Dec 2023 15:18:40 +0200 (EET) Date: Mon, 18 Dec 2023 15:18:40 +0200 From: Mika Westerberg To: Sanath S Cc: Sanath S , mario.limonciello@amd.com, andreas.noever@gmail.com, michael.jamet@intel.com, YehezkelShB@gmail.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [Patch v2 2/2] thunderbolt: Teardown tunnels and reset downstream ports created by boot firmware Message-ID: <20231218131840.GH1074920@black.fi.intel.com> References: <20231215115521.GW1074920@black.fi.intel.com> <20231215140224.GX1074920@black.fi.intel.com> <866cb714-b9a8-a7d4-4c59-6ba771ef325f@amd.com> <20231218104234.GB1074920@black.fi.intel.com> <20231218113151.GC1074920@black.fi.intel.com> <20231218122312.GE1074920@black.fi.intel.com> <997f2a94-66d9-fb95-8f75-46d61937f7e8@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <997f2a94-66d9-fb95-8f75-46d61937f7e8@amd.com> On Mon, Dec 18, 2023 at 06:35:13PM +0530, Sanath S wrote: > > On 12/18/2023 5:53 PM, Mika Westerberg wrote: > > On Mon, Dec 18, 2023 at 01:31:51PM +0200, Mika Westerberg wrote: > > > On Mon, Dec 18, 2023 at 04:49:13PM +0530, Sanath S wrote: > > > > > The discover part should not do anything (like write the hardware) so > > > > > perhaps it is just some timing thing (but that's weird too). > > > > > > > > > > I think we should do something like this: > > > > > > > > > > 1. Disable all enabled protocol adapters (reset them to defaults). > > > > > 2. Clear all protocol adapter paths. > > > > > 3. Issue DPR over all enabled USB4 ports. > > > > > > > > > > BTW, what you mean "didn't work"? > > > > Path activation would go fine after DPR like below: > > > > > > > > [   15.090905] thunderbolt 0000:c4:00.5: 0:5 <-> 2:9 (PCI): activating > > > > [   15.090932] thunderbolt 0000:c4:00.5: activating PCIe Down path from 0:5 > > > > to 2:9 > > > > [   15.091602] thunderbolt 0000:c4:00.5: activating PCIe Up path from 2:9 to > > > > 0:5 > > > > > > > > But, PCIE enumeration doesn't happen (pcie link up will not happen, will not > > > > see below logs) > > > > [   15.134223] pcieport 0000:00:03.1: pciehp: Slot(0-1): Card present > > > > [   15.134243] pcieport 0000:00:03.1: pciehp: Slot(0-1): Link Up > > > Okay, what if you like reset the PCIe adapter config spaces back to the > > > defaults? Just as an experiment. > > If this turns out to be really complex then I guess it is better to do > > it like you did originally using discovery but at least it would be nice > > to see what the end result of this experiment looks like :) > > Yes, I'll give a try. > As an experiment, I tried to compare the path deactivation that occurs at > two place. > 1. In tb_switch_reset where we are calling tb_path_deactivate_hop(port, i). > 2. While we get a unplug event after doing DPR. > > I observed both have different hop_index and port numbers. > So, are we calling tb_path_deactivate_hop with wrong hop ids ? Wrong adapters possibly. > From deactivate tunnel (called while unplug) : > [    3.408268] thunderbolt 0000:c4:00.5: deactivating PCIe Down path from > 2:9 to 0:5 > [    3.408282] deactivate hop port = 9 hop_index=8 > [    3.408328] deactivate hop port = 2 hop_index=10 Definitely should be port = 5 (that's PCIe down in your log) and hop_index = 8 (that's the one used with PCIe). > Deactivate from tb_switch_reset() : > deactivate hop port = 5 hop_index=8 Can you add some more logging and provide me the dmesg or alternativively investigate it yourself. You can use tb_port_dbg() to get the port numbers to the log.