From: sebastian.hesselbarth@gmail.com (Sebastian Hesselbarth)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] irqchip: orion: clear stale interrupts in irq_enable
Date: Fri, 24 Jan 2014 00:05:12 +0100 [thread overview]
Message-ID: <52E1A028.6020309@gmail.com> (raw)
In-Reply-To: <20140123225208.GA24778@obsidianresearch.com>
On 01/23/2014 11:52 PM, Jason Gunthorpe wrote:
> On Thu, Jan 23, 2014 at 11:38:06PM +0100, Sebastian Hesselbarth wrote:
>> Bridge IRQ_CAUSE bits are asserted regardless of the corresponding bit in
>> IRQ_MASK register. To avoid interrupt events on stale irqs, we have to clear
>> them before unmask. This installs an .irq_enable callback to ensure stale
>> irqs are cleared before initial unmask.
>
> I'm not sure if putting this in irq_enable is correct. I think this
> should only happen at irq_startup.
>
> The question boils down to what is supposed to happen with this code
> sequence:
>
> disable_irq(..);
> write(.. something to cause an interrupt edge ..);
> .. synchronize ..
> enable_irq(..);
>
> Do we get the interrupt or not?
Jason,
I get the point and actually I'd chosen .irq_enable because using
.irq_startup didn't work. I rechecked this and now it works.. maybe
it is getting too late for me. I'll send a v2 of this patch shortly.
Sebastian
> I found this message from Linus long ago:
> http://yarchive.net/comp/linux/edge_triggered_interrupts.html
>> Btw, the "disable_irq()/enable_irq()" subsystem has been written so that
>> when you disable an edge-triggered interrupt, and the edge happens while
>> the interrupt is disabled, we will re-play the interrupt at enable time.
>> Exactly so that drivers can have an easier time and don't have to
>> normally worry about whether something is edge or level-triggered.
>
> And found this note in Documentation/DocBook/genericirq.tmpl:
>
>> This prevents losing edge interrupts on hardware which does
>> not store an edge interrupt event while the interrupt is disabled at
>> the hardware level.
>
> So I think it is very clear that the chip driver should not discard
> edges that happened while the interrupt was disabled.
>
> Regards,
> Jason
>
WARNING: multiple messages have this Message-ID (diff)
From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
To: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Jason Cooper <jason@lakedaemon.net>, Andrew Lunn <andrew@lunn.ch>,
Gregory Clement <gregory.clement@free-electrons.com>,
Ezequiel Garcia <ezequiel.garcia@free-electrons.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] irqchip: orion: clear stale interrupts in irq_enable
Date: Fri, 24 Jan 2014 00:05:12 +0100 [thread overview]
Message-ID: <52E1A028.6020309@gmail.com> (raw)
In-Reply-To: <20140123225208.GA24778@obsidianresearch.com>
On 01/23/2014 11:52 PM, Jason Gunthorpe wrote:
> On Thu, Jan 23, 2014 at 11:38:06PM +0100, Sebastian Hesselbarth wrote:
>> Bridge IRQ_CAUSE bits are asserted regardless of the corresponding bit in
>> IRQ_MASK register. To avoid interrupt events on stale irqs, we have to clear
>> them before unmask. This installs an .irq_enable callback to ensure stale
>> irqs are cleared before initial unmask.
>
> I'm not sure if putting this in irq_enable is correct. I think this
> should only happen at irq_startup.
>
> The question boils down to what is supposed to happen with this code
> sequence:
>
> disable_irq(..);
> write(.. something to cause an interrupt edge ..);
> .. synchronize ..
> enable_irq(..);
>
> Do we get the interrupt or not?
Jason,
I get the point and actually I'd chosen .irq_enable because using
.irq_startup didn't work. I rechecked this and now it works.. maybe
it is getting too late for me. I'll send a v2 of this patch shortly.
Sebastian
> I found this message from Linus long ago:
> http://yarchive.net/comp/linux/edge_triggered_interrupts.html
>> Btw, the "disable_irq()/enable_irq()" subsystem has been written so that
>> when you disable an edge-triggered interrupt, and the edge happens while
>> the interrupt is disabled, we will re-play the interrupt at enable time.
>> Exactly so that drivers can have an easier time and don't have to
>> normally worry about whether something is edge or level-triggered.
>
> And found this note in Documentation/DocBook/genericirq.tmpl:
>
>> This prevents losing edge interrupts on hardware which does
>> not store an edge interrupt event while the interrupt is disabled at
>> the hardware level.
>
> So I think it is very clear that the chip driver should not discard
> edges that happened while the interrupt was disabled.
>
> Regards,
> Jason
>
next prev parent reply other threads:[~2014-01-23 23:05 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-23 22:38 [PATCH 0/3] irqchip: orion: bridge irq fixes for v3.14-rc1 Sebastian Hesselbarth
2014-01-23 22:38 ` Sebastian Hesselbarth
2014-01-23 22:38 ` [PATCH 1/3] irqchip: orion: clear bridge cause register on init Sebastian Hesselbarth
2014-01-23 22:38 ` Sebastian Hesselbarth
2014-01-24 21:41 ` Ezequiel Garcia
2014-01-24 21:41 ` Ezequiel Garcia
2014-01-23 22:38 ` [PATCH 2/3] irqchip: orion: use handle_edge_irq on bridge irqs Sebastian Hesselbarth
2014-01-23 22:38 ` Sebastian Hesselbarth
2014-01-23 22:38 ` [PATCH 3/3] irqchip: orion: clear stale interrupts in irq_enable Sebastian Hesselbarth
2014-01-23 22:38 ` Sebastian Hesselbarth
2014-01-23 22:52 ` Jason Gunthorpe
2014-01-23 22:52 ` Jason Gunthorpe
2014-01-23 23:05 ` Sebastian Hesselbarth [this message]
2014-01-23 23:05 ` Sebastian Hesselbarth
2014-01-24 10:55 ` Russell King - ARM Linux
2014-01-24 10:55 ` Russell King - ARM Linux
2014-01-23 23:10 ` [PATCH v2 3/3] irqchip: orion: clear stale interrupts in irq_startup Sebastian Hesselbarth
2014-01-23 23:10 ` Sebastian Hesselbarth
2014-02-05 4:54 ` [PATCH 0/3] irqchip: orion: bridge irq fixes for v3.14-rc1 Jason Cooper
2014-02-05 4:54 ` Jason Cooper
2014-02-06 17:10 ` Ezequiel Garcia
2014-02-06 17:10 ` Ezequiel Garcia
2014-02-06 18:05 ` Jason Cooper
2014-02-06 18:05 ` Jason Cooper
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=52E1A028.6020309@gmail.com \
--to=sebastian.hesselbarth@gmail.com \
--cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.