Re: [PATCH V3 1/3] gpio: Add virtio-gpio driver

From: Viresh Kumar
Date: Tue Jun 15 2021 - 21:46:22 EST


On 15-06-21, 22:03, Linus Walleij wrote:
> On Tue, Jun 15, 2021 at 1:15 PM Viresh Kumar <viresh.kumar@xxxxxxxxxx> wrote:
>
> > I am now wondering how interrupts can be made to work here. Do you
> > have anything in mind for that ?
>
> The aggregator does not aggregate interrupts only lines for now.
>
> > GPIO sysfs already supports interrupts, (...)
>
> I hope that doesn't make you tempted to use sysfs to get interrupts,
> those are awful, they use sysfs_notify_dirent() which means that
> if two IRQs happen in fast succession you will miss one of them
> and think it was only one.
>
> The GPIO character device supports low latency events forwarding
> interrupts to userspace including QEMU & similar, timestamps the
> events as close in time as possible to when they actually happen
> (which is necessary for any kind of industrial control) and will never
> miss an event if the hardware can register it. See:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/gpio/gpio-event-mon.c

The current version of backend (I am working on) will be Linux
userspace based, so I would be required to get an interrupt there.

I was planning to use /dev/gpiochipN only for now and not a sysfs
file, so yes it should be fine.

--
viresh