On Thu, Jul 23, 2015 at 3:52 PM, Florian Fainelli <f.fainelli@xxxxxxxxx> wrote: > Our irq-bcm7120-l2 interrupt controller driver utilizes the same handler > function for the different parent interrupts it services: UPG_MAIN, UPG_BSC for > instance. > > The problem is that function reads the IRQSTAT register which can combine > interrupt causes for different parent interrupts, such that we can end-up in > the following situation: > > - CPU takes an interrupt > - bcm7120_l2_intc_irq_handle() reads IRQSTAT > - generic_handle_irq() is invoked > - there are still pending interrupts flagged in IRQSTAT from a different parent > - handle_bad_irq() is invoked for these since they come from a different irq_desc/irq > > In order to fix this, make sure that we always mask IRQSTAT with the > appropriate bits that correspond go the parent interrupt source this is coming > from. To simplify things, associate an unique structure per parent interrupt > handler to avoid multiplying the number of lookups. > > Fixes: a5042de2688d ("irqchip: bcm7120-l2: Add Broadcom BCM7120-style Level 2 interrupt controller") > Signed-off-by: Florian Fainelli <f.fainelli@xxxxxxxxx> Acked-by: Gregory Fong <gregory.0xf0@xxxxxxxxx> > --- > drivers/irqchip/irq-bcm7120-l2.c | 51 ++++++++++++++++++++++++++++++---------- > 1 file changed, 39 insertions(+), 12 deletions(-) > > diff --git a/drivers/irqchip/irq-bcm7120-l2.c b/drivers/irqchip/irq-bcm7120-l2.c > index 3ba5cc780fcb..8302d45d13ac 100644 > --- a/drivers/irqchip/irq-bcm7120-l2.c > +++ b/drivers/irqchip/irq-bcm7120-l2.c > @@ -47,14 +47,20 @@ struct bcm7120_l2_intc_data { > struct irq_domain *domain; > bool can_wake; > u32 irq_fwd_mask[MAX_WORDS]; > - u32 irq_map_mask[MAX_WORDS]; > + struct bcm7120_l1_intc_data *l1_data; > int num_parent_irqs; > const __be32 *map_mask_prop; > }; > > +struct bcm7120_l1_intc_data { > + struct bcm7120_l2_intc_data *b; > + u32 irq_map_mask[MAX_WORDS]; > +}; I'm not sure the name bcm7120_l1_intc_data is a good name for this, but I can't think of a better one, and it really doesn't matter that much.