From: jamie@jamieiles.com (Jamie Iles)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv2 02/10] ARM: vic: MULTI_IRQ_HANDLER handler
Date: Thu, 3 Nov 2011 15:03:37 +0000 [thread overview]
Message-ID: <20111103150337.GC5008@totoro> (raw)
In-Reply-To: <20111103133102.GM12913@n2100.arm.linux.org.uk>
On Thu, Nov 03, 2011 at 01:31:02PM +0000, Russell King - ARM Linux wrote:
> On Thu, Nov 03, 2011 at 02:00:15PM +0100, Linus Walleij wrote:
> > On Thu, Nov 3, 2011 at 1:51 PM, Russell King - ARM Linux
> > <linux@arm.linux.org.uk> wrote:
> >
> > > ? ? ? ?stat = readl_relaxed(vic->base + VIC_IRQ_STATUS);
> > > ? ? ? ?while (stat) {
> > > ? ? ? ? ? ? ? ?while (stat) {
> > > ? ? ? ? ? ? ? ? ? ? ? ?irq = ffs(stat) - 1;
> > > ? ? ? ? ? ? ? ? ? ? ? ?stat &= ~(1 << irq);
> > > ? ? ? ? ? ? ? ? ? ? ? ?handle_irq(irq);
> > > ? ? ? ? ? ? ? ?}
> > > ? ? ? ? ? ? ? ?stat = readl_relaxed(vic->base + VIC_IRQ_STATUS);
> > > ? ? ? ?}
> > >
> > > This ensures that we process all interrupts found pending before we
> > > re-check for any new interrupts pending. ?Arguably this is a much
> > > fairer implementation (and may mean if things get irrevokably stuck,
> > > things like sysrq via the console uart may still work.)
> >
> > I really like the looks of this, Jamie can you do it like that?
> >
> > Maybe some smallish comment about what's going on can be
> > good for future generations reading that code...
>
> Bear in mind that it gets a little more complex when you have more
> than one VIC, because the outer loop should be across all VICs.
OK, so I think what I posted yesterday does that (updated for slightly
better naming) and with a description. In the spirit of fairness
iterating over the VIC's this way seemed right to me.
/*
* Handle each interrupt in a single VIC. Returns non-zero if we've
* handled at least one interrupt. This does a single read of the
* status register and handles all interrupts in order from LSB first.
*/
static int handle_one_vic(struct vic_device *vic,
struct pt_regs *regs)
{
u32 stat, irq;
int handled = 0;
stat = readl_relaxed(vic->base + VIC_IRQ_STATUS);
while (stat) {
irq = ffs(stat) - 1;
handle_IRQ(irq_domain_to_irq(&vic->domain, irq), regs);
stat &= ~(1 << irq);
handled = 1;
}
return handled;
}
/*
* Keep iterating over all registered VIC's until there are no pending
* interrupts.
*/
asmlinkage void __exception_irq_entry vic_handle_irq(struct pt_regs *regs)
{
int i, handled;
do {
for (i = 0, handled = 0; i < vic_id; ++i)
handled |= vic_single_handle_irq(&vic_devices[i],
regs))
} while (handled);
}
Jamie
WARNING: multiple messages have this Message-ID (diff)
From: Jamie Iles <jamie@jamieiles.com>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: kgene.kim@samsung.com, linus.walleij@stericsson.com,
Linus Walleij <linus.walleij@linaro.org>,
rob.herring@calxeda.com, Grant Likely <grant.likely@secretlab.ca>,
hsweeten@visionengravers.com, rajeev-dlh.kumar@st.com,
ben-linux@fluff.org, STEricsson_nomadik_linux@list.st.com,
Jamie Iles <jamie@jamieiles.com>,
rubini@unipv.it, devicetree-discuss@lists.ozlabs.org,
linux-arm-kernel@lists.infradead.org, rmallon@gmail.com
Subject: Re: [PATCHv2 02/10] ARM: vic: MULTI_IRQ_HANDLER handler
Date: Thu, 3 Nov 2011 15:03:37 +0000 [thread overview]
Message-ID: <20111103150337.GC5008@totoro> (raw)
In-Reply-To: <20111103133102.GM12913@n2100.arm.linux.org.uk>
On Thu, Nov 03, 2011 at 01:31:02PM +0000, Russell King - ARM Linux wrote:
> On Thu, Nov 03, 2011 at 02:00:15PM +0100, Linus Walleij wrote:
> > On Thu, Nov 3, 2011 at 1:51 PM, Russell King - ARM Linux
> > <linux@arm.linux.org.uk> wrote:
> >
> > > stat = readl_relaxed(vic->base + VIC_IRQ_STATUS);
> > > while (stat) {
> > > while (stat) {
> > > irq = ffs(stat) - 1;
> > > stat &= ~(1 << irq);
> > > handle_irq(irq);
> > > }
> > > stat = readl_relaxed(vic->base + VIC_IRQ_STATUS);
> > > }
> > >
> > > This ensures that we process all interrupts found pending before we
> > > re-check for any new interrupts pending. Arguably this is a much
> > > fairer implementation (and may mean if things get irrevokably stuck,
> > > things like sysrq via the console uart may still work.)
> >
> > I really like the looks of this, Jamie can you do it like that?
> >
> > Maybe some smallish comment about what's going on can be
> > good for future generations reading that code...
>
> Bear in mind that it gets a little more complex when you have more
> than one VIC, because the outer loop should be across all VICs.
OK, so I think what I posted yesterday does that (updated for slightly
better naming) and with a description. In the spirit of fairness
iterating over the VIC's this way seemed right to me.
/*
* Handle each interrupt in a single VIC. Returns non-zero if we've
* handled at least one interrupt. This does a single read of the
* status register and handles all interrupts in order from LSB first.
*/
static int handle_one_vic(struct vic_device *vic,
struct pt_regs *regs)
{
u32 stat, irq;
int handled = 0;
stat = readl_relaxed(vic->base + VIC_IRQ_STATUS);
while (stat) {
irq = ffs(stat) - 1;
handle_IRQ(irq_domain_to_irq(&vic->domain, irq), regs);
stat &= ~(1 << irq);
handled = 1;
}
return handled;
}
/*
* Keep iterating over all registered VIC's until there are no pending
* interrupts.
*/
asmlinkage void __exception_irq_entry vic_handle_irq(struct pt_regs *regs)
{
int i, handled;
do {
for (i = 0, handled = 0; i < vic_id; ++i)
handled |= vic_single_handle_irq(&vic_devices[i],
regs))
} while (handled);
}
Jamie
next prev parent reply other threads:[~2011-11-03 15:03 UTC|newest]
Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-28 10:41 [PATCHv2 00/10] VIC DT binding and MULTI_IRQ_HANDLER Jamie Iles
2011-09-28 10:41 ` Jamie Iles
2011-09-28 10:41 ` [PATCHv2 01/10] ARM: vic: device tree binding Jamie Iles
2011-09-28 10:41 ` Jamie Iles
2011-09-28 20:11 ` Grant Likely
2011-09-28 20:11 ` Grant Likely
2011-09-29 4:00 ` Rob Herring
2011-09-29 4:00 ` Rob Herring
2011-09-28 10:41 ` [PATCHv2 02/10] ARM: vic: MULTI_IRQ_HANDLER handler Jamie Iles
2011-09-28 10:41 ` Jamie Iles
2011-09-28 11:09 ` Linus Walleij
2011-09-28 11:09 ` Linus Walleij
2011-09-28 12:08 ` Jamie Iles
2011-09-28 12:08 ` Jamie Iles
2011-09-28 20:39 ` Grant Likely
2011-09-28 20:39 ` Grant Likely
2011-09-29 6:55 ` Linus Walleij
2011-09-29 6:55 ` Linus Walleij
2011-09-29 9:30 ` Jamie Iles
2011-09-29 9:30 ` Jamie Iles
2011-09-29 16:55 ` Grant Likely
2011-09-29 16:55 ` Grant Likely
2011-11-02 13:40 ` Russell King - ARM Linux
2011-11-02 13:40 ` Russell King - ARM Linux
2011-11-02 14:08 ` Jamie Iles
2011-11-02 14:08 ` Jamie Iles
2011-11-03 12:29 ` Linus Walleij
2011-11-03 12:29 ` Linus Walleij
2011-11-03 12:51 ` Russell King - ARM Linux
2011-11-03 12:51 ` Russell King - ARM Linux
2011-11-03 13:00 ` Linus Walleij
2011-11-03 13:00 ` Linus Walleij
2011-11-03 13:04 ` Jamie Iles
2011-11-03 13:04 ` Jamie Iles
2011-11-03 13:31 ` Russell King - ARM Linux
2011-11-03 13:31 ` Russell King - ARM Linux
2011-11-03 15:03 ` Jamie Iles [this message]
2011-11-03 15:03 ` Jamie Iles
2011-11-03 15:11 ` Russell King - ARM Linux
2011-11-03 15:11 ` Russell King - ARM Linux
2011-11-03 13:49 ` Nicolas Pitre
2011-11-03 13:49 ` Nicolas Pitre
2011-09-29 15:03 ` Zoltan Devai
2011-09-29 15:03 ` Zoltan Devai
2011-09-29 15:13 ` Jamie Iles
2011-09-29 15:13 ` Jamie Iles
2011-09-28 10:41 ` [PATCHv2 03/10] ARM: ep93xx: convert to MULTI_IRQ_HANDLER Jamie Iles
2011-09-28 10:41 ` Jamie Iles
2011-09-28 11:15 ` Linus Walleij
2011-09-28 11:15 ` Linus Walleij
2011-09-28 10:41 ` [PATCHv2 04/10] ARM: netx: " Jamie Iles
2011-09-28 10:41 ` Jamie Iles
2011-09-28 10:41 ` [PATCHv2 05/10] ARM: nomadik: " Jamie Iles
2011-09-28 10:41 ` Jamie Iles
2011-09-28 11:12 ` Linus Walleij
2011-09-28 11:12 ` Linus Walleij
2011-09-28 10:41 ` [PATCHv2 06/10] ARM: s3c64xx: " Jamie Iles
2011-09-28 10:41 ` Jamie Iles
2011-09-28 10:41 ` [PATCHv2 07/10] ARM: spear: " Jamie Iles
2011-09-28 10:41 ` Jamie Iles
2011-09-28 10:41 ` [PATCHv2 08/10] ARM: u300: " Jamie Iles
2011-09-28 10:41 ` Jamie Iles
2011-09-28 11:03 ` Linus Walleij
2011-09-28 11:03 ` Linus Walleij
2011-09-28 12:03 ` Jamie Iles
2011-09-28 12:03 ` Jamie Iles
2011-09-28 12:18 ` Linus Walleij
2011-09-28 12:18 ` Linus Walleij
2011-09-28 12:29 ` Jamie Iles
2011-09-28 12:29 ` Jamie Iles
2011-09-28 10:41 ` [PATCHv2 09/10] ARM: versatile: " Jamie Iles
2011-09-28 10:41 ` Jamie Iles
2011-09-28 10:41 ` [PATCHv2 10/10] ARM: samsung: " Jamie Iles
2011-09-28 10:41 ` Jamie Iles
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=20111103150337.GC5008@totoro \
--to=jamie@jamieiles.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.