Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1972863rwb; Sat, 24 Sep 2022 00:12:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM686oUu7d1N9bJBgqnvKz4y2JZG4BKMQrDb2GWhi5qN2FLeFMAQ10bt31HYQU2z0JtgNvT/ X-Received: by 2002:a17:90b:3c6:b0:202:c01b:feb4 with SMTP id go6-20020a17090b03c600b00202c01bfeb4mr14218328pjb.28.1664003527730; Sat, 24 Sep 2022 00:12:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664003527; cv=none; d=google.com; s=arc-20160816; b=rE+PN2Bn8z25zXeeeUpWyl4+gSD8VLSqYfedK8jkARQYoKayJpJ1ERXEIlM+VwhGph SRmvndawQNAPZtTGOT0WMbm/wdWQUvM5N7jCybyAXAmm4DQfzVEcB2ia2KoWpBTSwdgF X7rqyHT+YwbS2F9h5xaa7frSl3f4lqjnm2S6BFTsXxR/q0N7uvKnQmulMbeXi/6Lok3d q1HxTSO4dm8IJlzbzDfj8sYxEKOkF03o7AflQH1zIkiFBJ0NqEdWzTn0jyti+AM3zI3d 2s7HpGoxZ//9b0Emrob+CAyeBSTGmp0rssuC/tU9MUH0tp3uilQeQIpemuW3zpoi1eL6 t8fA== 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=uZLrvgehZypdm1o9iVMXCBojYw5RCRUuxy6H2NZ44GM=; b=MnuSA4TKNEl9MkqdS+JoACtP+q5BDVGbQ7/9vg3avNIgs+a2ax19Wyq7ncLjXeVjTf USnDJ0iXVE6uJXAkY+ZXMrAzuH/IYY8E3Yxjkg1nTMSexHhMS8TRRY47I0WHYwPohmQj V8BhPYW+7eNPVFDDcp+N8ZSYiPmDkYguDMcOKum/gck9ziPYCl2PsvrSDNXDKFQ2otyo u5Spq7lmS4CUyTTnUrR1XDh0N+6ZmFllqUPTpjrZQT0iKz3j5VfhGrz0eIHxjnfRm0Oj o8+KywQPlPnCl83DTYBEkgilXwviTdIqCHGmHck9QUD8XpxZ6pevTe5znUzQb/q6whkR uutQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nu6Qpp3W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p36-20020a634f64000000b0043512d6488fsi10593846pgl.614.2022.09.24.00.11.54; Sat, 24 Sep 2022 00:12:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nu6Qpp3W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233215AbiIXGqx (ORCPT + 99 others); Sat, 24 Sep 2022 02:46:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229573AbiIXGqt (ORCPT ); Sat, 24 Sep 2022 02:46:49 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C30B25FE9; Fri, 23 Sep 2022 23:46:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664002008; x=1695538008; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=9xhmRG95Oai0Gh6KQQh9QF7sHwJ15jrKdlIwr7wHUek=; b=nu6Qpp3WxFDXHq199aS7hdslYPd09GcSRdptyZumqiAPXqkehsh10PaL NykJ3GBu316DyXtXumEIQBXLFiAB3R8QIyWZ99HCIilpwoXFxhppmfXaW ARbMH4POT+qBO3VlanLYPCjUmtB6UwTYza3eXlyCma3r2dDR+cDoMWeSI CPNEcI2b2wZxqruZvEEr2eqLKYHN2TlNXufUFGtOrglcOpkhG7W9f2EhW Ompon42Mj/940jsNIjYAwAzeJtyeeqsgLjM44KzFIFUy+Kat1Ru78o7ev ZXoGn2VnLM34xf7QYJzotGQ5Ql1IDXMRqXFI3aJaagaF/2qiKTaUbTO8U Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10479"; a="302206542" X-IronPort-AV: E=Sophos;i="5.93,341,1654585200"; d="scan'208";a="302206542" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2022 23:46:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,341,1654585200"; d="scan'208";a="622767116" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 23 Sep 2022 23:46:45 -0700 Received: by black.fi.intel.com (Postfix, from userid 1001) id A9FE9F7; Sat, 24 Sep 2022 09:47:03 +0300 (EEST) Date: Sat, 24 Sep 2022 09:47:03 +0300 From: Mika Westerberg To: Mario Limonciello Cc: Andreas Noever , Michael Jamet , Yehezkel Bernat , Mehta Sanju , stable@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] thunderbolt: Explicitly enable lane adapter hotplug events at startup Message-ID: References: <20220923183944.10746-1-mario.limonciello@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220923183944.10746-1-mario.limonciello@amd.com> X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mario, On Fri, Sep 23, 2022 at 01:39:44PM -0500, Mario Limonciello wrote: > Software that has run before the USB4 CM in Linux runs may have disabled > hotplug events for a given lane adapter. > > Other CMs such as that one distributed with Windows 11 will enable hotplug > events. Do the same thing in the Linux CM which fixes hotplug events on > "AMD Pink Sardine". > > Cc: stable@vger.kernel.org > Signed-off-by: Mario Limonciello > --- > v2->v3: > * Guard with tb_switch_is_icm to avoid risk to Intel FW CM case > v1->v2: > * s/usb4_enable_hotplug/usb4_port_hotplug_enable/ > * Clarify intended users in documentation comment > * Only call for lane adapters > * Add stable tag > > Note: v2 it was suggested to move this to tb_switch_configure, but > port->config is not yet read at that time. This should be the right > time to call it, so this version of the patch just guards against the > code running on Intel's controllers that have a FW CM. Can we put it in a separate function that is called from tb_switch_add()? I explained in the previous reply (to v2) that the tb_init_port() is pretty much just reading stuff and therefore I would not like to add there anything that does writing. While at it, the USB4 v2 spec (not yet public but can be found from the working group site) adds a CM requirement that forbids writing lane 1 adapter configuration registers so in addition to that please check port->cap_usb4 there so we know we deal with the lane 0 adapter only (as ->cap_usb4 is only set for the lane 0 adapters). So something like this: static void tb_switch_port_hotplug_enable(struct tb_switch *sw) { if (tb_switch_is_icm(sw)) return; tb_switch_for_each_port(sw, port) { if (!port->cap_usb4) continue; // here enable the hotplug } } int tb_switch_add(struct tb_switch *sw) { ... // init ports and stuff happens here tb_switch_default_link_ports(sw); tb_switch_port_hotplug_enable(sw); } (we should probably create a new macro tb_switch_for_each_usb4_port() that just enumerates all USB4 ports).