From: Joel Stanley <joel@jms.id.au>
To: linux-fsi@lists.ozlabs.org
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Joachim Fenkes <FENKES@de.ibm.com>,
linux-kernel@vger.kernel.org, Jeremy Kerr <jk@ozlabs.org>,
Alistar Popple <alistair@popple.id.au>,
Eddie James <eajames@linux.ibm.com>,
Joachim Fenkes <fenkes@de.ibm.com>
Subject: [PATCH 2/2] fsi/sbefifo: Fix reset timeout
Date: Fri, 24 Jul 2020 16:45:18 +0930 [thread overview]
Message-ID: <20200724071518.430515-3-joel@jms.id.au> (raw)
In-Reply-To: <20200724071518.430515-1-joel@jms.id.au>
From: Joachim Fenkes <FENKES@de.ibm.com>
On BMCs with lower timer resolution than 1ms, msleep(1) will take
way longer than 1ms, so looping 10k times won't wait for 10s but
significantly longer.
Fix this by using jiffies like the rest of the code.
Fixes: 9f4a8a2d7f9d ("fsi/sbefifo: Add driver for the SBE FIFO")
Signed-off-by: Joachim Fenkes <fenkes@de.ibm.com>
Signed-off-by: Joel Stanley <joel@jms.id.au>
---
drivers/fsi/fsi-sbefifo.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/fsi/fsi-sbefifo.c b/drivers/fsi/fsi-sbefifo.c
index 655b45c1f6ba..3ad9510ad4a4 100644
--- a/drivers/fsi/fsi-sbefifo.c
+++ b/drivers/fsi/fsi-sbefifo.c
@@ -325,6 +325,7 @@ static int sbefifo_up_write(struct sbefifo *sbefifo, __be32 word)
static int sbefifo_request_reset(struct sbefifo *sbefifo)
{
struct device *dev = &sbefifo->fsi_dev->dev;
+ unsigned long end_time;
u32 status, timeout;
int rc;
@@ -341,7 +342,8 @@ static int sbefifo_request_reset(struct sbefifo *sbefifo)
}
/* Wait for it to complete */
- for (timeout = 0; timeout < SBEFIFO_RESET_TIMEOUT; timeout++) {
+ end_time = jiffies + msecs_to_jiffies(SBEFIFO_RESET_TIMEOUT);
+ while (!time_after(jiffies, end_time)) {
rc = sbefifo_regr(sbefifo, SBEFIFO_UP | SBEFIFO_STS, &status);
if (rc) {
dev_err(dev, "Failed to read UP fifo status during reset"
@@ -355,7 +357,7 @@ static int sbefifo_request_reset(struct sbefifo *sbefifo)
return 0;
}
- msleep(1);
+ cond_resched();
}
dev_err(dev, "FIFO reset timed out\n");
--
2.27.0
next prev parent reply other threads:[~2020-07-24 7:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-24 7:15 [PATCH 0/2] fsi: SBE FIFO fixes Joel Stanley
2020-07-24 7:15 ` [PATCH 1/2] fsi/sbefifo: Clean up correct FIFO when receiving reset request from SBE Joel Stanley
2020-07-27 5:51 ` Benjamin Herrenschmidt
2020-09-10 3:08 ` Joel Stanley
2020-07-24 7:15 ` Joel Stanley [this message]
2020-07-24 14:34 ` [PATCH 2/2] fsi/sbefifo: Fix reset timeout Guenter Roeck
2020-09-10 3:08 ` Joel Stanley
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=20200724071518.430515-3-joel@jms.id.au \
--to=joel@jms.id.au \
--cc=FENKES@de.ibm.com \
--cc=alistair@popple.id.au \
--cc=benh@kernel.crashing.org \
--cc=eajames@linux.ibm.com \
--cc=jk@ozlabs.org \
--cc=linux-fsi@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®