mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Magnus Damm" <magnus.damm@gmail.com>
To: "Alan Cox" <alan@lxorguk.ukuu.org.uk>
Cc: linux-kernel@vger.kernel.org, Uwe.Kleine-Koenig@digi.com,
	gregkh@suse.de, akpm@linux-foundation.org, hjk@linutronix.de,
	lethal@linux-sh.org, tglx@linutronix.de
Subject: Re: [PATCH] uio: User IRQ Mode
Date: Thu, 3 Jul 2008 19:23:34 +0900	[thread overview]
Message-ID: <aec7e5c30807030323y51cffd78x6ea1727796e90b62@mail.gmail.com> (raw)
In-Reply-To: <20080702121153.4d464885@lxorguk.ukuu.org.uk>

Hi again Alan,

On Wed, Jul 2, 2008 at 8:11 PM, Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
> On Wed, 02 Jul 2008 19:59:51 +0900
> Magnus Damm <magnus.damm@gmail.com> wrote:
>
>> From: Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
>>
>> This patch adds a "User IRQ Mode" to UIO. In this mode the user space driver
>> is responsible for acknowledging and re-enabling the interrupt.
>> Shared interrupts are not supported by this mode.
>
> This doesn't work even for some non shared interrupts.
>
> If I take a level triggered interrupt then the IRQ handler code must
> clear the IRQ before the line can be unmasked.
>
> It might work for edge triggered providing you don't get too many edges
> before you respond (in which case we will decide its a stuck IRQ and turn
> it off for good).

Below is a little description of how this is supposed to work, see
point 5, 8, 9.

--- Regular in-kernel driver approach ---

1. hardware device signals the processor
   -> interrupt signal to interrupt controller gets asserted

2. interrupt controller passes through interrupt signal
   the source is enabled so the interrupt controller does not mask
   -> interrupt signal to processor gets asserted

3. processor saves context and starts executing kernel interrupt code
   the processor will mask interrupts for this certain interrupt level

4. mask_ack_irq()
   this modifies the state of the interrupt controller
   -> interrupt signal to processor is no longer asserted

5. kernel interrupt handler acknowledges interrupt
   this modifies the state of the hardware device
   -> interrupt signal to interrupt controller is no longer asserted

6. unmask_irq() - unmask interrupt controller
   this modifies the state of the interrupt controller
   -> interrupt signal to processor is let through, but is no longer asserted

7. processor restores context
   this will unmask interrupts for the current interrupt level

--- UIO "User IRQ Mode" approach ---

1. hardware device signals the processor
   -> interrupt signal to interrupt controller gets asserted

2. interrupt controller passes through interrupt signal
   the source is enabled so the interrupt controller does not mask
   -> interrupt signal to processor gets asserted

3. processor saves context and starts executing kernel interrupt code
   the processor will mask interrupts for this certain interrupt level

4. mask_ack_irq()
   this modifies the state of the interrupt controller
   -> interrupt signal to processor is no longer asserted

5. kernel interrupt handler _disables_ interrupts, notifies user space
   this may modify the state of the interrupt controller
   -> interrupt signal from device to interrupt controller is still asserted
   -> interrupt source is still masked by interrupt controller

6. unmask_irq() - unmask interrupt controller
   this may modify the sate of the interrupt controller
   -> interrupt source is still masked by interrupt controller

7. processor restores context
   this will unmask interrupts for the current interrupt level
   -> interrupt signal from device to interrupt controller is still asserted
   -> interrupt source is still masked by interrupt controller

8. user space driver get scheduled, acknowledges interrupt
   this modifies the state of the hardware device
   -> interrupt signal from device to interrupt controller gets deasserted
   -> interrupt source is still masked by interrupt controller

9. user space driver uses write() to re-enable the interrupt
   this modifies the state of the interrupt controller
   -> interrupt source is no longer masked by interrupt controller

Hope this clarifies a bit. Thank for your feedback!

/ magnus

  parent reply	other threads:[~2008-07-03 12:14 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-02 10:59 Magnus Damm
2008-07-02 11:11 ` Alan Cox
2008-07-02 11:42   ` Uwe Kleine-König
2008-07-02 11:31     ` Alan Cox
2008-07-03  5:11       ` Magnus Damm
2008-07-03 10:23   ` Magnus Damm [this message]
2008-07-02 12:54 ` Hans J. Koch
2008-07-03  7:10   ` Uwe Kleine-König
2008-07-03 12:45     ` Hans J. Koch
2008-07-03 13:23       ` Paul Mundt
2008-07-03 19:55         ` Hans J. Koch
2008-07-04  2:55           ` Magnus Damm
2008-07-04 12:44             ` Hans J. Koch
2008-07-04  4:03       ` Magnus Damm
2008-07-04  6:01         ` Uwe Kleine-König
2008-07-04  7:48           ` Magnus Damm
2008-07-04  8:11             ` Uwe Kleine-König
2008-07-04  8:29               ` Paul Mundt
2008-07-04 13:39                 ` Hans J. Koch
2008-07-04  8:16           ` Alan Cox
2008-07-04 13:32           ` Hans J. Koch
2008-07-04 13:26         ` Hans J. Koch
2008-07-04 22:51           ` Magnus Damm

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=aec7e5c30807030323y51cffd78x6ea1727796e90b62@mail.gmail.com \
    --to=magnus.damm@gmail.com \
    --cc=Uwe.Kleine-Koenig@digi.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=gregkh@suse.de \
    --cc=hjk@linutronix.de \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®