From: Sinan Kaya <okaya@codeaurora.org>
To: linux-pci@vger.kernel.org, timur@codeaurora.org,
alex.williamson@redhat.com, vikrams@codeaurora.org
Cc: Lorenzo.Pieralisi@arm.com, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org, Sinan Kaya <okaya@codeaurora.org>,
Bjorn Helgaas <bhelgaas@google.com>,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH V4] PCI: handle CRS returned by device after FLR
Date: Thu, 6 Jul 2017 17:07:14 -0400 [thread overview]
Message-ID: <1499375234-23928-1-git-send-email-okaya@codeaurora.org> (raw)
An endpoint is allowed to issue Configuration Request Retry Status (CRS)
following a Function Level Reset (FLR) request to indicate that it is not
ready to accept new requests.
Seen a timeout message with Intel 750 NVMe drive and FLR reset.
Kernel enables CRS visibility in pci_enable_crs() function for each bridge
it discovers. The OS observes a special vendor ID read value of 0xFFFF0001
in this case. We need to keep polling until this special read value
disappears. pci_bus_read_dev_vendor_id() takes care of CRS handling for a
given vendor id read request under the covers.
Adding a vendor ID read if this is a physical function before attempting
to read any other registers on the endpoint. A CRS indication will only
be given if the address to be read is vendor ID register.
Note that virtual functions report their vendor ID through another
mechanism.
The spec is calling to wait up to 1 seconds if the device is sending CRS.
The NVMe device seems to be requiring more. Relax this up to 60 seconds.
Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
---
drivers/pci/pci.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index aab9d51..83a9784 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -3723,10 +3723,16 @@ static void pci_flr_wait(struct pci_dev *dev)
int i = 0;
u32 id;
- do {
- msleep(100);
- pci_read_config_dword(dev, PCI_COMMAND, &id);
- } while (i++ < 10 && id == ~0);
+ if (dev->is_virtfn) {
+ do {
+ msleep(100);
+ pci_read_config_dword(dev, PCI_COMMAND, &id);
+ } while (i++ < 10 && id == ~0);
+ } else {
+ if (!pci_bus_read_dev_vendor_id(dev->bus, dev->devfn, &id,
+ 60*1000))
+ id = ~0;
+ }
if (id == ~0)
dev_warn(&dev->dev, "Failed to return from FLR\n");
--
1.9.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2017-07-06 21:07 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-06 21:07 Sinan Kaya [this message]
2017-07-13 12:17 ` [PATCH V4] PCI: handle CRS returned by device after FLR Bjorn Helgaas
2017-07-13 15:44 ` Sinan Kaya
2017-07-13 16:29 ` Keith Busch
2017-07-13 16:42 ` Sinan Kaya
2017-07-13 17:24 ` Keith Busch
2017-07-13 23:38 ` Bjorn Helgaas
2017-07-14 14:10 ` Sinan Kaya
2017-07-13 16:03 ` Keith Busch
2017-07-13 23:49 ` Bjorn Helgaas
2017-07-14 14:28 ` Sinan Kaya
2017-07-31 21:45 ` Sinan Kaya
2017-07-31 22:19 ` 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=1499375234-23928-1-git-send-email-okaya@codeaurora.org \
--to=okaya@codeaurora.org \
--cc=Lorenzo.Pieralisi@arm.com \
--cc=alex.williamson@redhat.com \
--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=vikrams@codeaurora.org \
/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).