From patchwork Tue Oct 31 13:34:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 741229 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 C30C033D2 for ; Tue, 31 Oct 2023 13:35:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="U4a4O+Zq" Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2088.outbound.protection.outlook.com [40.107.237.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80DB1DE; Tue, 31 Oct 2023 06:35:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WlCaGa6SLv+ul3Bsrjh2DqA2AMxpWm7SUMYyh43eKjKPPPYeXK6AFYpssBEJf3fWy+EzgXmLUi+jaVkOilAo2FnB3dnYyJz+IYXWCswk14ljbXJ1TCQppEOyefbwSb/ET7v+tKHRdyVavrcgsBWQhDbJHy1yAmyK1O7eGMSJr/CPMJyc8NRI3YKfpdAewKpnsH6CBsIp5JdjaWqzoYYek4w9PWAdYm7JeMRbjpqXnvflgc3TD23okHAdmNvo4ivho7TFotwaPk4+YXrr6JrqN6mHxe94Vm8Bs86xTuQhJzYxNr3NE0m/rP5zjmxrDsuSC6Z4bntvOvHDvH7Pn//1FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tJCfI9albUrQlYmxaZRBNCVnPrUm6j8urzsOUYlkD6A=; b=TJ6UQylMJRX2v4S1D/SxQpFJv3BVeN+Q/1UasUxmhNZKeAXJF4vOPafKeT30RmM3pm9vzQqCDbTphCaW1A6qnDBeEBZnyFoIFr3vkoE6sR3P4g/fbF/ff7EOkiyPblUd1d1sKfop4GCh7+XRMqEyINRL68l/b/nfq/qMpRH+VA4nIQ319VHBOUS8MuBmrGS+2fBnnoeLErNAn4yIpB+NWsx7r7V+EZuHeLy9wzFLZpEVt2t0FK1i/dnp8w/a1pYzDM1V3ucjKQLlkqa5sh0mjOMMdqcx1BGpvZaQFBEmKNKHwWH+5S2svhzhiidyItJ0DQtZoiiJmMswgD59h018Xw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=google.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tJCfI9albUrQlYmxaZRBNCVnPrUm6j8urzsOUYlkD6A=; b=U4a4O+Zq65orEqW1yZraKHqU6OtTFTebMidVDX93tqUUs8DMlvwE9GbvuHouCWKXhUQ1z98K0iNtVrVGqHWF7oMBVSXfz3CfV0PSi0oYC+xuMCHs6eEdVJmAmN+oHhRV4IiMws+XU9vl4Pan6X1tOnjvDwgz6JlrM2FvhUcuTsc= Received: from DM6PR07CA0107.namprd07.prod.outlook.com (2603:10b6:5:330::21) by SN7PR12MB8026.namprd12.prod.outlook.com (2603:10b6:806:34b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.28; Tue, 31 Oct 2023 13:35:00 +0000 Received: from CY4PEPF0000E9D8.namprd05.prod.outlook.com (2603:10b6:5:330:cafe::b8) by DM6PR07CA0107.outlook.office365.com (2603:10b6:5:330::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.29 via Frontend Transport; Tue, 31 Oct 2023 13:35:00 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000E9D8.mail.protection.outlook.com (10.167.241.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6954.19 via Frontend Transport; Tue, 31 Oct 2023 13:34:59 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Tue, 31 Oct 2023 08:34:58 -0500 From: Mario Limonciello To: , CC: , , , , , , , Mario Limonciello Subject: [PATCH 1/2] PCI: Move the `PCI_CLASS_SERIAL_USB_USB4` definition to common header Date: Tue, 31 Oct 2023 08:34:37 -0500 Message-ID: <20231031133438.5299-1-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D8:EE_|SN7PR12MB8026:EE_ X-MS-Office365-Filtering-Correlation-Id: 4c3ab4ce-e009-4636-5502-08dbda162e1d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QMlAJ4kMljvANEx5t9Zvt3dCSgGYlsTcI+Q/n8qVEhe9mmW4/Vmfphe1bXuHS8nmrTnluAQ9gj4n/AbfPk6HnDYHKg4Sd7kruxnsvK2LrjZPBy+3zwD9WFe/+EoBjehSS5df8pQQOOzWGZNoOXhUGh/BM0gnReKWMEzwTIpcdxTpsHaF/yeV56qFZoDQm0nLlo9gh8IpZR26ZLEZCsE3TIY3xNHQg/Rnb6iqyWgkOUJnoWXXQwP4rVHFoBEfahf5K9JfYmEEYJGPbe0FscGuI27eLIv45a6AtTx1hd/Jb2ttLQ/lnmEY9belQdurR8v42BJPapeZ6/BYQ5cwG4RTabTbFBmefFr3QXa8l3ncKPKd3wGqvBxgYBk8v9/02BaaOQ6ipikTXpWwbiWfyIKaLqHCeB3rm1g0GtLAxt8VsTZDBQAMQLv7MNfDEW5fSIP4+5pNpEBC+m9LvW1My7/1qetzObihNrDiecIyiG6gl2r09ZQUyWnWURd12qWPG5Qki/h0jWMsDNzOSobg0Deg4BnQaMHyk5npOCLj6fwxt2vPsmaCQzxvK7rcpfY98Jy8EUUlZKes/SFOfOh9vjuTx3ROWhDjVp5/daRYXtH9yJ6c+t3MdrRrSvekhAsSygVrdCMmYMA4nnA7bjZnBqIyN2TlD9hsvVkOgVzMlCzu++mBGnFhuZDqXp6ZsSZLIj3exzVnEWzGAIQJslQTsPsaFmVIKijh1S+sw88c0ivMX3q+4YuZM9nhOS3f7RRZFzKQJXgjKi4lIQcOynO/bL02009VnXQ9GtHf/TvLX5tyclY= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(136003)(396003)(346002)(39860400002)(376002)(230922051799003)(186009)(82310400011)(64100799003)(451199024)(1800799009)(36840700001)(40470700004)(46966006)(40460700003)(2616005)(1076003)(26005)(16526019)(7696005)(478600001)(6666004)(36860700001)(47076005)(336012)(426003)(83380400001)(5660300002)(2906002)(41300700001)(44832011)(110136005)(70206006)(70586007)(8676002)(8936002)(4326008)(316002)(54906003)(82740400003)(356005)(81166007)(86362001)(36756003)(40480700001)(81973001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2023 13:34:59.9929 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4c3ab4ce-e009-4636-5502-08dbda162e1d X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9D8.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB8026 `PCI_CLASS_SERIAL_USB_USB4` may be used by code outside of thunderbolt. Move the declaration into the common pci_ids.h header. Acked-by: Mika Westerberberg Signed-off-by: Mario Limonciello --- drivers/thunderbolt/nhi.h | 2 -- include/linux/pci_ids.h | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/thunderbolt/nhi.h b/drivers/thunderbolt/nhi.h index 0f029ce75882..675ddefe283c 100644 --- a/drivers/thunderbolt/nhi.h +++ b/drivers/thunderbolt/nhi.h @@ -91,6 +91,4 @@ extern const struct tb_nhi_ops icl_nhi_ops; #define PCI_DEVICE_ID_INTEL_RPL_NHI0 0xa73e #define PCI_DEVICE_ID_INTEL_RPL_NHI1 0xa76d -#define PCI_CLASS_SERIAL_USB_USB4 0x0c0340 - #endif diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 5fb3d4c393a9..29aeac53dc41 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -121,6 +121,7 @@ #define PCI_CLASS_SERIAL_USB_OHCI 0x0c0310 #define PCI_CLASS_SERIAL_USB_EHCI 0x0c0320 #define PCI_CLASS_SERIAL_USB_XHCI 0x0c0330 +#define PCI_CLASS_SERIAL_USB_USB4 0x0c0340 #define PCI_CLASS_SERIAL_USB_DEVICE 0x0c03fe #define PCI_CLASS_SERIAL_FIBER 0x0c04 #define PCI_CLASS_SERIAL_SMBUS 0x0c05 From patchwork Tue Oct 31 13:34:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 739999 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 DB1CBD287 for ; Tue, 31 Oct 2023 13:35:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="NzS8g0GW" Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2064.outbound.protection.outlook.com [40.107.102.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2ADFBE6; Tue, 31 Oct 2023 06:35:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cTsySws2OJ3bMQjr0ad65pX68U7bdzVE8MptyyzeYnQmZGPzLB1zUF3QdfQAhArAPM3RRqPWo9Mvm71KRlXz4m41aRvMgOXFXNzd8NFcaknC137qnWLCtIR83Sh1KTREc+lD53myRtEfaN2QHdvc/gB7FUMoE0SvLylIojvvwacLLuqoq27lPqmCUXsNsujY9m9+Z2JcWVAzfT2LcLj5tXN67Aaj0BOWRdpkvlePooy5tGF8A5ftcMqkcG09mVjYDSYtvXokxXPdQtibPhsWOLpkBFqOgNBOq+GF+P/FwUwx74oP4ve11aspet1OLdiD8VQ118ZZqHIfvPAFC15jHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vbgtSTY1GCwLhGQB/wIgn0aNJUxw+ac+GvxL1xpS73g=; b=i3Uyib7P0n1sPnFjZiWDBiUyg5BaFJenFjFqO+S6TSoZRyEHGmqPPaofzy0gMbl2ksjd8BnIrp6/tRgHqhUMLd0yCV5C0PJgCICMz+ZWLQlFldJtXiNF9Hfut8+G3NEdbQsbu6zS/IyeNQ893yXd+ct+Z7pmdDRKvQCQcAGQ1lAOiyusfEE+lf4L1DSVDYsn8h4F1eMkSrLYsiSUz4RtZySS/x9DaZduLSvcbD9kk4L7MDe0PVC4wnQEhXCY73em3RNtkjWALD841jZN4gdGWXDfcshBnT5QB2yshVh1r/VCHdtUEPyquyjJKW1pdLfBPeND7SzJY8kRsgrTIRaT9A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=google.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vbgtSTY1GCwLhGQB/wIgn0aNJUxw+ac+GvxL1xpS73g=; b=NzS8g0GWTfF8Cmy7r9PRT7S/GEyZNGzkDqYn9fH2wYYI4hnnoH01V5xP1o0Dzf6/Qtuu5dJrpCU110lxj/nlUPRzdyOPx5zCMANn/Vjy/XkgZ0MYXs8/1IIlQCo+H9Zms4wet/e3ttP9lF3xEaDv5et08yYKoHEa+mGEOqH9L3A= Received: from DM6PR07CA0110.namprd07.prod.outlook.com (2603:10b6:5:330::26) by MN0PR12MB6294.namprd12.prod.outlook.com (2603:10b6:208:3c1::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.28; Tue, 31 Oct 2023 13:35:00 +0000 Received: from CY4PEPF0000E9D8.namprd05.prod.outlook.com (2603:10b6:5:330:cafe::97) by DM6PR07CA0110.outlook.office365.com (2603:10b6:5:330::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.19 via Frontend Transport; Tue, 31 Oct 2023 13:35:00 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000E9D8.mail.protection.outlook.com (10.167.241.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6954.19 via Frontend Transport; Tue, 31 Oct 2023 13:35:00 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Tue, 31 Oct 2023 08:34:59 -0500 From: Mario Limonciello To: , CC: , , , , , , , Mario Limonciello Subject: [PATCH 2/2] PCI: Ignore PCIe ports used for tunneling in pcie_bandwidth_available() Date: Tue, 31 Oct 2023 08:34:38 -0500 Message-ID: <20231031133438.5299-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231031133438.5299-1-mario.limonciello@amd.com> References: <20231031133438.5299-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D8:EE_|MN0PR12MB6294:EE_ X-MS-Office365-Filtering-Correlation-Id: 497cd936-cdd8-4f57-da61-08dbda162e83 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CHgyu0F9x330QltXnYPrHvfXR7OLvWqgYha2lGg5M5tuxDd0o7KD6HqWdu1N/owFlg0sdwvBmmE4LyNOP6FY9H9kDhKGww6FakVzKuASVluHXSc/xNntuaG0S9TxG+wpDQZiUk6Qcf0E/F/jRhs2m+Mavs9DJXTjzVnepfPQIIsQgT0esq/Mkjl7un5ZVurCqXp5zZ1MAycVUvTFrwIjuqMRD6E6X/sFxlYaccL/BcXOs2MaAnBSjn/8lbGH2D7aQ1m8M0FYTlDPQNs8cYbZj5VauDY3ZpENaTGZ+gI87LNPg2YHjgd5qfYiSkHqBUfm9BKXEAdQOqF/sOugbEtkcMQgeKK9rxBJU81WpW7SNh63qeBSTKE378yyouvfSCZ+AVRDOVxk1ncUJvAn6VGL6WX98pluWWrm0GI/vQ+D0JEJTg7RXPHI5c/jCXEWZRVrT+thYtihOZOo4fStKS2ycukYq21HWLAzzc6S+4DhqSiehCdnPMFAIgstPoRSgfkwirw6ZONcE8Thl4T9hEHLa4POF6xu+VFneEfHSLmD63KeB6eyMiCWQw03wDBGcDZ5FMqnIiz1X9L9d+jXLzNn3xuTeMsgxPPuutEuYbGfdd2G2GhwU+xD8pJuSyYKo1xaid9k1j5xbMWlH3SYVcYgL5edfpuVmA2QH+Us4uUxlqNgMCk21lGcdddZuwnUEChalUM4mGfaKwDU1CHqw8fBOEpA/QGEvhCZoq/m+IW0xYAOMi+30pIpbVVoprTx2zFEtAnpnVI71YsVLUGLNbh0cmJvkZlb6td90KyjSYfapvA= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(136003)(39860400002)(396003)(376002)(346002)(230922051799003)(451199024)(82310400011)(186009)(64100799003)(1800799009)(36840700001)(46966006)(40470700004)(40460700003)(1076003)(16526019)(26005)(6666004)(7696005)(478600001)(66574015)(47076005)(36860700001)(336012)(426003)(83380400001)(5660300002)(2906002)(4326008)(8936002)(70586007)(44832011)(110136005)(41300700001)(70206006)(966005)(8676002)(316002)(54906003)(356005)(81166007)(2616005)(82740400003)(86362001)(40480700001)(36756003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2023 13:35:00.6648 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 497cd936-cdd8-4f57-da61-08dbda162e83 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9D8.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6294 The USB4 spec specifies that PCIe ports that are used for tunneling PCIe traffic over USB4 fabric will be hardcoded to advertise 2.5GT/s. In reality these ports speed is controlled by the fabric implementation. Downstream drivers such as amdgpu which utilize pcie_bandwidth_available() to program the device will always find the PCIe ports used for tunneling as a limiting factor and may make incorrect decisions. To prevent problems in downstream drivers check explicitly for ports being used for PCIe tunneling and skip them when looking for bandwidth limitations. 2 types of devices are detected: 1) PCIe root port used for PCIe tunneling 2) Intel Thunderbolt 3 bridge Downstream drivers could make this change on their own but then they wouldn't be able to detect other potential speed bottlenecks. Link: https://lore.kernel.org/linux-pci/7ad4b2ce-4ee4-429d-b5db-3dfc360f4c3e@amd.com/ Link: https://www.usb.org/document-library/usb4r-specification-v20 USB4 V2 with Errata and ECN through June 2023 - CLEAN p710 Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2925 Signed-off-by: Mario Limonciello --- drivers/pci/pci.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 59c01d68c6d5..4a7dc9c2b8f4 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -6223,6 +6223,40 @@ int pcie_set_mps(struct pci_dev *dev, int mps) } EXPORT_SYMBOL(pcie_set_mps); +/** + * pcie_is_tunneling_port - Check if a PCI device is used for TBT3/USB4 tunneling + * @dev: PCI device to check + * + * Returns true if the device is used for PCIe tunneling, false otherwise. + */ +static bool +pcie_is_tunneling_port(struct pci_dev *pdev) +{ + struct device_link *link; + struct pci_dev *supplier; + + /* Intel TBT3 bridge */ + if (pdev->is_thunderbolt) + return true; + + if (!pci_is_pcie(pdev)) + return false; + + if (pci_pcie_type(pdev) != PCI_EXP_TYPE_ROOT_PORT) + return false; + + /* PCIe root port used for tunneling linked to USB4 router */ + list_for_each_entry(link, &pdev->dev.links.suppliers, c_node) { + supplier = to_pci_dev(link->supplier); + if (!supplier) + continue; + if (supplier->class == PCI_CLASS_SERIAL_USB_USB4) + return true; + } + + return false; +} + /** * pcie_bandwidth_available - determine minimum link settings of a PCIe * device and its bandwidth limitation @@ -6236,6 +6270,8 @@ EXPORT_SYMBOL(pcie_set_mps); * limiting_dev, speed, and width pointers are supplied) information about * that point. The bandwidth returned is in Mb/s, i.e., megabits/second of * raw bandwidth. + * + * This function excludes root ports and bridges used for USB4 and TBT3 tunneling. */ u32 pcie_bandwidth_available(struct pci_dev *dev, struct pci_dev **limiting_dev, enum pci_bus_speed *speed, @@ -6254,6 +6290,10 @@ u32 pcie_bandwidth_available(struct pci_dev *dev, struct pci_dev **limiting_dev, bw = 0; while (dev) { + /* skip root ports and bridges used for tunneling */ + if (pcie_is_tunneling_port(dev)) + goto skip; + pcie_capability_read_word(dev, PCI_EXP_LNKSTA, &lnksta); next_speed = pcie_link_speed[lnksta & PCI_EXP_LNKSTA_CLS]; @@ -6274,6 +6314,7 @@ u32 pcie_bandwidth_available(struct pci_dev *dev, struct pci_dev **limiting_dev, *width = next_width; } +skip: dev = pci_upstream_bridge(dev); }