public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Hans J. Koch" <hjk@linutronix.de>
To: linux-kernel@vger.kernel.org
Cc: "Greg Kroah-Hartman" <gregkh@suse.de>,
	"Jan Altenberg" <jan.altenberg@linutronix.de>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Uwe Kleine-König" <Uwe.Kleine-Koenig@digi.com>,
	"Magnus Damm" <magnus.damm@gmail.com>
Subject: [PATCH 0/1] UIO: Add a write() function to enable/disable interrupts
Date: Thu, 22 May 2008 21:22:52 +0200	[thread overview]
Message-ID: <20080522192252.GB3226@local> (raw)

At the moment, I've got two examples of hardware where the UIO interrupt
handling has problems:

1) A PCI card with several internal interrupt sources that can activate
the single IRQ line of the card. The card's PCI bridge has an irq
acknowledge register that can be mapped to userspace, but setting a bit
in it would be a read-modify-write operation which is racy from
userspace.

2) An FPGA that has several internal interrupt sources OR'ed to one
interrupt line that is connected to a GPIO of an ARM processor. The chip
only has a single IRQ register where different bits show the status of
the different interrupt sources. To acknowledge an IRQ, I have to clear
the respective bit, which would leave the userspace part of the driver
with a cleared register, unable to determine the source of the
interrupt. My only chance is to disable the GPIO interrupt, but this
leads to the problem that userspace cannot turn it on again.

The patch that I'll send in response to this mail solves these problems by
adding a write() function for /dev/uioX. Userspace can write a 32-bit
int value to /dev/uioX. This value will usually be 0 or 1 to disable or
enable the device's interrupts. The kernel part of the driver can
implement an irqcontrol() hook that is called by the UIO core.

Magnus Damm also ran into this problem when developing a generic UIO
platform handler and came up with a different solution:

http://lkml.org/lkml/2008/5/21/60

However, extending the UIO specs by adding a write function seems to be
a more generic approach. It allows enabling _and_ disabling of
interrupts. For devices that don't need this functionality, nothing
changes. They can simply ignore the new irqcontrol() pointer, and UIO
behaves as it always did. My patch is completely compatible with
existing UIO drivers, no changes to drivers are required.

Thanks to Jan Altenberg for testing this, and to Magnus Damm for telling
me that I'm not the only one who has these problems ;-)

Thanks,
Hans


             reply	other threads:[~2008-05-22 19:23 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-22 19:22 Hans J. Koch [this message]
2008-05-22 19:26 ` [PATCH 1/1] UIO: Add a write() function to enable/disable interrupts Hans J. Koch
2008-05-22 19:47   ` Tom Spink
2008-05-22 20:08     ` Hans J. Koch
2008-05-22 20:26       ` Tom Spink
2008-05-23  5:41         ` Uwe Kleine-König
2008-05-23  8:51           ` Hans J. Koch
2008-05-23 11:48           ` Tom Spink
2008-05-23 11:58             ` Uwe Kleine-König
2008-05-23 12:00               ` Tom Spink
2008-05-23 12:14                 ` Hans J. Koch
2008-05-23 12:20                   ` Tom Spink
2008-05-23 13:01                     ` Hans J. Koch
2008-05-23  5:55   ` Uwe Kleine-König
2008-05-23  8:44     ` Hans J. Koch
2008-05-23  9:10       ` Uwe Kleine-König
2008-05-23 10:03         ` Hans J. Koch
2008-05-23 10:56           ` Uwe Kleine-König
2008-05-23 11:55             ` Hans J. Koch
2008-05-23 12:03               ` Uwe Kleine-König
2008-05-23 18:36               ` Randy Dunlap
2008-05-23 22:49                 ` Hans-Jürgen Koch
2008-06-04  6:30                   ` Uwe Kleine-König
2008-06-04  7:05                     ` Thomas Gleixner
2008-05-23 20:44               ` Leon Woestenberg
2008-05-23 22:43                 ` Hans J. Koch
2008-05-24  0:02                   ` Leon Woestenberg
2008-05-24  4:43               ` Greg KH
2008-05-24 22:20                 ` Hans J. Koch
2008-05-24 22:22                 ` Thomas Gleixner
2008-05-24 22:34                   ` Tom Spink
2008-05-24 22:46                     ` Thomas Gleixner
2008-05-24 23:00                       ` Tom Spink
2008-05-27 17:55                   ` Greg KH

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=20080522192252.GB3226@local \
    --to=hjk@linutronix.de \
    --cc=Uwe.Kleine-Koenig@digi.com \
    --cc=gregkh@suse.de \
    --cc=jan.altenberg@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=tglx@linutronix.de \
    /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