Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1164497
| Path | csiph.com!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Duc Dang <dhdang@apm.com> |
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 1/1] PCI: X-Gene: Disable Configuration Request Retry Status for X-Gene v1 PCIe |
| Date | Sat, 13 Jun 2015 02:40:02 +0200 |
| Message-ID | <pAHEm-5fv-23@gated-at.bofh.it> (permalink) |
| References | <pAGff-3da-1@gated-at.bofh.it> |
| X-Original-To | Bjorn Helgaas <bhelgaas@google.com> |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=RiW0YOg8B2ZLU0Ragjgo3H26l75llMyHg+xWpH4eHbA=; b=Prjs9sLH7EWfsS1m4VnnFCWSysGoGpz/WVBEjWkebhDnBykGxm4A+VIJqAXzbz6HHE IcpanPQnx97Fij4svNYklyHXQoGrJSdgQg5m6rk7SNda3o9euBRX/b5MCCvDsKtpms02 3sr3BtTJEtk0V44DS+5UbBefdUGtCJx/HW7iy5zApsbWCpHQ/bvXyOXGqvpklkSYIb2K F4armPrZzPf1C7/EpeGqRcNIZcxfzr5V4gjvX52PI2TYYSieVmaZw4JE4HOIGdrB8uKA hEKHKTe578HcEANXvOw3BpbVcGQmKkIi4HYEe8xTHHCr372hLGZoNEWr7dFzFZq8jHgi Aw7g== |
| X-Gm-Message-State | ALoCoQkbKuQZXnqZXGhQoYUdS39zWiSrONP7Az77WDzLas+GGZG60wYnwFT1/bQx1gAFMlQoT3hvhpcceSgVSLRO2fb5IusFmKyh21+V/D7GZkMy6381xpVSlfPJT8Rp0NrSZQK1rIOCRKke5OuitMHez9ycCTlT8Q== |
| X-Received | by 10.70.89.102 with SMTP id bn6mr27588116pdb.48.1434155773959; Fri, 12 Jun 2015 17:36:13 -0700 (PDT) |
| X-Received | by 10.70.89.102 with SMTP id bn6mr27588096pdb.48.1434155773856; Fri, 12 Jun 2015 17:36:13 -0700 (PDT) |
| X-Mailer | git-send-email 1.9.1 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 110 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Ian Campbell <ian.campbell@citrix.com>, Marcin Juszkiewicz <mjuszkiewicz@redhat.com>, Tanmay Inamdar <tinamdar@apm.com>, patches@apm.com, Duc Dang <dhdang@apm.com> |
| X-Original-Date | Fri, 12 Jun 2015 17:35:57 -0700 |
| X-Original-Message-ID | <017c1ec8e3f43f86a947eaddb30c9389e0b1053b.1434154377.git.dhdang@apm.com> |
| X-Original-References | <CAErSpo5Oc_8ca4h7xYSkGPFE1vxWg1sy1rJRc0B=u9LrdOLY7g@mail.gmail.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | aioe.org linux.kernel:1164497 |
Show key headers only | View raw
X-Gene v1 PCIe controller has a bug in Configuration Request Retry
Status (CRS) logic:
When CPU tries to read Vendor ID and Device ID of not-existed
remote device, the controller returns 0xFFFF0001 instead of
0xFFFFFFFF; this will add significant delay in boot time as
pci_bus_read_dev_vendor_id will wait for 60 seconds before
giving up.
So for X-Gene v1 PCIe controllers, disable CRS capability
advertisement by clearing CRS Software Visibility bit before
returning the Root Capability value to the callers. This is done
by implementing X-Gene PCIe specific xgene_pcie_config_read32 for
CFG read accesses to replace the generic default pci_generic_config_read32
function.
v2 changes:
Use pci_generic_config_read32 to implement xgene_pcie_config_read32
Signed-off-by: Duc Dang <dhdang@apm.com>
Tested-by: Ian Campbell <ian.campbell@citrix.com>
Tested-by: Marcin Juszkiewicz <mjuszkiewicz@redhat.com>
---
drivers/pci/host/pci-xgene.c | 43 ++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 42 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c
index e6c8864..7e3cf28 100644
--- a/drivers/pci/host/pci-xgene.c
+++ b/drivers/pci/host/pci-xgene.c
@@ -59,6 +59,12 @@
#define SZ_1T (SZ_1G*1024ULL)
#define PIPE_PHY_RATE_RD(src) ((0xc000 & (u32)(src)) >> 0xe)
+#define ROOT_CAP_AND_CTRL 0x5C
+
+/* PCIe IP version */
+#define XGENE_PCIE_IP_VER_UNKN 0
+#define XGENE_PCIE_IP_VER_1 1
+
struct xgene_pcie_port {
struct device_node *node;
struct device *dev;
@@ -67,6 +73,7 @@ struct xgene_pcie_port {
void __iomem *cfg_base;
unsigned long cfg_addr;
bool link_up;
+ u32 version;
};
static inline u32 pcie_bar_low_val(u32 addr, u32 flags)
@@ -140,9 +147,39 @@ static void __iomem *xgene_pcie_map_bus(struct pci_bus *bus, unsigned int devfn,
return xgene_pcie_get_cfg_base(bus) + offset;
}
+int xgene_pcie_config_read32(struct pci_bus *bus, unsigned int devfn,
+ int where, int size, u32 *val)
+{
+ struct xgene_pcie_port *port = bus->sysdata;
+
+ if (pci_generic_config_read32(bus, devfn, where & ~0x3, 4, val) !=
+ PCIBIOS_SUCCESSFUL)
+ return PCIBIOS_DEVICE_NOT_FOUND;
+ /*
+ * X-Gene v1 PCIe controller has a bug in Configuration Request
+ * Retry Status (CRS) logic:
+ * When CPU tries to read Vendor ID and Device ID of not-existed
+ * remote device, the controller returns 0xFFFF0001 instead of
+ * 0xFFFFFFFF; this will add significant delay in boot time as
+ * pci_bus_read_dev_vendor_id will wait for 60 seconds before
+ * giving up.
+ * So for X-Gene v1 PCIe controllers, disable CRS capability
+ * advertisement by clearing CRS Software Visibility bit before
+ * returning the Root Capability value to the callers.
+ */
+ if (pci_is_root_bus(bus) && (port->version == XGENE_PCIE_IP_VER_1) &&
+ ((where & ~0x3) == ROOT_CAP_AND_CTRL))
+ *val &= ~(PCI_EXP_RTCAP_CRSVIS << 16);
+
+ if (size <= 2)
+ *val = (*val >> (8 * (where & 3))) & ((1 << (size * 8)) - 1);
+
+ return PCIBIOS_SUCCESSFUL;
+}
+
static struct pci_ops xgene_pcie_ops = {
.map_bus = xgene_pcie_map_bus,
- .read = pci_generic_config_read32,
+ .read = xgene_pcie_config_read32,
.write = pci_generic_config_write32,
};
@@ -500,6 +537,10 @@ static int xgene_pcie_probe_bridge(struct platform_device *pdev)
port->node = of_node_get(pdev->dev.of_node);
port->dev = &pdev->dev;
+ port->version = XGENE_PCIE_IP_VER_UNKN;
+ if (of_device_is_compatible(port->node, "apm,xgene-pcie"))
+ port->version = XGENE_PCIE_IP_VER_1;
+
ret = xgene_pcie_map_reg(port, pdev);
if (ret)
return ret;
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH v2 1/1] PCI: X-Gene: Disable Configuration Request Retry Status for X-Gene v1 PCIe Duc Dang <dhdang@apm.com> - 2015-06-13 02:40 +0200 Re: [PATCH v2 1/1] PCI: X-Gene: Disable Configuration Request Retry Status for X-Gene v1 PCIe Bjorn Helgaas <bhelgaas@google.com> - 2015-06-18 22:10 +0200
csiph-web