All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rajat Jain <rajatxjain@gmail.com>
To: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	bhelgaas@google.com
Cc: rajatjain@juniper.net, groeck@juniper.net
Subject: [PATCH] pci/probe: Ignore the device id while handling CRS
Date: Mon, 08 Sep 2014 14:19:49 -0700	[thread overview]
Message-ID: <540E1D75.5000500@gmail.com> (raw)

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


             reply	other threads:[~2014-09-08 21:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-08 21:19 Rajat Jain [this message]
2014-09-22 18:53 ` [PATCH] pci/probe: Ignore the device id while handling CRS Bjorn Helgaas

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=540E1D75.5000500@gmail.com \
    --to=rajatxjain@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=groeck@juniper.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=rajatjain@juniper.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.