Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5124926rdb; Tue, 12 Dec 2023 22:18:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IH9bKb2YB6/Ndr2em5gxSz343Y/PC/jTv6a7aE5/NKJRX6/U88+bpPcXSUGmvrVtg/3RlHU X-Received: by 2002:a05:6e02:15c5:b0:35d:59a2:bd2 with SMTP id q5-20020a056e0215c500b0035d59a20bd2mr6641285ilu.104.1702448309784; Tue, 12 Dec 2023 22:18:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702448309; cv=none; d=google.com; s=arc-20160816; b=lINFImDimGKKfj7A9WiaJo6AheSHHhfuCIPAC/8k5k0zIZsTNyI/1OM0SWwdfpfL4Q Z+z/+J5/+Mlb+Zv0Ze6l5Oyl7wXcRcrPXZffhRDbq9VFPCMLTfdkh1mfG8p1d+W2gaKv rvwREjIyfLk6mq5yDnMeEcgWdTLkFpMkHmPb3NhF4cV20vrHWnWSAUqvIgnS0MiawwVx pHRGfmVBX/+zVnA+eN1TJ9vROx3d1U/7wzTRkLyyrssvyYtQjuEOm1+gYj6iODjY5yjV XnZmXv0tGMTbwv1skdsl9HoR4Fvjy1lbCj1D/S+0U+9Wx6RY5PzPVhYCmWbs5W9OOWNk JGUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=jyL4l85SzU8nyEZnjsv8Fg6pH1xE2RUE3DWHVT3v5zE=; fh=JVYJ431iTAgXtLeSxtg6aSQZvqV2ivz+awLcZ3Jv578=; b=AFjepuPXuIe3jQpbWvoSYr6CIeAXZyJtnddce7BD2SKNntSshUxjUaq1wNSoZ1WQwK baocQHa9u53ir2jOwoEurGCBz3DxtEygyE0muKI/1w/hV2oHzQcRnabFWgBHswJi9szB /ef2+tMBgkKbxicDnxfuwQjrzBN8RYj/N/5xs6B4li7H6u8QLxYhCqDTV3g9BGhnBdUF lt0aKA+5WPWDRn/zjyPrsMlLKiUfmTLqHTBvBgETafeaXXLjNi0tZwYHRoCnP4A5LOO7 xkQeQp5GJbNBodOf1Hy2oVZuDemhTpo5FtnIMTBhlvw5IaqBx8lcmLf7Pc4cewHtetRS bqjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kkRIXM6T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id k16-20020aa788d0000000b006ce38c8412esi8906443pff.151.2023.12.12.22.18.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 22:18:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kkRIXM6T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 48C8E808E64A; Tue, 12 Dec 2023 22:18:27 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378551AbjLMGSF (ORCPT + 99 others); Wed, 13 Dec 2023 01:18:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233139AbjLMGSE (ORCPT ); Wed, 13 Dec 2023 01:18:04 -0500 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C950EAD; Tue, 12 Dec 2023 22:18:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702448290; x=1733984290; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=+wG0n5eRdc2tViq1iHhn5Dd5cJsoQhhtB8vAzTofY04=; b=kkRIXM6TwrqqhvPK2E7hZ9ulpvLHt/yI7CexHybxIRk6lLIJR28IGs1+ xUgapZjfCjIrO4JIydAA7UiefP54TX5p/Ns3n6fU3ea2md1PD1f3f1QDa vihTXFRVMvsuPXWE1ShNP/k7e0BA/hBctGhgtoSZ2r9Hn7fvyOzAHqn25 lPrAJsJxbn1YHkhz+EUMBIM0JpITW6XM66JIrdLnVVFKnr+ZebTxxLzp8 2UzWHSCrmkmeh4PzmQd6elzQEhHHo5F/2RzP+NTh281sId2UZxrOg5OTy NsW84AjGUXVx9GgcMqJJcDFxgJyHZ7z7X2AotXLPD7zn/bIYcxebJ9um3 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10922"; a="1761898" X-IronPort-AV: E=Sophos;i="6.04,272,1695711600"; d="scan'208";a="1761898" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Dec 2023 22:18:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10922"; a="864500802" X-IronPort-AV: E=Sophos;i="6.04,272,1695711600"; d="scan'208";a="864500802" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 12 Dec 2023 22:18:07 -0800 Received: by black.fi.intel.com (Postfix, from userid 1001) id 21D7B1A7; Wed, 13 Dec 2023 08:18:05 +0200 (EET) Date: Wed, 13 Dec 2023 08:18:05 +0200 From: Mika Westerberg To: Sanath S Cc: 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: <20231213061805.GK1074920@black.fi.intel.com> References: <20231212191635.2022520-1-Sanath.S@amd.com> <20231212191635.2022520-3-Sanath.S@amd.com> <20231213054914.GI1074920@black.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20231213054914.GI1074920@black.fi.intel.com> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 12 Dec 2023 22:18:27 -0800 (PST) On Wed, Dec 13, 2023 at 07:49:14AM +0200, Mika Westerberg wrote: > On Wed, Dec 13, 2023 at 12:46:35AM +0530, Sanath S wrote: > > Boot firmware might have created tunnels of its own. Since we cannot > > be sure they are usable for us. Tear them down and reset the ports > > to handle it as a new hotplug for USB3 routers. > > > > Suggested-by: Mario Limonciello > > Signed-off-by: Sanath S > > --- > > drivers/thunderbolt/tb.c | 11 +++++++++++ > > 1 file changed, 11 insertions(+) > > > > diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c > > index fd49f86e0353..febd0b6972e3 100644 > > --- a/drivers/thunderbolt/tb.c > > +++ b/drivers/thunderbolt/tb.c > > @@ -2598,6 +2598,17 @@ static int tb_start(struct tb *tb) > > tb_switch_tmu_enable(tb->root_switch); > > /* Full scan to discover devices added before the driver was loaded. */ > > tb_scan_switch(tb->root_switch); > > + /* > > + * Boot firmware might have created tunnels of its own. Since we cannot > > + * be sure they are usable for us, Tear them down and reset the ports > > + * to handle it as new hotplug for USB4 routers. > > + */ > > + if (tb_switch_is_usb4(tb->root_switch)) { > > + tb_switch_discover_tunnels(tb->root_switch, > > + &tcm->tunnel_list, false); > > Why this is needed? > > It should be enough, to do simply something like this: > > if (tb_switch_is_usb4(tb->root_switch)) > tb_switch_reset(tb->root_switch); Actually this needs to be done only for USB4 v1 routers since we already reset USB4 v2 hosts so something like: /* * Reset USB4 v1 host router to get rid of possible tunnels the * boot firmware created. This makes sure all the tunnels are * created by us and thus have known configuration. * * For USB4 v2 and beyond we do this in nhi_reset() using the * host router reset interface. */ if (usb4_switch_version(tb->root_switch) == 1) tb_switch_reset(tb->root_switch); (possibly add similar comment to the nhi_reset() to refer this one).