From: Sinan Kaya <okaya@codeaurora.org>
To: linux-pci@vger.kernel.org, timur@codeaurora.org, wim.ten.have@oracle.com
Cc: Sinan Kaya <okaya@codeaurora.org>,
linux-arm-msm@vger.kernel.org,
Bjorn Helgaas <bhelgaas@google.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH V3 2/2] PCI: Do not enable extended tags if a quirky device is found
Date: Tue, 11 Jul 2017 11:25:34 -0400 [thread overview]
Message-ID: <1499786735-25782-2-git-send-email-okaya@codeaurora.org> (raw)
In-Reply-To: <1499786735-25782-1-git-send-email-okaya@codeaurora.org>
According to extended tags ECN document, all PCIe receivers are expected
to support extended tags. However, devices with exceptions/quirks were
found. If a device with extended tags quirk is found, disable extended tags
for all devices in the tree assuming peer-to-peer is possible.
Also note that the default value of Extended Tags Enable bit is
implementation specific. Therefore, we are clearing the bit by default when
incompatible HW is found.
Reported-by: Wim ten Have <wim.ten.have@oracle.com>
Link: https://bugzilla.redhat.com/show_bug.cgi?id=1467674
Fixes: 60db3a4d8cc9 ("PCI: Enable PCIe Extended Tags if supported")
Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
---
drivers/pci/probe.c | 37 +++++++++++++++++++++++++++++++------
1 file changed, 31 insertions(+), 6 deletions(-)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 19c8950..396dd80 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1684,21 +1684,43 @@ static void program_hpp_type2(struct pci_dev *dev, struct hpp_type2 *hpp)
*/
}
-static void pci_configure_extended_tags(struct pci_dev *dev)
+static int pcie_find_broken_exttags(struct pci_dev *dev, void *data)
{
+ bool *found = data;
+
+ if (!pci_is_pcie(dev))
+ return 0;
+
+ if (dev->broken_exttags_completer)
+ *found = dev->broken_exttags_completer;
+
+ return 0;
+}
+
+static int pcie_bus_configure_exttags(struct pci_dev *dev, void *broken)
+{
+ bool supported = !*(bool *)broken;
u32 dev_cap;
int ret;
if (!pci_is_pcie(dev))
- return;
+ return 0;
ret = pcie_capability_read_dword(dev, PCI_EXP_DEVCAP, &dev_cap);
- if (ret)
- return;
+ if (ret || (!(dev_cap & PCI_EXP_DEVCAP_EXT_TAG)))
+ return 0;
- if (dev_cap & PCI_EXP_DEVCAP_EXT_TAG)
+ if (supported) {
+ dev_dbg(&dev->dev, "setting extended tags capability\n");
pcie_capability_set_word(dev, PCI_EXP_DEVCTL,
PCI_EXP_DEVCTL_EXT_TAG);
+ } else {
+ dev_dbg(&dev->dev, "clearing extended tags capability\n");
+ pcie_capability_clear_word(dev, PCI_EXP_DEVCTL,
+ PCI_EXP_DEVCTL_EXT_TAG);
+ }
+
+ return 0;
}
static void pci_configure_device(struct pci_dev *dev)
@@ -1707,7 +1729,6 @@ static void pci_configure_device(struct pci_dev *dev)
int ret;
pci_configure_mps(dev);
- pci_configure_extended_tags(dev);
memset(&hpp, 0, sizeof(hpp));
ret = pci_get_hp_params(dev, &hpp);
@@ -2201,6 +2222,7 @@ static int pcie_bus_configure_set(struct pci_dev *dev, void *data)
void pcie_bus_configure_settings(struct pci_bus *bus)
{
u8 smpss = 0;
+ bool broken_exttags = false;
if (!bus->self)
return;
@@ -2224,6 +2246,9 @@ void pcie_bus_configure_settings(struct pci_bus *bus)
pcie_bus_configure_set(bus->self, &smpss);
pci_walk_bus(bus, pcie_bus_configure_set, &smpss);
+
+ pci_walk_bus(bus, pcie_find_broken_exttags, &broken_exttags);
+ pci_walk_bus(bus, pcie_bus_configure_exttags, &broken_exttags);
}
EXPORT_SYMBOL_GPL(pcie_bus_configure_settings);
--
1.9.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2017-07-11 15:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-11 15:25 [PATCH V3 1/2] PCI: Add Extended Tags quirk for Broadcom HT2100 Root Port Sinan Kaya
2017-07-11 15:25 ` Sinan Kaya [this message]
2017-07-11 19:58 ` Bjorn Helgaas
2017-07-11 20:16 ` Sinan Kaya
2017-07-11 20:39 ` Bjorn Helgaas
2017-07-12 13:07 ` Sinan Kaya
2017-07-12 19:45 ` Bjorn Helgaas
2017-07-12 19:47 ` Sinan Kaya
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=1499786735-25782-2-git-send-email-okaya@codeaurora.org \
--to=okaya@codeaurora.org \
--cc=bhelgaas@google.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=timur@codeaurora.org \
--cc=wim.ten.have@oracle.com \
/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).