From: Mario Limonciello <mario.limonciello@amd.com>
To: "Karol Herbst" <kherbst@redhat.com>,
"Lyude Paul" <lyude@redhat.com>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"Bjorn Helgaas" <bhelgaas@google.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>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Pali Rohár" <pali@kernel.org>, "Marek Behún" <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>
Subject: [PATCH v3 4/7] PCI: pciehp: Move check for is_thunderbolt into a quirk
Date: Tue, 14 Nov 2023 14:07:52 -0600 [thread overview]
Message-ID: <20231114200755.14911-5-mario.limonciello@amd.com> (raw)
In-Reply-To: <20231114200755.14911-1-mario.limonciello@amd.com>
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>
---
v2->v3:
* Reword commit message
* Update comments
---
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 b1d0a1b3917d..40f7a26fb98f 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -992,11 +992,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 ea476252280a..fa9b82cd7b3b 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -3809,6 +3809,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);
+/*
+ * Certain Thunderbolt 1 controllers falsely claim to support Command
+ * Completed events.
+ */
+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 1fbca2bd92e8..20a6e4fc3060 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
--
2.34.1
next prev parent reply other threads:[~2023-11-14 20:08 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-14 20:07 [PATCH v3 0/7] Improvements to pcie_bandwidth_available() for eGPUs Mario Limonciello
2023-11-14 20:07 ` [PATCH v3 1/7] drm/nouveau: Switch from pci_is_thunderbolt_attached() to dev_is_removable() Mario Limonciello
2023-11-16 12:50 ` Ilpo Järvinen
2023-11-14 20:07 ` [PATCH v3 2/7] drm/radeon: " Mario Limonciello
2023-11-15 9:27 ` Christian König
2023-11-14 20:07 ` [PATCH v3 3/7] PCI: Drop pci_is_thunderbolt_attached() Mario Limonciello
2023-11-16 12:51 ` Ilpo Järvinen
2023-11-14 20:07 ` Mario Limonciello [this message]
2023-11-16 12:30 ` [PATCH v3 4/7] PCI: pciehp: Move check for is_thunderbolt into a quirk Ilpo Järvinen
2023-11-14 20:07 ` [PATCH v3 5/7] PCI: ACPI: Detect PCIe root ports that are used for tunneling Mario Limonciello
2023-11-15 10:40 ` Mika Westerberg
2023-11-15 17:08 ` Mario Limonciello
2023-11-16 9:00 ` Mika Westerberg
2023-11-14 20:07 ` [PATCH v3 6/7] PCI: Split up some logic in pcie_bandwidth_available() to separate function Mario Limonciello
2023-11-16 13:02 ` Ilpo Järvinen
2023-11-14 20:07 ` [PATCH v3 7/7] PCI: Exclude PCIe ports used for virtual links in pcie_bandwidth_available() Mario Limonciello
2023-11-15 3:23 ` Lazar, Lijo
2023-11-15 17:04 ` Mario Limonciello
2023-11-15 21:09 ` Mario Limonciello
2023-11-16 4:33 ` Lazar, Lijo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231114200755.14911-5-mario.limonciello@amd.com \
--to=mario.limonciello@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=bhelgaas@google.com \
--cc=christian.koenig@amd.com \
--cc=dakr@redhat.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=kabel@kernel.org \
--cc=kherbst@redhat.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=lyude@redhat.com \
--cc=macro@orcam.me.uk \
--cc=mani@kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=nouveau@lists.freedesktop.org \
--cc=pali@kernel.org \
--cc=rafael@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).