openbmc.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Eddie James <eajames@linux.ibm.com>
To: Joel Stanley <joel@jms.id.au>, Amitay Isaacs <amitay@ozlabs.org>
Cc: OpenBMC Maillist <openbmc@lists.ozlabs.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-fsi@lists.ozlabs.org
Subject: Re: [PATCH] fsi: sbefifo: Add sysfs file indicating a timeout error
Date: Tue, 19 Oct 2021 15:24:32 -0500	[thread overview]
Message-ID: <2edfe3a2-a853-3cfc-55fb-f89f5d68e7e1@linux.ibm.com> (raw)
In-Reply-To: <CACPK8XczD=4PXxRQrZ=aGCYtZk47i4-XoFVwep04qszf3Ls6jg@mail.gmail.com>


On 10/15/21 12:08 AM, Joel Stanley wrote:
> On Mon, 20 Sept 2021 at 19:00, Eddie James <eajames@linux.ibm.com> wrote:
>> 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.
> Should this have some documentation too?


Yes, will add in v2.


>
> What userspace uses this?


At the moment, the openpower-occ-control application.


>
> Looks good to me otherwise.
>
> Reviewed-by: Joel Stanley <joel@jms.id.au>


Thanks!

Eddie


>
>> Signed-off-by: Eddie James <eajames@linux.ibm.com>
>> ---
>>   drivers/fsi/fsi-sbefifo.c | 16 ++++++++++++++++
>>   1 file changed, 16 insertions(+)
>>
>> 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);
>> --
>> 2.27.0
>>

      reply	other threads:[~2021-10-19 20:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-20 19:00 [PATCH] fsi: sbefifo: Add sysfs file indicating a timeout error Eddie James
2021-10-15  5:08 ` Joel Stanley
2021-10-19 20:24   ` Eddie James [this message]

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=2edfe3a2-a853-3cfc-55fb-f89f5d68e7e1@linux.ibm.com \
    --to=eajames@linux.ibm.com \
    --cc=amitay@ozlabs.org \
    --cc=joel@jms.id.au \
    --cc=linux-fsi@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=openbmc@lists.ozlabs.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).