aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/irqchip
diff options
context:
space:
mode:
authorGrzegorz Jaszczyk <jaz@semihalf.com>2014-09-25 07:17:19 -0400
committerJason Cooper <jason@lakedaemon.net>2014-11-01 21:31:10 -0400
commit758e8366754d3fa57da978fef9d2c652f7b55c02 (patch)
tree9ef9ea237bac7ce06e1e472905d128b72a0d8bf5 /drivers/irqchip
parent298dcb2dd0267d51e4f7c94a628cd0765a50ad75 (diff)
irqchip: armada-370-xp: Fix MPIC interrupt handling
In both Armada-375 and Armada-38x MPIC interrupts should be identified by reading cause register multiplied by the interrupt mask. A lack of above mentioned multiplication resulted in a bug, caused by the fact that in Armada-375 and Armada-38x some of the interrupts (e.g. network interrupts) can be handled either as a GIC or MPIC interrupts. Therefore during MPIC interrupts handling, cause register shows hits from interrupts even if they are masked for MPIC but unmasked for a GIC. This resulted in 'bad IRQ' error, because masked MPIC interrupt without registered interrupt handler, was trying to be handled during interrupt handling procedure of some other unmasked MPIC interrupt (e.g. local timer irq). This commit fixes that by ensuring that during MPIC interrupt handling only interrupts that are unmasked for MPIC are processed. Signed-off-by: Grzegorz Jaszczyk <jaz@semihalf.com> Reviewed-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Fixes: bc69b8adfe22 ("irqchip: armada-370-xp: Setup a chained handler for the MPIC") Cc: <stable@vger.kernel.org> # v3.15+ Acked-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> Link: https://lkml.kernel.org/r/1411643839-64925-3-git-send-email-jaz@semihalf.com Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Diffstat (limited to 'drivers/irqchip')
-rw-r--r--drivers/irqchip/irq-armada-370-xp.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 2f01073d6201..6a2e168c3ab0 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -43,6 +43,7 @@
43#define ARMADA_370_XP_INT_CLEAR_ENABLE_OFFS (0x34) 43#define ARMADA_370_XP_INT_CLEAR_ENABLE_OFFS (0x34)
44#define ARMADA_370_XP_INT_SOURCE_CTL(irq) (0x100 + irq*4) 44#define ARMADA_370_XP_INT_SOURCE_CTL(irq) (0x100 + irq*4)
45#define ARMADA_370_XP_INT_SOURCE_CPU_MASK 0xF 45#define ARMADA_370_XP_INT_SOURCE_CPU_MASK 0xF
46#define ARMADA_370_XP_INT_IRQ_FIQ_MASK(cpuid) ((BIT(0) | BIT(8)) << cpuid)
46 47
47#define ARMADA_370_XP_CPU_INTACK_OFFS (0x44) 48#define ARMADA_370_XP_CPU_INTACK_OFFS (0x44)
48#define ARMADA_375_PPI_CAUSE (0x10) 49#define ARMADA_375_PPI_CAUSE (0x10)
@@ -406,19 +407,29 @@ static void armada_370_xp_mpic_handle_cascade_irq(unsigned int irq,
406 struct irq_desc *desc) 407 struct irq_desc *desc)
407{ 408{
408 struct irq_chip *chip = irq_get_chip(irq); 409 struct irq_chip *chip = irq_get_chip(irq);
409 unsigned long irqmap, irqn; 410 unsigned long irqmap, irqn, irqsrc, cpuid;
410 unsigned int cascade_irq; 411 unsigned int cascade_irq;
411 412
412 chained_irq_enter(chip, desc); 413 chained_irq_enter(chip, desc);
413 414
414 irqmap = readl_relaxed(per_cpu_int_base + ARMADA_375_PPI_CAUSE); 415 irqmap = readl_relaxed(per_cpu_int_base + ARMADA_375_PPI_CAUSE);
415 416 cpuid = cpu_logical_map(smp_processor_id());
416 if (irqmap & BIT(1)) {
417 armada_370_xp_handle_msi_irq(NULL, true);
418 irqmap &= ~BIT(1);
419 }
420 417
421 for_each_set_bit(irqn, &irqmap, BITS_PER_LONG) { 418 for_each_set_bit(irqn, &irqmap, BITS_PER_LONG) {
419 irqsrc = readl_relaxed(main_int_base +
420 ARMADA_370_XP_INT_SOURCE_CTL(irqn));
421
422 /* Check if the interrupt is not masked on current CPU.
423 * Test IRQ (0-1) and FIQ (8-9) mask bits.
424 */
425 if (!(irqsrc & ARMADA_370_XP_INT_IRQ_FIQ_MASK(cpuid)))
426 continue;
427
428 if (irqn == 1) {
429 armada_370_xp_handle_msi_irq(NULL, true);
430 continue;
431 }
432
422 cascade_irq = irq_find_mapping(armada_370_xp_mpic_domain, irqn); 433 cascade_irq = irq_find_mapping(armada_370_xp_mpic_domain, irqn);
423 generic_handle_irq(cascade_irq); 434 generic_handle_irq(cascade_irq);
424 } 435 }