Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1847386lqp; Mon, 15 Apr 2024 22:04:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVs+o1//tOXrFByofSTAHZLua/wD8Rug/VVnubmAPr5ONA6ClPCZWewZ3fP+pWThNr0rL/LcSm6CJlUYgg6ZTuCFcKkT6U3iBjqp3XGJw== X-Google-Smtp-Source: AGHT+IECgwcKm0urgOAeAICCNi1JU/HYSeuvfnV9TUJHu+PsN0uVvOw05AcXliOI6+Py3G4HiBlM X-Received: by 2002:ae9:e601:0:b0:78d:73f1:6d2b with SMTP id z1-20020ae9e601000000b0078d73f16d2bmr12419630qkf.65.1713243846743; Mon, 15 Apr 2024 22:04:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713243846; cv=pass; d=google.com; s=arc-20160816; b=b7Ie19EAsgaijfccPpELeKVcl1tN+wL2X9vmq4mulLSlLeGDHFBL/vkkfxwIKEjoUV i7gm5k3DlPLVE4xEmXHCmjvuY17Oa/Ympt4cB2UHK046Seu5jv5RtQEZvjscVYASBZUb K1/82zrw0m7ajA+tUO8rjebIuNNhFpeFH4XmTPpGw+q/ziwGxS3uAboCgifrJkZCqV0U kNGpcB3Mo0waOK6Nu1Dr8xpAFGBfIrtTWlnkJxHmtEZZknLP5lfEBb5bDKwCaGqbXI4x fyiPlp61HLTFwh02bqRcfIaxqXg+yh1gFxcaGNHlSwuGLi4syFjPGPInEYaG1OxOITVJ SQ9w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=j4bB/QGRUPPEQiJQ3XomXrOneih/S+fhYvcOi/slhwo=; fh=gEvps4Vnq4TF5tK17+CivwL+YmHc43GM4b6kdSr7Dlw=; b=jF3BfZM8LaUw+J8Qz8su6kzqWAdXSGK2Titr1FBlTy9cTTxJE36t5aRKrpuC9Xmr+X DlArILl4L+kx3LqhGOUW5ycbuQW+UXrj4SxJeTCT7aZBjQ4zcHXQZzNCovPFEq/nECwL o0iSEqCV5iRFsfG2lZJwG+FAIUtacdrI8w00AMV3NLKw9xdCCSlW0uOaxxnHHlClY2xb wjNbOmliKFBepRfLzM8JjeDDOKbqmyC3bkGwjfqx0MVkEY+Hp/vNY8MF0rt/30saOnMD D4RaGyBlYOokq5b/oQ31apM2GSeX7AUE/ypHN9Rx4D+LRPIFpyAF20DFigJQdVX5kCOk sGmg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="nk/jTxL2"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-146248-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146248-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id m8-20020a05620a24c800b0078ecdb3c832si9652619qkn.781.2024.04.15.22.04.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 22:04:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-146248-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="nk/jTxL2"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-146248-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-146248-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 7AA451C216CE for ; Tue, 16 Apr 2024 05:04:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0EDB839ADD; Tue, 16 Apr 2024 05:04:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="nk/jTxL2" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9865E381C4; Tue, 16 Apr 2024 05:03:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713243839; cv=none; b=tzsKNCfbnaehl+Ke8tN0C4jiqCLIl+WG8BUXG9YwZfHCm+XdwEPhuYgmxrXckuNCDcTrI1Z2OpHEqLK0ojo7RJ8N+lSYRZp1ArMoON7WhbVxvAGIQ+shQr67Hr8HGTbVmRsBVRh3K9aizO5+T86OLOTjtCREoC803+XYoY3Dvbc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713243839; c=relaxed/simple; bh=BmAO5cfNjGRgDXrBQ5fdgxvu5LWToVi7vPs5S0LNEhs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=p3iRgzLIAbJExCrHf7mOy9lHAOXuiEciNfK+T3w4YAL9AwKoga/Pj/FSfdiKSDtav1El9eBEvKcm9Zlsm95VnZRARuc7Huhq71Fj+huJXS+B8X8O2s8SJEQiPx7goW2ECr6NPZJOG2oO0+FjFpIopFuUG7OqQgo937NykNGBhC4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=nk/jTxL2; arc=none smtp.client-ip=192.198.163.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713243838; x=1744779838; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=BmAO5cfNjGRgDXrBQ5fdgxvu5LWToVi7vPs5S0LNEhs=; b=nk/jTxL20dJoxoTLm+ti3tVNADo0s5kdSmxxnKPMM/mGrzrnrgLbBNer rvo1tEJXyyPq527u4MJNWcImERvR33UvGihghDIAflAOhoCqYjw6bRKD5 6xy3Q0JcsKTignhz2By9YGSc7nO2a+Va+oIk2LtpRuio6/NMkUHVcRbdv PAvWx7FpOHR2i0NZ5HKvukRZnPZb4kqNr2s1JQcHwPhgsYXK2NMnQjyLD Wp/cmuCxGKsMnpePmMnbe+pz72btxSF87rZBCdSvLskIgj6duwAaoC4ni lwjEPwDEXcghJ8iGSNHw9vfC7N8F6JJ+pcao95D19aNzqAo1JF+n7O7rJ g==; X-CSE-ConnectionGUID: +98Uazk+Tzq3K1YUQCWEjw== X-CSE-MsgGUID: WcGLKVplT8masosNATRfyQ== X-IronPort-AV: E=McAfee;i="6600,9927,11045"; a="8522672" X-IronPort-AV: E=Sophos;i="6.07,205,1708416000"; d="scan'208";a="8522672" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Apr 2024 22:03:57 -0700 X-CSE-ConnectionGUID: 0pv7ImchTRa3QmIWDC+K6w== X-CSE-MsgGUID: kBzoafTDS/i/5W0wywmRFg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,205,1708416000"; d="scan'208";a="53094970" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa002.jf.intel.com with ESMTP; 15 Apr 2024 22:03:55 -0700 Received: by black.fi.intel.com (Postfix, from userid 1001) id 2D40FE1; Tue, 16 Apr 2024 08:03:53 +0300 (EEST) Date: Tue, 16 Apr 2024 08:03:53 +0300 From: Mika Westerberg To: Esther Shimanovich Cc: Mario Limonciello , Dmitry Torokhov , Lukas Wunner , Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Rajat Jain Subject: Re: [PATCH v4] PCI: Relabel JHL6540 on Lenovo X1 Carbon 7,8 Message-ID: <20240416050353.GI112498@black.fi.intel.com> References: <20240118060002.GV2543524@black.fi.intel.com> <23ee70d5-d6c0-4dff-aeac-08cc48b11c54@amd.com> <20240119053756.GC2543524@black.fi.intel.com> <20240119074829.GD2543524@black.fi.intel.com> <20240119102258.GE2543524@black.fi.intel.com> <03926c6c-43dc-4ec4-b5a0-eae57c17f507@amd.com> <20240123061820.GL2543524@black.fi.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Hi, On Mon, Apr 15, 2024 at 06:34:00PM -0400, Esther Shimanovich wrote: > Hey! > Asking for some help on implementation. > So I implemented most of this, and successfully tested the quirk on 6 > different devices with various types of discrete fixed JHL Thunderbolt > chips. > > However I want to add an additional check. A device wouldn't need this > quirk if it already has Thunderbolt functionality built in within its > Root Port. There is really no "Thunderbolt functionality built in within its Root Port". More accurate is that the Thunderbolt/USB4 controller is integrated into the CPU and the PCIe tunnels go out through the CPU PCIe Root Ports. > I tried to use "is_thunderbolt" as an identifier for that type of > device--- but when I tested on a device with a thunderbolt root port, > "is_thunderbolt" was false for all the Thunderbolt PCI components > listed below. You should not use is_thunderbolt for anything else than with the legacy Apple systems. > ~ # lspci -nn | grep Thunderbolt > 00:07.0 PCI bridge [0604]: Intel Corporation Tiger Lake-LP Thunderbolt > 4 PCI Express Root Port #1 [8086:9a25] (rev 01) > 00:07.2 PCI bridge [0604]: Intel Corporation Tiger Lake-LP Thunderbolt > 4 PCI Express Root Port #2 [8086:9a27] (rev 01) > 00:0d.0 USB controller [0c03]: Intel Corporation Tiger Lake-LP > Thunderbolt 4 USB Controller [8086:9a13] (rev 01) > 00:0d.2 USB controller [0c03]: Intel Corporation Tiger Lake-LP > Thunderbolt 4 NHI #0 [8086:9a1b] (rev 01) > 00:0d.3 USB controller [0c03]: Intel Corporation Tiger Lake-LP > Thunderbolt 4 NHI #1 [8086:9a1d] (rev 01) Okay this is integrated Thunderbolt/USB4 controller. > The device I tested was the Lenovo carbon X1 Gen 9. When > set_pcie_thunderbolt is run, the devices listed above return false on > the pci_find_next_ext_capability check. > > I have spent some time trying to see if there are any ACPI values or > any alternative indicators to reliably know if a root port has > thunderbolt capabilities. I do see that ADBG is often set to TBT but > that looks like a debugging tool in ACPI. > > I also looked through lspci -vvv and compared the output with a device > that has no Thunderbolt built into its CPU, which gave me nothing. For integrated and most recent systems (that's with the software connection manager) the tunneled PCIe ports (Root or Downstream) can be identified by looking at "usb4-host-interface" ACPI _DSD property. In addition to this there is the "External Facing Port" ACPI _DSD property attached to them too. Maybe these help? With the firmware connection manager there is only the "External Facing Port" _DSD though. The Microsoft documentation for this that we also use in Linux is here: https://learn.microsoft.com/en-us/windows-hardware/drivers/pci/dsd-for-pcie-root-ports