From mboxrd@z Thu Jan 1 00:00:00 1970 From: jamie@jamieiles.com (Jamie Iles) Date: Wed, 28 Sep 2011 13:08:32 +0100 Subject: [PATCHv2 02/10] ARM: vic: MULTI_IRQ_HANDLER handler In-Reply-To: References: <1317206507-18867-1-git-send-email-jamie@jamieiles.com> <1317206507-18867-3-git-send-email-jamie@jamieiles.com> Message-ID: <20110928120832.GI17204@pulham.picochip.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org 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 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