Skip to contentSkip to conversation

pci/probe: Ignore the device id while handling CRS

PATCH Applied Rajat Jain 2 participants 2 messages Sep 8, 2014 – Sep 22, 2014 PCI

lore
Share & tools
lore

Rajat Jain

author
#0 lore raw

PATCH 1/1 pci/probe: Ignore the device id while handling CRS

Some root ports may return the actual device id returned by the endpoint, instead of faking up a synthetic id (0xFFFF) as specified by the PCIe spec (sec 2.3.2). We have seen such broken devices in the past that match this behaviour:
(Ref: https://lkml.org/lkml/2007/11/1/198)

To take care of the same, CRS was disabled then, however, we want to enable CRS now (https://lkml.org/lkml/2014/9/2/509), but still do not want to break such devices. Thus check only against the (vendor id == 1) and ignore the device id.

---
 drivers/pci/probe.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/pci/probe.c +7 -2
index 3c4c35c..0076a9b 100644
@@ -1305,8 +1305,13 @@ bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l,
 	    *l == 0x0000ffff || *l == 0xffff0000)
 		return false;
 
-	/* Configuration request Retry Status */
-	while (*l == 0xffff0001) {
+	/*
+	 * Configuration request Retry Status. Note that some root ports
+	 * are broken and may return actual device ID instead of a synthetic ID
+	 * (0xFFFF) to be faked as per the PCIe spec. Hence ignore the device ID
+	 * and only check for (vendor id == 1)
+	 */
+	while (*l & 0xffff == 0x0001) {
 		if (!crs_timeout)
 			return false;
 
Signature · 1 line
1.7.9.5
maintainer Applied
#1 lore raw
Quoted 6 lines · Rajat Jain

Some root ports may return the actual device id returned by the endpoint, instead of faking up a synthetic id (0xFFFF) as specified by the PCIe spec (sec 2.3.2). We have seen such broken devices in the past that match this behaviour:
(Ref: https://lkml.org/lkml/2007/11/1/198)

Quoted 8 lines

To take care of the same, CRS was disabled then, however, we want to enable CRS now (https://lkml.org/lkml/2014/9/2/509), but still do not want to break such devices. Thus check only against the (vendor id == 1) and ignore the device id.

Applied to pci/enumeration for v3.18, thanks!

Quoted 27 lines
---
 drivers/pci/probe.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/pci/probe.c +7 -2
index 3c4c35c..0076a9b 100644
@@ -1305,8 +1305,13 @@ bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l,
 	    *l == 0x0000ffff || *l == 0xffff0000)
 		return false;
 
-	/* Configuration request Retry Status */
-	while (*l == 0xffff0001) {
+	/*
+	 * Configuration request Retry Status. Note that some root ports
+	 * are broken and may return actual device ID instead of a synthetic ID
+	 * (0xFFFF) to be faked as per the PCIe spec. Hence ignore the device ID
+	 * and only check for (vendor id == 1)
+	 */
+	while (*l & 0xffff == 0x0001) {
 		if (!crs_timeout)
 			return false;
 
Signature · 1 line
1.7.9.5