Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Eddie James and committed by
Joel Stanley
82628034 9a93de62

+16
+16
drivers/fsi/fsi-sbefifo.c
··· 124 124 bool broken; 125 125 bool dead; 126 126 bool async_ffdc; 127 + bool timed_out; 127 128 }; 128 129 129 130 struct sbefifo_user { ··· 137 136 138 137 static DEFINE_MUTEX(sbefifo_ffdc_mutex); 139 138 139 + static ssize_t timeout_show(struct device *dev, struct device_attribute *attr, 140 + char *buf) 141 + { 142 + struct sbefifo *sbefifo = container_of(dev, struct sbefifo, dev); 143 + 144 + return sysfs_emit(buf, "%d\n", sbefifo->timed_out ? 1 : 0); 145 + } 146 + static DEVICE_ATTR_RO(timeout); 140 147 141 148 static void __sbefifo_dump_ffdc(struct device *dev, const __be32 *ffdc, 142 149 size_t ffdc_sz, bool internal) ··· 471 462 break; 472 463 } 473 464 if (!ready) { 465 + sysfs_notify(&sbefifo->dev.kobj, NULL, dev_attr_timeout.attr.name); 466 + sbefifo->timed_out = true; 474 467 dev_err(dev, "%s FIFO Timeout ! status=%08x\n", up ? "UP" : "DOWN", sts); 475 468 return -ETIMEDOUT; 476 469 } 477 470 dev_vdbg(dev, "End of wait status: %08x\n", sts); 478 471 472 + sbefifo->timed_out = false; 479 473 *status = sts; 480 474 481 475 return 0; ··· 1005 993 child_name); 1006 994 } 1007 995 996 + device_create_file(&sbefifo->dev, &dev_attr_timeout); 997 + 1008 998 return 0; 1009 999 err_free_minor: 1010 1000 fsi_free_minor(sbefifo->dev.devt); ··· 1031 1017 struct sbefifo *sbefifo = dev_get_drvdata(dev); 1032 1018 1033 1019 dev_dbg(dev, "Removing sbefifo device...\n"); 1020 + 1021 + device_remove_file(&sbefifo->dev, &dev_attr_timeout); 1034 1022 1035 1023 mutex_lock(&sbefifo->lock); 1036 1024 sbefifo->dead = true;