Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1791687ybe; Tue, 3 Sep 2019 03:37:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqyJocavvgK2usOWWqJE+xGVbHAxz2/aExk3NHJsTKstAXfr7t7tcyn0yalvHmfqXOzMoi7F X-Received: by 2002:a62:1ad3:: with SMTP id a202mr8052512pfa.75.1567507049833; Tue, 03 Sep 2019 03:37:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567507049; cv=none; d=google.com; s=arc-20160816; b=nXbFcC3EAVvHzY7/jnEe6bUAgyYTE9mgmq1E4aIbLkcgQ0mtw/qT3k+6fI6S1c7oUf XrTx8Pf3YKrP8obvQFl1Djmg18E9krt1tyodT0qnx/HIZEm9tf6MLcf+S3au/sQKBlJ+ KiMPyDjqTp/vfHLblJlxlbCzxPwQJrKNQ5KQf0fW7H0sQy8v5EnqQPQrHZhynqUbLPjy gsb4xzC2ZdcM/gQMO9j/pVAiPDTKZbB6giREGDDYqpv7ayEWW6DHUqLy91IjHWj7yDLO 3tG4ODI0Asayj8jZLJI70vRFfQp6d8AmnXbbvv1zerZ5eoUDjsHlbwjX/aZ1zIDKLfKn DNEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=g1CdAODgn4Ktn6dOFJKQMZdqswe4+h6F6BYz125rubE=; b=YK1t/Bli13hbfqdDOze18+GtgvQwr+fvDYvSv/BkgOUm19+iZRVoAkaGEKJ/7LT1tJ 9Q+GkJQv4uD+SzlePsNXRj1seqoKaiseg13Y+YrcTBHxbIPeNeYF0qXs17RSACYumuYv Sl6fehTki6pl/QXwkHOCWiBqypw+Lg8+NYAjgjCMJEA+GrXzniSSMNLXfHt08urfWh25 DelnNJ+YgkPvn6hyQPSurZAdvxjn/N0WbnXBSDZX+CNO38v7uwqXeDIig8DVhq1YW2yx FW/3XCm9maHcPG3SatUIe+QbbEjoq917khDb3jGb2Lf+0mWPBLmxku0bi12ZpRfsT/dQ XU3g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r193si13390919pfr.27.2019.09.03.03.37.13; Tue, 03 Sep 2019 03:37:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728837AbfICKgK (ORCPT + 99 others); Tue, 3 Sep 2019 06:36:10 -0400 Received: from mga18.intel.com ([134.134.136.126]:15213 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726631AbfICKgH (ORCPT ); Tue, 3 Sep 2019 06:36:07 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Sep 2019 03:36:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,462,1559545200"; d="scan'208";a="198743003" Received: from lahna.fi.intel.com (HELO lahna) ([10.237.72.157]) by fmsmga001.fm.intel.com with SMTP; 03 Sep 2019 03:36:04 -0700 Received: by lahna (sSMTP sendmail emulation); Tue, 03 Sep 2019 13:36:03 +0300 Date: Tue, 3 Sep 2019 13:36:03 +0300 From: Mika Westerberg To: Brad Campbell Cc: linux-kernel@vger.kernel.org, michael.jamet@intel.com, YehezkelShB@gmail.com Subject: Re: Thunderbolt DP oddity on v5.2.9 on iMac 12,2 Message-ID: <20190903103603.GD2691@lahna.fi.intel.com> References: <472bee84-d62b-bfcb-eb83-db881165756b@fnarfbargle.com> <20190828073302.GO3177@lahna.fi.intel.com> <7c9474d2-d948-4d1d-6f7b-94335b8b1f15@fnarfbargle.com> <20190828102342.GT3177@lahna.fi.intel.com> <20190828131943.GZ3177@lahna.fi.intel.com> <20190903101325.GC2691@lahna.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190903101325.GC2691@lahna.fi.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 03, 2019 at 01:13:28PM +0300, Mika Westerberg wrote: > Hi Brad, > > On Thu, Aug 29, 2019 at 12:27:08AM +0800, Brad Campbell wrote: > > It wouldn't surprise me if the firmware was doing something funky. It was > > one of the first Thunderbolt equipped models and the support docs explicitly > > say only one Thunderbolt display in Windows and two in later versions of > > OSX. It almost needs a quirk to say "firmware does something we don't like, > > reset the controller and re-discover from scratch". > > > > Anyway, I'm not in any hurry. It doesn't get rebooted often and it's not in > > any way preventing me using the machine. In fact, upgrading the third head > > from an old 24" 1920x1200 to the second Thunderbolt display has been > > invaluable. > > Can you apply the below patch and then boot with two monitors connected? > Then send me the dmesg. It does not fix anything but should log a bit > more. > > diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c > index 1f7a9e1cc09c..28a72336558a 100644 > --- a/drivers/thunderbolt/tb.c > +++ b/drivers/thunderbolt/tb.c > @@ -313,8 +313,10 @@ static struct tb_port *tb_find_unused_port(struct tb_switch *sw, > continue; > if (!sw->ports[i].cap_adap) > continue; > - if (tb_port_is_enabled(&sw->ports[i])) > + if (tb_port_is_enabled(&sw->ports[i])) { > + tb_port_dbg(&sw->ports[i], "this already enabled\n"); > continue; > + } > return &sw->ports[i]; > } > return NULL; > @@ -365,16 +367,25 @@ static int tb_tunnel_dp(struct tb *tb, struct tb_port *out) > struct tb_tunnel *tunnel; > struct tb_port *in; > > - if (tb_port_is_enabled(out)) > + tb_port_dbg(out, "trying to tunnel DP\n"); > + > + if (tb_port_is_enabled(out)) { > + tb_port_dbg(out, "DP OUT port already enabled\n"); > return 0; > + } > + > + tb_port_dbg(out, "finding free DP IN port\n"); > > do { > sw = tb_to_switch(sw->dev.parent); > if (!sw) > return 0; > + tb_sw_dbg(sw, "finding available DP IN\n"); > in = tb_find_unused_port(sw, TB_TYPE_DP_HDMI_IN); > } while (!in); > > + tb_port_dbg(in, "found DP IN\n"); > + > tunnel = tb_tunnel_alloc_dp(tb, in, out); > if (!tunnel) { > tb_port_dbg(out, "DP tunnel allocation failed\n"); > diff --git a/drivers/thunderbolt/tunnel.c b/drivers/thunderbolt/tunnel.c > index 5a99234826e7..93c2c965bdde 100644 > --- a/drivers/thunderbolt/tunnel.c > +++ b/drivers/thunderbolt/tunnel.c > @@ -351,9 +351,23 @@ struct tb_tunnel *tb_tunnel_discover_dp(struct tb *tb, struct tb_port *in) > struct tb_tunnel *tunnel; > struct tb_port *port; > struct tb_path *path; > + u32 data[2]; > + int ret; > + > + tb_port_dbg(in, "start DP discover\n"); > > - if (!tb_dp_port_is_enabled(in)) > + if (!tb_dp_port_is_enabled(in)) { > + tb_port_dbg(in, "DP port enabled\n"); I did typo here so while you try apply the patch, please change this one to say "DP port not enabled" instead.