[PATCHv2 02/10] ARM: vic: MULTI_IRQ_HANDLER handler

Jamie Iles jamie at jamieiles.com
Wed Sep 28 22:08:32 EST 2011


Hi Linus,

On Wed, Sep 28, 2011 at 01:09:48PM +0200, Linus Walleij wrote:
> On Wed, Sep 28, 2011 at 12:41 PM, Jamie Iles <jamie at jamieiles.com> wrote:
> 
> > +static void vic_single_handle_irq(struct vic_device *vic, struct pt_regs *regs)
> > +{
> > +       u32 stat, irq;
> > +       bool handled = false;
> > +
> > +       while (!handled) {
> > +               stat = readl_relaxed(vic->base + VIC_IRQ_STATUS);
> > +               if (!stat)
> > +                       break;
> > +
> > +               while (stat) {
> > +                       irq = fls(stat) - 1;
> 
> Isn't fls "find last set"?
> 
> That means IRQs with higher numbers will be handled first will it not?
> 
> For U300 IRQs with lower numbers will be handled first
> by iteratively testing bit 0 and shifting right:
> 
> -1002:  tst     \irqstat, #1
> -       bne     1003f
> -       add     \irqnr, \irqnr, #1
> -       movs    \irqstat, \irqstat, lsr #1
> -       bne     1002b
> 
> So I would use ffs() for this to work the same way as before in
> U300.
> 
> Since this can have some performance impact, if the platforms differ
> in whether they handle IRQs from low to high or from high to low
> might need to be a flag passed in to vic_init() or so...

I don't know how important the ordering is, but if it is important then 
we could have vic_handle_irq_msb_first() and vic_handle_irq_lsb_first() 
as the handlers so there isn't any additional indirection/selection in 
the interrupt hot-path.

Jamie


More information about the devicetree-discuss mailing list