From: ira.weiny@intel.com
To: Dan Williams <dan.j.williams@intel.com>,
Bjorn Helgaas <bhelgaas@google.com>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Ira Weiny <ira.weiny@intel.com>,
Ben Widawsky <bwidawsk@kernel.org>,
Alison Schofield <alison.schofield@intel.com>,
Lukas Wunner <lukas@wunner.de>,
Vishal Verma <vishal.l.verma@intel.com>,
Dave Jiang <dave.jiang@intel.com>,
linux-kernel@vger.kernel.org, linux-cxl@vger.kernel.org,
linux-pci@vger.kernel.org
Subject: [PATCH V13 8/9] cxl/port: Retry reading CDAT on failure
Date: Tue, 5 Jul 2022 08:49:31 -0700 [thread overview]
Message-ID: <20220705154932.2141021-9-ira.weiny@intel.com> (raw)
In-Reply-To: <20220705154932.2141021-1-ira.weiny@intel.com>
From: Ira Weiny <ira.weiny@intel.com>
The CDAT read may fail for a number of reasons but mainly it is possible
to get different parts of a valid state. The checksum in the CDAT table
protects against this.
Now that the cdat data is validated, issue a retry if the CDAT read
fails. For now 5 retries are implemented.
Reviewed-by: Ben Widawsky <bwidawsk@kernel.org>
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
---
Changes from V12
Jonathan:
Standardize on 'rc' for return code
Don't set rc unnecessarily
Changes from V10
Pick up review tag and fix commit message
Changes from V9
Alison Schofield/Davidlohr Bueso
Print debug on each iteration and error only after failure
Changes from V8
Move code to cxl/core/pci.c
Changes from V6
Move to pci.c
Fix retries count
Change to 5 retries
Changes from V5:
New patch -- easy to push off or drop.
---
drivers/cxl/core/pci.c | 39 +++++++++++++++++++++++++++++----------
1 file changed, 29 insertions(+), 10 deletions(-)
diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c
index 0a1620c302e1..0853885c5767 100644
--- a/drivers/cxl/core/pci.c
+++ b/drivers/cxl/core/pci.c
@@ -623,13 +623,7 @@ static int cxl_cdat_read_table(struct device *dev,
return 0;
}
-/**
- * read_cdat_data - Read the CDAT data on this port
- * @port: Port to read data from
- *
- * This call will sleep waiting for responses from the DOE mailbox.
- */
-void read_cdat_data(struct cxl_port *port)
+static int __read_cdat_data(struct cxl_port *port)
{
static struct pci_doe_mb *cdat_mb;
struct device *dev = &port->dev;
@@ -640,19 +634,19 @@ void read_cdat_data(struct cxl_port *port)
cdat_mb = find_cdat_mb(uport);
if (!cdat_mb) {
dev_dbg(dev, "No CDAT mailbox\n");
- return;
+ return -EIO;
}
port->cdat_sup = true;
if (cxl_cdat_get_length(dev, cdat_mb, &cdat_length)) {
dev_dbg(dev, "No CDAT length\n");
- return;
+ return -EIO;
}
port->cdat.table = devm_kzalloc(dev, cdat_length, GFP_KERNEL);
if (!port->cdat.table)
- return;
+ return -ENOMEM;
port->cdat.length = cdat_length;
rc = cxl_cdat_read_table(dev, cdat_mb, &port->cdat);
@@ -663,5 +657,30 @@ void read_cdat_data(struct cxl_port *port)
port->cdat.length = 0;
dev_err(dev, "CDAT data read error\n");
}
+
+ return rc;
+}
+
+/**
+ * read_cdat_data - Read the CDAT data on this port
+ * @port: Port to read data from
+ *
+ * This call will sleep waiting for responses from the DOE mailbox.
+ */
+void read_cdat_data(struct cxl_port *port)
+{
+ int retries = 5;
+ int rc;
+
+ while (retries--) {
+ rc = __read_cdat_data(port);
+ if (!rc)
+ return;
+ dev_dbg(&port->dev,
+ "CDAT data read error rc=%d (retries %d)\n",
+ rc, retries);
+ }
+ dev_err(&port->dev, "CDAT data read failed after %d retries\n",
+ retries);
}
EXPORT_SYMBOL_NS_GPL(read_cdat_data, CXL);
--
2.35.3
next prev parent reply other threads:[~2022-07-05 15:51 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-05 15:49 [PATCH V13 0/9] CXL: Read CDAT and DSMAS data ira.weiny
2022-07-05 15:49 ` [PATCH V13 1/9] PCI: Add vendor ID for the PCI SIG ira.weiny
2022-07-05 15:49 ` [PATCH V13 2/9] PCI: Replace magic constant for PCI Sig Vendor ID ira.weiny
2022-07-05 15:49 ` [PATCH V13 3/9] PCI: Create PCIe library functions in support of DOE mailboxes ira.weiny
2022-07-07 16:22 ` Bjorn Helgaas
2022-07-11 19:13 ` Ira Weiny
2022-07-11 22:27 ` [PATCH V13.1] PCI/DOE: Add DOE mailbox support functions ira.weiny
2022-07-11 22:47 ` Matthew Wilcox
2022-07-14 14:54 ` Ira Weiny
2022-07-14 3:16 ` [PATCH V13 3/9] PCI: Create PCIe library functions in support of DOE mailboxes Dan Williams
2022-07-14 14:19 ` Ira Weiny
2022-07-05 15:49 ` [PATCH V13 4/9] cxl/pci: Create PCI DOE mailbox's for memory devices ira.weiny
2022-07-14 3:30 ` Dan Williams
2022-07-14 18:50 ` Ira Weiny
2022-07-05 15:49 ` [PATCH V13 5/9] driver-core: Introduce BIN_ATTR_ADMIN_{RO,RW} ira.weiny
2022-07-05 15:49 ` [PATCH V13 6/9] cxl/port: Read CDAT table ira.weiny
2022-07-14 15:38 ` Dan Williams
2022-07-14 19:55 ` Ira Weiny
2022-07-14 20:19 ` Dan Williams
2022-07-15 1:09 ` Ira Weiny
2022-07-05 15:49 ` [PATCH V13 7/9] cxl/port: Introduce cxl_cdat_valid() ira.weiny
2022-07-14 16:05 ` Dan Williams
2022-07-05 15:49 ` ira.weiny [this message]
2022-07-14 16:27 ` [PATCH V13 8/9] cxl/port: Retry reading CDAT on failure Dan Williams
2022-07-14 20:05 ` Ira Weiny
2022-07-14 20:13 ` Ira Weiny
2022-07-14 20:44 ` Dan Williams
2022-07-19 15:07 ` Jonathan Cameron
2022-07-05 15:49 ` [PATCH V13 9/9] cxl/port: Parse out DSMAS data from CDAT table ira.weiny
2022-07-14 16:32 ` Dan Williams
2022-07-14 19:58 ` Ira Weiny
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=20220705154932.2141021-9-ira.weiny@intel.com \
--to=ira.weiny@intel.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=alison.schofield@intel.com \
--cc=bhelgaas@google.com \
--cc=bwidawsk@kernel.org \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=vishal.l.verma@intel.com \
/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.