Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp5786899rwb; Tue, 9 Aug 2022 04:13:43 -0700 (PDT) X-Google-Smtp-Source: AA6agR5JLGM+wcp9+As+S1+WcqYoPcfiT92RwhJSMgUghuVkbcxzcm5EiUI2KgeOXzaPbt5TwKu9 X-Received: by 2002:a05:6402:3907:b0:431:6776:64e7 with SMTP id fe7-20020a056402390700b00431677664e7mr21128394edb.0.1660043623007; Tue, 09 Aug 2022 04:13:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660043623; cv=none; d=google.com; s=arc-20160816; b=SCu5hOmxdMxT8VglWsSuZm9MlQZxIvVR9XcvB4sEiU1xd4iSwA8ggfVaAZCuDijt+C JG3nuwUuTPIli+AVx6LDWagx2sym+LuMAdze1r4Q8ENu96C+btW6sAt6cKMsk7itKLtg +uvDU1bbOW7AKTlA8IuT3USVzgJqLe39pMQFdS/i4WcxcDZAMjLrlsI5bdAEyxeOpsUW vK2Z+Dtaq973KiuFX742ww4Oog9rNvWD/hSJ3UCju+b1ofWE0v2uT9smt2HMDDYn4c1r mJ/nytvkv53ub1v7i1b+j3CNrDX5/uSuhLENs0iVGNLJ0TpqJv70se+OBk8V/m2lzuDR pO8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=wqaaQdZiPnvXjS5kmSznLk7LwW4miaOBU233ObHkdbA=; b=vhfnRG6ZM3SmPTrsFZRR3D0/sTH6ZLU9RKFITLvGgN0kZfcGHsd0LADpxCA8i/XC28 Z2HVXHKqc77HRof8QxTZeS1hh/Ske1ivj6uIHMvZmEepevAX+DBoMzTFOFeqMXg0oqgX c5Krr/AeeLkmkBAPRLzENUvUd72hNcmuOr3ElnjVb7GsvqJ3rdWw8cqvyj6AZ1DmJJz+ UCT3th7PHR0Q8bd0czzE/fBILZWl3uHtexjgL3FtxoEk/jdbCZk6Q4FvBxVw6t2FpqsH Q6JGtSAVYEUdrZT5aHniKPzYIVhMeynY3HJppNpPrC4KcuvYFgnPIsIYTAoRUX51zjK0 Fzaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@fnarfbargle.com header.s=mail header.b=L8gu2OdQ; 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=fail (p=NONE sp=NONE dis=NONE) header.from=fnarfbargle.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q15-20020a056402518f00b0043d127622b2si10085271edd.157.2022.08.09.04.13.17; Tue, 09 Aug 2022 04:13:42 -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=fail header.i=@fnarfbargle.com header.s=mail header.b=L8gu2OdQ; 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=fail (p=NONE sp=NONE dis=NONE) header.from=fnarfbargle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235629AbiHILD2 (ORCPT + 99 others); Tue, 9 Aug 2022 07:03:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230178AbiHILD0 (ORCPT ); Tue, 9 Aug 2022 07:03:26 -0400 Received: from ns3.fnarfbargle.com (ns3.fnarfbargle.com [103.4.19.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62E741115E for ; Tue, 9 Aug 2022 04:03:25 -0700 (PDT) Received: from [10.8.0.1] (helo=srv.home) by ns3.fnarfbargle.com with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oLN18-0004OF-JB; Tue, 09 Aug 2022 21:03:22 +1000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=fnarfbargle.com; s=mail; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=wqaaQdZiPnvXjS5kmSznLk7LwW4miaOBU233ObHkdbA=; b=L8gu2OdQtF2ijl2U3HlW12VUVb neVqD7z7ecltnZ+1SLaL8x5/+EPcbcKbth+Kkx5hgFrVVAQzcNIRjeX9D+bYkfzV9l4x2TeRerZup mxP1r+gGUGMrnTkrl05tFcvTygHEo2OYjG9FeEwc6CeGHuuZ/YvWei0Bc6Z/X62F4bQQ=; Message-ID: <685b7a6a-d122-b79a-93e7-4227eaa4e4e9@fnarfbargle.com> Date: Tue, 9 Aug 2022 19:03:14 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: Apple Thunderbolt Display chaining Content-Language: en-US To: Mika Westerberg Cc: linux-kernel@vger.kernel.org References: <87c1a001-ef79-6390-dfe2-06d2850f6e84@fnarfbargle.com> <42e81a8e-e393-7a69-7339-a020ebb57935@fnarfbargle.com> <5474e599-057a-ec0f-b469-560644155907@fnarfbargle.com> From: Brad Campbell In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_PASS,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 G'day Mika, On 9/8/22 18:55, Mika Westerberg wrote: > 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)? > It did work flawlessly in MacOS, but as the GPU turned up its toes I can't really test it anymore. The Mac EFI did odd things with the Thunderbolt tunnels, and due to the dying GPU I couldn't warm boot it in Linux anyway. Every reboot had to be a power cycle or it'd hang in the EFI. Regards, Brad