Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp5796453rwb; Tue, 9 Aug 2022 04:24:17 -0700 (PDT) X-Google-Smtp-Source: AA6agR4hG5Uxaksnvv/owdjnnzf8Q0bk338qkvAWrmKzb1eSqh1NLvdqkh300xqUXd/Q0ursvota X-Received: by 2002:a63:65c2:0:b0:419:8146:b1a7 with SMTP id z185-20020a6365c2000000b004198146b1a7mr19254484pgb.210.1660044256961; Tue, 09 Aug 2022 04:24:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660044256; cv=none; d=google.com; s=arc-20160816; b=AcInyodhGeMpaNFRgMRsR6MxIpURTaFUqDut4oq66fuyeLTg4l5pSO+wzYZjRju1SM oJvLP2tAiwxHdRi8EPmzAHgJ1RxB5Tnex2Gxvw0IZSMOpzPArs8GKgwyoD5FejwWxR/K ZKyBvAmn4ZKSjWXzfO94uHQOLL4jLa7z4Z/SKpixdxUlC5trgZOl+y3D5rYrsr2hpLT5 ZuQKX1iIP2FTV9+1Zh0L72h47cn87/7KnA/vG8pCNT/LmGR4MYBPkunHZK9LIJVBjp8k hIFDqBhjoZaFNfCcE5DisNQQ2Q02mHzJzakOxW55N8b5ykERz0daMbpzYoxeQVT2P/tG B1GQ== 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=WlLq9zNf+/w0pDccCfgV5z6XQu9ozxnf9kz/Kc2tcYI=; b=iFQdvHl0pqnTnsRZYaEsv6rksSGlj2FTQmmmkKGC+0nXswEACsQvZ6ejXg+HPZz85y 0BmF/2Nq0xycLO8q/L5SF2Ujpf3X0hoixwBjBBU3d9VcdC9BqriRlQask6jHCyemsMIG H3Liolsfz0VhsJhtULjHUcI3xYmLl034Euu0yqJnJhhtGq2ZSGQvY4jy9n+Y7bnjFelF Pgvf44K8uhEi2JTyq7QVWbQ5WWh1+ZV43oVaBigQ1zpmpuDnN+bhs4/CGzlkL3jOVAS2 mCmj3xrl3PlG3dkVxfZ9X8rIqVpCNsiPO3Z9NaHfVWH+g53THcglFvVXZ4BFZfgY6ml6 je6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Iae9b6d9; 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 c6-20020a655a86000000b0041c89ac3658si14068375pgt.822.2022.08.09.04.24.02; Tue, 09 Aug 2022 04:24:16 -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=Iae9b6d9; 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 S240542AbiHIKzN (ORCPT + 99 others); Tue, 9 Aug 2022 06:55:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236832AbiHIKzK (ORCPT ); Tue, 9 Aug 2022 06:55:10 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA19326F4 for ; Tue, 9 Aug 2022 03:55:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660042509; x=1691578509; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=nThm70cbh3yuihLopwrO/iHlRv4329SKFx3NKXGE0C4=; b=Iae9b6d9j35BDJ43JBJ/aUGD5UhSsIalPeGDxHO1TsoTRLv37CgiJy3V m9xu9zzu5hgd+PtXtEjfR3AWrBqkyTrR9V173EcTb5wbSsJhIcWz9GLym YfC18Mn4aLlWyFenumt0Wt9dJNk19oao/6qyLY2426cf7jSXEavPueTLE U5cYhwYzR60F3rAjvwevk0o3YVz86m4Ir1VeGjOgNhjaZebHWZPZxkqD1 47cMiXyHg+PWRgZEeUof9yroLR1HzkluawAnidfCqB2vSxJ6QwcdGBbVk vgDWQtiqV2LcFo03W9XFKO9AtqLsvvqMZrphCLUZbnJj/jmUdsAi3KKUs A==; X-IronPort-AV: E=McAfee;i="6400,9594,10433"; a="316735507" X-IronPort-AV: E=Sophos;i="5.93,224,1654585200"; d="scan'208";a="316735507" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Aug 2022 03:55:09 -0700 X-IronPort-AV: E=Sophos;i="5.93,224,1654585200"; d="scan'208";a="850428746" Received: from lahna.fi.intel.com (HELO lahna) ([10.237.72.162]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Aug 2022 03:55:07 -0700 Received: by lahna (sSMTP sendmail emulation); Tue, 09 Aug 2022 13:55:05 +0300 Date: Tue, 9 Aug 2022 13:55:05 +0300 From: Mika Westerberg To: Brad Campbell Cc: linux-kernel@vger.kernel.org Subject: Re: Apple Thunderbolt Display chaining Message-ID: References: <87c1a001-ef79-6390-dfe2-06d2850f6e84@fnarfbargle.com> <42e81a8e-e393-7a69-7339-a020ebb57935@fnarfbargle.com> <5474e599-057a-ec0f-b469-560644155907@fnarfbargle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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, On Tue, Aug 09, 2022 at 06:40:54PM +0800, Brad Campbell wrote: > G'day Mika, > > > On 9/8/22 18:23, Mika Westerberg wrote: > > Hi, > > > > On Mon, Aug 08, 2022 at 09:27:24PM +0800, Brad Campbell wrote: > >> If I don't authorize the PCIe tunnels and just leave the DP enabled it > >> works fine also. > > > > But you say that it fails on boot when the driver discovers the tunnels, > > right? So there is really nothing to authorize (they should be already > > "authorized" by the boot firmware). > > > > If I understand correctly this is how it reproduces (the simplest): > > > > 1. Connect a single Apple TB1 display to the system > > 2. Boot it up > > 3. Wait a while and it hangs > > > > If this is the case, then the driver certainly is not creating any > > PCIe tunnels itself unless there is a bug somewhere. > > > > An additional question, does it reproduce with either TB1 display > > connected or just with specific TB1 display? > > > > No, I've not been clear enough, I'm sorry. I've re-read what I've written below and > I'm still not sure I'm clear enough. > > The firmware never sets anything up. > > When I cold boot the machine (from power on), the thunderbolt displays and tunnels > remain dark until linux initializes the thunderbolt driver the first time. > > If I compile the thunderbolt driver into the kernel, or let the initramfs load it > the displays come up, all PCIe tunnels are established and everything works. > > When I reboot the machine (reset button or warm boot), the firmware continues to > do nothing and all the tunnels remain in place. The machine dies when the thunderbolt > driver is loaded for a second time. > > That might be a reset/warm boot with it compiled in or loaded from iniramfs. > It may also be me loading it from the command line after booting with it as a > module and blacklisted. > > The problem comes about when the thunderbolt module is loaded while the PCIe tunnels > are already established. > > To reproduce in the easiest manner I compile the thunderbolt driver as a module and > blacklist it. This prevents it from auto-loading. > > I cold boot the machine, let it boot completely then modprobe thunderbolt and authorize > the tunnels. I then warm boot which lets the kernel detect and init the DP displays > and detect/configure all the PCIe devices. The thunderbolt driver is not loaded. > > The machine comes up, all tunnels are established and all devices work. > > If I then modprobe the thunderbolt driver, things break. > > This is the hack in my boot script : > > # Spark up thunderbolt > if [ -z "`grep notb /proc/cmdline`" -a -z "`lsusb | grep '05ac:9227'`" ] ; then > modprobe thunderbolt > sleep 1 > echo 1 > /sys/bus/thunderbolt/devices/0-3/authorized > echo 1 > /sys/bus/thunderbolt/devices/0-303/authorized > reboot > fi Thanks for the clarification! How about on macOS side, does it work (I would expect yes)?