diff options
author | Eddie James <eajames@linux.ibm.com> | 2021-10-19 16:17:49 -0500 |
---|---|---|
committer | Joel Stanley <joel@jms.id.au> | 2021-10-22 09:54:33 +1030 |
commit | 826280348ec68cefeb7c3cc3689f6cafcd31c832 (patch) | |
tree | 6efb853dd427124516af1ef46dd9f4496f9c8a89 | |
parent | 9a93de620e0a113b5f18916f58e1c80aad2f612b (diff) | |
download | lwn-826280348ec68cefeb7c3cc3689f6cafcd31c832.tar.gz lwn-826280348ec68cefeb7c3cc3689f6cafcd31c832.zip |
fsi: sbefifo: Add sysfs file indicating a timeout error
The SBEFIFO timeout error requires special handling in userspace
to do recovery operations. Add a sysfs file to indicate a timeout
error, and notify pollers when a timeout occurs.
This will be used by the openpower-occ-control application.
Signed-off-by: Eddie James <eajames@linux.ibm.com>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Link: https://lore.kernel.org/r/20211019211749.38059-3-eajames@linux.ibm.com
Signed-off-by: Joel Stanley <joel@jms.id.au>
-rw-r--r-- | drivers/fsi/fsi-sbefifo.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/fsi/fsi-sbefifo.c b/drivers/fsi/fsi-sbefifo.c index 84cb965bfed5..b414ab4431ef 100644 --- a/drivers/fsi/fsi-sbefifo.c +++ b/drivers/fsi/fsi-sbefifo.c @@ -124,6 +124,7 @@ struct sbefifo { bool broken; bool dead; bool async_ffdc; + bool timed_out; }; struct sbefifo_user { @@ -136,6 +137,14 @@ struct sbefifo_user { static DEFINE_MUTEX(sbefifo_ffdc_mutex); +static ssize_t timeout_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct sbefifo *sbefifo = container_of(dev, struct sbefifo, dev); + + return sysfs_emit(buf, "%d\n", sbefifo->timed_out ? 1 : 0); +} +static DEVICE_ATTR_RO(timeout); static void __sbefifo_dump_ffdc(struct device *dev, const __be32 *ffdc, size_t ffdc_sz, bool internal) @@ -462,11 +471,14 @@ static int sbefifo_wait(struct sbefifo *sbefifo, bool up, break; } if (!ready) { + sysfs_notify(&sbefifo->dev.kobj, NULL, dev_attr_timeout.attr.name); + sbefifo->timed_out = true; dev_err(dev, "%s FIFO Timeout ! status=%08x\n", up ? "UP" : "DOWN", sts); return -ETIMEDOUT; } dev_vdbg(dev, "End of wait status: %08x\n", sts); + sbefifo->timed_out = false; *status = sts; return 0; @@ -993,6 +1005,8 @@ static int sbefifo_probe(struct device *dev) child_name); } + device_create_file(&sbefifo->dev, &dev_attr_timeout); + return 0; err_free_minor: fsi_free_minor(sbefifo->dev.devt); @@ -1018,6 +1032,8 @@ static int sbefifo_remove(struct device *dev) dev_dbg(dev, "Removing sbefifo device...\n"); + device_remove_file(&sbefifo->dev, &dev_attr_timeout); + mutex_lock(&sbefifo->lock); sbefifo->dead = true; mutex_unlock(&sbefifo->lock); |