Skip to content

Commit 016958b

Browse files
mripardsashalevin
authored andcommitted
irqchip: armada-370-xp: Fix chained per-cpu interrupts
[ Upstream commit 5724be8 ] On the Cortex-A9-based Armada SoCs, the MPIC is not the primary interrupt controller. Yet, it still has to handle some per-cpu interrupt. To do so, it is chained with the GIC using a per-cpu interrupt. However, the current code only call irq_set_chained_handler, which is called and enable that interrupt only on the boot CPU, which means that the parent per-CPU interrupt is never unmasked on the secondary CPUs, preventing the per-CPU interrupt to actually work as expected. This was not seen until now since the only MPIC PPI users were the Marvell timers that were not working, but not used either since the system use the ARM TWD by default, and the ethernet controllers, that are faking there interrupts as SPI, and don't really expect to have interrupts on the secondary cores anyway. Add a CPU notifier that will enable the PPI on the secondary cores when they are brought up. Cc: <stable@vger.kernel.org> # 3.15+ Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Link: https://lkml.kernel.org/r/1425378443-28822-1-git-send-email-maxime.ripard@free-electrons.com Signed-off-by: Jason Cooper <jason@lakedaemon.net> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
1 parent a10f289 commit 016958b

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

‎drivers/irqchip/irq-armada-370-xp.c‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
static void __iomem *per_cpu_int_base;
6868
static void __iomem *main_int_base;
6969
static struct irq_domain *armada_370_xp_mpic_domain;
70+
static int parent_irq;
7071
#ifdef CONFIG_PCI_MSI
7172
static struct irq_domain *armada_370_xp_msi_domain;
7273
static DECLARE_BITMAP(msi_used, PCI_MSI_DOORBELL_NR);
@@ -354,6 +355,7 @@ static int armada_xp_mpic_secondary_init(struct notifier_block *nfb,
354355
{
355356
if (action == CPU_STARTING || action == CPU_STARTING_FROZEN)
356357
armada_xp_mpic_smp_cpu_init();
358+
357359
return NOTIFY_OK;
358360
}
359361

@@ -362,6 +364,20 @@ static struct notifier_block armada_370_xp_mpic_cpu_notifier = {
362364
.priority = 100,
363365
};
364366

367+
static int mpic_cascaded_secondary_init(struct notifier_block *nfb,
368+
unsigned long action, void *hcpu)
369+
{
370+
if (action == CPU_STARTING || action == CPU_STARTING_FROZEN)
371+
enable_percpu_irq(parent_irq, IRQ_TYPE_NONE);
372+
373+
return NOTIFY_OK;
374+
}
375+
376+
static struct notifier_block mpic_cascaded_cpu_notifier = {
377+
.notifier_call = mpic_cascaded_secondary_init,
378+
.priority = 100,
379+
};
380+
365381
#endif /* CONFIG_SMP */
366382

367383
static struct irq_domain_ops armada_370_xp_mpic_irq_ops = {
@@ -489,7 +505,7 @@ static int __init armada_370_xp_mpic_of_init(struct device_node *node,
489505
struct device_node *parent)
490506
{
491507
struct resource main_int_res, per_cpu_int_res;
492-
int parent_irq, nr_irqs, i;
508+
int nr_irqs, i;
493509
u32 control;
494510

495511
BUG_ON(of_address_to_resource(node, 0, &main_int_res));
@@ -537,6 +553,9 @@ static int __init armada_370_xp_mpic_of_init(struct device_node *node,
537553
register_cpu_notifier(&armada_370_xp_mpic_cpu_notifier);
538554
#endif
539555
} else {
556+
#ifdef CONFIG_SMP
557+
register_cpu_notifier(&mpic_cascaded_cpu_notifier);
558+
#endif
540559
irq_set_chained_handler(parent_irq,
541560
armada_370_xp_mpic_handle_cascade_irq);
542561
}

0 commit comments

Comments
 (0)