Message ID | 20231103190758.82911-6-mario.limonciello@amd.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp1257342vqu; Fri, 3 Nov 2023 12:08:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG1It6qpHsZeDWAEfth3W37KYDRhLSahbylUw+1xbZXtcwdAht0Gy5iMR1+hLxcIwkAOeXZ X-Received: by 2002:a05:6870:1055:b0:1f0:3259:3ebd with SMTP id 21-20020a056870105500b001f032593ebdmr7933560oaj.59.1699038536461; Fri, 03 Nov 2023 12:08:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1699038536; cv=pass; d=google.com; s=arc-20160816; b=SwoLq93EONIfNpMMWqVkI3SEbHocnz0LW6xyOBxIKHidXLtwzClFojsbSr1RfYfZNg u0IOxO3FLEm0B1aOHoyFm0xQ+rBl82NBq38NzjI9p5vibnSqCCywoTR9PxOFuO7c+m9Y AKXkxby7pd6+j2SkPOdl+zXtgzIKHvhkozlffoQz27ouApJfgIRpAC1/cSFvPJbx+MtL fZBBncUQFA1VKj2ovybAtyL3K3UACXDPbYR5uXMn/PmFTy1oP/1/TsRHzAbcjFKV53V1 ++RathtAfFZTvv6UWsme4NRtdqBNJRiFduuwy08N1nrd9oXwOMY8YQVkVxAVHWXT5U+i 3whA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Ps4geaA9O+7Z5oQTUTJFk+RelvfDLvJD1iyBwAM5sOo=; fh=KNFJdtEo/PKi7O8w97tvcvT8B0Dxi/sdm3S+AQ96c5Q=; b=Z9Tk3JvVlxta60PDsElQvc4uwUR70wjtfQRlG0VbjXkzfQFb23r2tF8mWNvAeL4xxo UM6H72exMSLUoQ5KhK5UVyivKT8fCdV1+8xf35DnvEgjqkgLHPHNGAJZO6HbkjZw4TMa wkzpZlMTKOjtKUFD53Xb+vnJMhm3VNQgw6XKMMR1eRrploiqT2wdSSr81uvpde80OEZs cFfwmUMpVfP/2LpmjHjJ/dvR3NaewDXeftH8UzY+OSBYABE6ZWSOLEuKEIt0J8lj1/B6 NeGUR7NQTg3Aa0FRttAlTL1GH8oIMa6qOpP6YfGrWV8ScT1M4amoQcNWKS/xxxpEwzWQ Ejag== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=0cI8K+bw; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id z26-20020a65611a000000b00578a2da998asi1979649pgu.304.2023.11.03.12.08.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 12:08:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=0cI8K+bw; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 79E1E82D7C67; Fri, 3 Nov 2023 12:08:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377077AbjKCTIp (ORCPT <rfc822;heyuhang3455@gmail.com> + 35 others); Fri, 3 Nov 2023 15:08:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376368AbjKCTIk (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 3 Nov 2023 15:08:40 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2061.outbound.protection.outlook.com [40.107.93.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A94D1D4D; Fri, 3 Nov 2023 12:08:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Oi4hq2/b6APpqzUn40GArlM7REEGevCeCmRz1sI4UPJ9oK3W1ZH8pat8NcwNw+kB/tIcJppZSqwEWRf3q2OC3jDFH0kSEFVvpYXMgH12Vr3xlt2/sVgO9b0H4h5HS82jh0NQEieBxQL8MWhkY386Fx0R4z+knf9hXfDDlovT/aroKUNlVJ/kD5N4ViGGI1qfgCCPFc7MTN2cFyASQCaPpuAoG3BXEVQU8Xea+g5H4vwhEHolg+zyuEQI/81slDoFtVg26NJ5rP5L4+INJ4YK3xPmQ4V0QDmS2AVrfJWYdB8ffkjrClfYBTRlNlW55yLssG7xjrAfDPpCD/YtpVss8g== 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=Ps4geaA9O+7Z5oQTUTJFk+RelvfDLvJD1iyBwAM5sOo=; b=eIVFbnWyn3WY+StqYsUwSOKLRtgJuRDFGzEbg2Tq+FGSjmLWJlZMPZ5iBSY7XwGzP34uuGh9/FhF8Pagpf/wUZq0UzWptrr3pDOcLuO0LuOQabQgkwwAcuEHWDGPUjVbzrxz6v1lVf29ivTME5c1MsGFPwmaWqZRP+dTjH+To1SLczR9Z6B//MFAO/Om9aLkND2u0QovL/P8eD/25Fer/XklAhMGBRcERUTAZHdR8e2Ty69GyI49Prm832gumXPM93RdsBJpJEt1NZstUgeizGTKvqaX+9vbTADfzkF1VOdHj+3teTrfaOgmwi3jCfHHGeQuE3w/GsUtVYeuyBrilA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.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=Ps4geaA9O+7Z5oQTUTJFk+RelvfDLvJD1iyBwAM5sOo=; b=0cI8K+bw0/vIsjLRZJTkbRpxmAfWlczEIdwlhSTnjlFKMZjRGsugbfktFHCRBnDsw4dlDarOTKQ4cIXSlZyjzqgJO1hnrjCgQTYfgD6Y0FLuyqxzejEdS1rOBcquEOHm9fDpRPEwZ3Nm7LXb74/D+lKgRWCXkAEu+Hk5FD1Xihc= Received: from CH2PR11CA0005.namprd11.prod.outlook.com (2603:10b6:610:54::15) by BL1PR12MB5803.namprd12.prod.outlook.com (2603:10b6:208:393::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.21; Fri, 3 Nov 2023 19:08:34 +0000 Received: from CO1PEPF000044F3.namprd05.prod.outlook.com (2603:10b6:610:54:cafe::d0) by CH2PR11CA0005.outlook.office365.com (2603:10b6:610:54::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.22 via Frontend Transport; Fri, 3 Nov 2023 19:08:34 +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 CO1PEPF000044F3.mail.protection.outlook.com (10.167.241.73) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6954.19 via Frontend Transport; Fri, 3 Nov 2023 19:08:34 +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; Fri, 3 Nov 2023 14:08:31 -0500 From: Mario Limonciello <mario.limonciello@amd.com> To: Karol Herbst <kherbst@redhat.com>, Lyude Paul <lyude@redhat.com>, "Alex Deucher" <alexander.deucher@amd.com>, =?utf-8?q?Christian_K=C3=B6nig?= <christian.koenig@amd.com>, Bjorn Helgaas <bhelgaas@google.com>, "Hans de Goede" <hdegoede@redhat.com>, =?utf-8?q?Ilpo_J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com>, Mika Westerberg <mika.westerberg@linux.intel.com>, Lukas Wunner <lukas@wunner.de> CC: Danilo Krummrich <dakr@redhat.com>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, Xinhui Pan <Xinhui.Pan@amd.com>, "Rafael J . Wysocki" <rafael@kernel.org>, Mark Gross <markgross@kernel.org>, "Andreas Noever" <andreas.noever@gmail.com>, Michael Jamet <michael.jamet@intel.com>, Yehezkel Bernat <YehezkelShB@gmail.com>, =?utf-8?q?Pali_Roh=C3=A1r?= <pali@kernel.org>, =?utf-8?q?Marek_Beh=C3=BAn?= <kabel@kernel.org>, "Maciej W . Rozycki" <macro@orcam.me.uk>, Manivannan Sadhasivam <mani@kernel.org>, Mario Limonciello <mario.limonciello@amd.com>, "open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS" <dri-devel@lists.freedesktop.org>, "open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS" <nouveau@lists.freedesktop.org>, "open list" <linux-kernel@vger.kernel.org>, "open list:RADEON and AMDGPU DRM DRIVERS" <amd-gfx@lists.freedesktop.org>, "open list:PCI SUBSYSTEM" <linux-pci@vger.kernel.org>, "open list:ACPI" <linux-acpi@vger.kernel.org>, "open list:X86 PLATFORM DRIVERS" <platform-driver-x86@vger.kernel.org>, "open list:THUNDERBOLT DRIVER" <linux-usb@vger.kernel.org> Subject: [PATCH v2 5/9] PCI: pciehp: Move check for is_thunderbolt into a quirk Date: Fri, 3 Nov 2023 14:07:54 -0500 Message-ID: <20231103190758.82911-6-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231103190758.82911-1-mario.limonciello@amd.com> References: <20231103190758.82911-1-mario.limonciello@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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: CO1PEPF000044F3:EE_|BL1PR12MB5803:EE_ X-MS-Office365-Filtering-Correlation-Id: 33532877-d30b-42ad-d58a-08dbdca046c2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pw3DtmSyGwCC2OWJ1y6BB1svXta+8g1Hq8h58Z6YWYtQyAYs0BCMAYzoQyOEvFgnaIoRR8lpDf47WO9HQH5ofziMXWz2h7BWwXf6Y7L1FgheihBdhmlRJHZv+wdD/zxijBDgl/QH0zEXiaiCit/TXv79z8lSTEz63mochdPcxLgFlZ/Ih3d6cgcOJrk1dR4JMjA/vYZOzHnw93fntA38V1A0WxNxh8eGjr8Cjwsw3Y+M/y+RZi97O6qrtXdDy9Uy1ahea8SPrhdvnyQDVo/jY1aoReO5SAB0KhIyzyvGo1AWaIz+TWOtw9lB2QQ1bV5KkWTHgQqNlr7ua9DIVhAoTRLb0Bbv+i+EkLk+rcwPvO6FhwDICXI2ifMtMn7xoDJfwx9N1p2Xhuj+LQGajPbvc3B5NDGGXnOxHhCeLRFn0UZYrxFcbZcJ8/f5boonjPwaaEPErfkUmJosuDD+KwcNn9hLVsqi356yEFWjNbFVufb2CMVqWjSKdNgYR5msfG2tTpt5vjr9a1Cg4v6DQPp5OYInb3p62aCoO+ObA70c6VK9cIV4/Km51R06E10VjhtxAK4SiDvBkgQnnZbIr3bSp1um0q8DeyEsxITNeQsoJIF7VN3V1MCr6G+9T8CuLuvONrxNcIrCInTsE/S397kXxMZuEf3WVQI6uUhjNwU87+B+JZo4oRqasAxV9GQakM8+Oz9U5HtZKBiFu0C9vMfNEW/hR6CXK/CXETF98ovGlK3kCh3Pl0RI48pQ0mgSyEXfFRVttuLjTSkvHHlnLz/fRg== 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)(346002)(136003)(376002)(396003)(39860400002)(230922051799003)(1800799009)(186009)(82310400011)(64100799003)(451199024)(46966006)(40470700004)(36840700001)(83380400001)(86362001)(36756003)(40480700001)(4326008)(2616005)(478600001)(2906002)(47076005)(41300700001)(44832011)(82740400003)(8936002)(8676002)(6666004)(70206006)(426003)(1076003)(26005)(16526019)(316002)(54906003)(7696005)(70586007)(336012)(40460700003)(7416002)(110136005)(5660300002)(36860700001)(356005)(81166007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Nov 2023 19:08:34.1546 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 33532877-d30b-42ad-d58a-08dbdca046c2 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: CO1PEPF000044F3.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5803 X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 03 Nov 2023 12:08:55 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781571032246953245 X-GMAIL-MSGID: 1781571032246953245 |
Series |
Improvements to pcie_bandwidth_available() for eGPUs
|
|
Commit Message
Mario Limonciello
Nov. 3, 2023, 7:07 p.m. UTC
commit 493fb50e958c ("PCI: pciehp: Assume NoCompl+ for Thunderbolt
ports") added a check into pciehp code to explicitly set NoCompl+
for all Intel Thunderbolt controllers, including those that don't
need it.
This overloaded the purpose of the `is_thunderbolt` member of
`struct pci_device` because that means that any controller that
identifies as thunderbolt would set NoCompl+ even if it doesn't
suffer this deficiency. As that commit helpfully specifies all the
controllers with the problem, move them into a PCI quirk.
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
drivers/pci/hotplug/pciehp_hpc.c | 6 +-----
drivers/pci/quirks.c | 20 ++++++++++++++++++++
include/linux/pci.h | 1 +
3 files changed, 22 insertions(+), 5 deletions(-)
Comments
On Fri, 3 Nov 2023, Mario Limonciello wrote: > commit 493fb50e958c ("PCI: pciehp: Assume NoCompl+ for Thunderbolt > ports") added a check into pciehp code to explicitly set NoCompl+ > for all Intel Thunderbolt controllers, including those that don't > need it. > > This overloaded the purpose of the `is_thunderbolt` member of > `struct pci_device` because that means that any controller that > identifies as thunderbolt would set NoCompl+ even if it doesn't > suffer this deficiency. As that commit helpfully specifies all the > controllers with the problem, move them into a PCI quirk. > > Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> > --- > drivers/pci/hotplug/pciehp_hpc.c | 6 +----- > drivers/pci/quirks.c | 20 ++++++++++++++++++++ > include/linux/pci.h | 1 + > 3 files changed, 22 insertions(+), 5 deletions(-) > > diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c > index fd713abdfb9f..23a92d681d1c 100644 > --- a/drivers/pci/hotplug/pciehp_hpc.c > +++ b/drivers/pci/hotplug/pciehp_hpc.c > @@ -991,11 +991,7 @@ struct controller *pcie_init(struct pcie_device *dev) > if (pdev->hotplug_user_indicators) > slot_cap &= ~(PCI_EXP_SLTCAP_AIP | PCI_EXP_SLTCAP_PIP); > > - /* > - * We assume no Thunderbolt controllers support Command Complete events, > - * but some controllers falsely claim they do. > - */ > - if (pdev->is_thunderbolt) > + if (pdev->no_command_complete) > slot_cap |= PCI_EXP_SLTCAP_NCCS; > > ctrl->slot_cap = slot_cap; > diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c > index eeec1d6f9023..4bbf6e33ca11 100644 > --- a/drivers/pci/quirks.c > +++ b/drivers/pci/quirks.c > @@ -3807,6 +3807,26 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_4C > DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PORT_RIDGE, > quirk_thunderbolt_hotplug_msi); > > +/* > + * We assume no Thunderbolt controllers support Command Complete events, > + * but some controllers falsely claim they do. IMO, this wording makes little sense with the new code. How about taking some text from the original commit's changelog: /* * Certain Thunderbolt 1 controllers falsely claim to support Command * Completed events. */ The code change looks fine.
On 11/6/2023 06:41, Ilpo Järvinen wrote: > On Fri, 3 Nov 2023, Mario Limonciello wrote: > >> commit 493fb50e958c ("PCI: pciehp: Assume NoCompl+ for Thunderbolt >> ports") added a check into pciehp code to explicitly set NoCompl+ >> for all Intel Thunderbolt controllers, including those that don't >> need it. >> >> This overloaded the purpose of the `is_thunderbolt` member of >> `struct pci_device` because that means that any controller that >> identifies as thunderbolt would set NoCompl+ even if it doesn't >> suffer this deficiency. As that commit helpfully specifies all the >> controllers with the problem, move them into a PCI quirk. >> >> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> >> --- >> drivers/pci/hotplug/pciehp_hpc.c | 6 +----- >> drivers/pci/quirks.c | 20 ++++++++++++++++++++ >> include/linux/pci.h | 1 + >> 3 files changed, 22 insertions(+), 5 deletions(-) >> >> diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c >> index fd713abdfb9f..23a92d681d1c 100644 >> --- a/drivers/pci/hotplug/pciehp_hpc.c >> +++ b/drivers/pci/hotplug/pciehp_hpc.c >> @@ -991,11 +991,7 @@ struct controller *pcie_init(struct pcie_device *dev) >> if (pdev->hotplug_user_indicators) >> slot_cap &= ~(PCI_EXP_SLTCAP_AIP | PCI_EXP_SLTCAP_PIP); >> >> - /* >> - * We assume no Thunderbolt controllers support Command Complete events, >> - * but some controllers falsely claim they do. >> - */ >> - if (pdev->is_thunderbolt) >> + if (pdev->no_command_complete) >> slot_cap |= PCI_EXP_SLTCAP_NCCS; >> >> ctrl->slot_cap = slot_cap; >> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c >> index eeec1d6f9023..4bbf6e33ca11 100644 >> --- a/drivers/pci/quirks.c >> +++ b/drivers/pci/quirks.c >> @@ -3807,6 +3807,26 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_4C >> DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PORT_RIDGE, >> quirk_thunderbolt_hotplug_msi); >> >> +/* >> + * We assume no Thunderbolt controllers support Command Complete events, >> + * but some controllers falsely claim they do. > > IMO, this wording makes little sense with the new code. How about taking > some text from the original commit's changelog: > > /* > * Certain Thunderbolt 1 controllers falsely claim to support Command > * Completed events. > */ > > The code change looks fine. > Ack, will change.
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index fd713abdfb9f..23a92d681d1c 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -991,11 +991,7 @@ struct controller *pcie_init(struct pcie_device *dev) if (pdev->hotplug_user_indicators) slot_cap &= ~(PCI_EXP_SLTCAP_AIP | PCI_EXP_SLTCAP_PIP); - /* - * We assume no Thunderbolt controllers support Command Complete events, - * but some controllers falsely claim they do. - */ - if (pdev->is_thunderbolt) + if (pdev->no_command_complete) slot_cap |= PCI_EXP_SLTCAP_NCCS; ctrl->slot_cap = slot_cap; diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index eeec1d6f9023..4bbf6e33ca11 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -3807,6 +3807,26 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_4C DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PORT_RIDGE, quirk_thunderbolt_hotplug_msi); +/* + * We assume no Thunderbolt controllers support Command Complete events, + * but some controllers falsely claim they do. + */ +static void quirk_thunderbolt_command_complete(struct pci_dev *pdev) +{ + pdev->no_command_complete = 1; +} +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_LIGHT_RIDGE, + quirk_thunderbolt_command_complete); +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_EAGLE_RIDGE, + quirk_thunderbolt_command_complete); +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_LIGHT_PEAK, + quirk_thunderbolt_command_complete); +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_4C, + quirk_thunderbolt_command_complete); +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_2C, + quirk_thunderbolt_command_complete); +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PORT_RIDGE, + quirk_thunderbolt_command_complete); #ifdef CONFIG_ACPI /* * Apple: Shutdown Cactus Ridge Thunderbolt controller. diff --git a/include/linux/pci.h b/include/linux/pci.h index 530b0a360514..439c2dac8a3e 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -441,6 +441,7 @@ struct pci_dev { unsigned int is_hotplug_bridge:1; unsigned int shpc_managed:1; /* SHPC owned by shpchp */ unsigned int is_thunderbolt:1; /* Thunderbolt controller */ + unsigned int no_command_complete:1; /* No command completion */ /* * Devices marked being untrusted are the ones that can potentially * execute DMA attacks and similar. They are typically connected