linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pci/probe: Ignore the device id while handling CRS
@ 2014-09-08 21:19 Rajat Jain
  2014-09-22 18:53 ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: Rajat Jain @ 2014-09-08 21:19 UTC (permalink / raw)
  To: linux-pci, linux-kernel, bhelgaas; +Cc: rajatjain, groeck

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.

Signed-off-by: Rajat Jain <rajatxjain@gmail.com>
Signed-off-by: Rajat Jain <rajatjain@juniper.net>
Signed-off-by: Guenter Roeck <groeck@juniper.net>
---
 drivers/pci/probe.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 3c4c35c..0076a9b 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -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;
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] pci/probe: Ignore the device id while handling CRS
  2014-09-08 21:19 [PATCH] pci/probe: Ignore the device id while handling CRS Rajat Jain
@ 2014-09-22 18:53 ` Bjorn Helgaas
  0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2014-09-22 18:53 UTC (permalink / raw)
  To: Rajat Jain; +Cc: linux-pci, linux-kernel, rajatjain, groeck

On Mon, Sep 08, 2014 at 02:19:49PM -0700, Rajat Jain wrote:
> 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.
> 
> Signed-off-by: Rajat Jain <rajatxjain@gmail.com>
> Signed-off-by: Rajat Jain <rajatjain@juniper.net>
> Signed-off-by: Guenter Roeck <groeck@juniper.net>

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

> ---
>  drivers/pci/probe.c |    9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index 3c4c35c..0076a9b 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -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;
>  
> -- 
> 1.7.9.5
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-22 18:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-08 21:19 [PATCH] pci/probe: Ignore the device id while handling CRS Rajat Jain
2014-09-22 18:53 ` Bjorn Helgaas

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).