irqchip: Armada 370/XP MPIC as a slave controller
Subsystems (3)
cover irqchip: Armada 370/XP MPIC as a slave controller
The newly introduced Armada 375 and Armada 38x Marvell SoCs are based on Cortex-A9 CPU cores and use the ARM GIC as their main interrupt controller.
However, for various purposes (wake-up from suspend, MSI interrupts), the SoCs have a separate MPIC interrupt controller, acting as a slave to the GIC. This MPIC was already used as the primary controller on previous Marvell SoCs, so this commit extends the existing driver to allow the MPIC to be used as a GIC slave.
This series consists in two patches: the first one adds a helper function to handle MSI interrupts. The second patch implements a chained handler, which uses the previously introduced helper.
These patches apply cleanly on v3.14-rc1 plus:
36802fd irqchip: armada-370-xp: fix MSI race condition e1603bb irqchip: armada-370-xp: fix IPI race condition
Or simply on v3.14-rc2.
Ezequiel Garcia (2):
irqchip: armada-370-xp: Add helper for the MSI IRQ handling
irqchip: armada-370-xp: Setup a chained handler for the MPIC
.../devicetree/bindings/arm/armada-370-xp-mpic.txt | 8 +- drivers/irqchip/irq-armada-370-xp.c | 96 ++++++++++++++++------ 2 files changed, 76 insertions(+), 28 deletions(-)
Signature · 1 line
1.8.1.5
PATCH 1/2 irqchip: armada-370-xp: Add helper for the MSI IRQ handling
Introduce a helper function to handle the MSI interrupts. This makes the code more readable. In addition, this will allow to introduce a chained IRQ handler mechanism, which is needed in situations where the MPIC is used as a slave to another interrupt controller.
--- drivers/irqchip/irq-armada-370-xp.c | 54 ++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 24 deletions(-)
drivers/irqchip/irq-armada-370-xp.c +30 -24
@@ -352,6 +352,34 @@ static struct irq_domain_ops armada_370_xp_mpic_irq_ops = { .xlate = irq_domain_xlate_onecell, }; +#ifdef CONFIG_PCI_MSI +static void armada_370_xp_handle_msi_irq (struct pt_regs *regs) +{ +u32 msimask, msinr; + + msimask =readl_relaxed (per_cpu_int_base + +ARMADA_370_XP_IN_DRBEL_CAUSE_OFFS ) + &PCI_MSI_DOORBELL_MASK ; + +writel (~msimask, per_cpu_int_base + +ARMADA_370_XP_IN_DRBEL_CAUSE_OFFS ); + +for (msinr =PCI_MSI_DOORBELL_START ; + msinr <PCI_MSI_DOORBELL_END ; msinr++) { +int irq; + +if (!(msimask &BIT (msinr))) +continue ; + + irq =irq_find_mapping (armada_370_xp_msi_domain, + msinr -16 ); +handle_IRQ (irq, regs); + } +} +#else +static void armada_370_xp_handle_msi_irq (struct pt_regs *r) {} +#endif + static asmlinkage void __exception_irq_entryarmada_370_xp_handle_irq (struct pt_regs *regs) {
@@ -372,31 +400,9 @@ armada_370_xp_handle_irq(struct pt_regs *regs)continue ; } -#ifdef CONFIG_PCI_MSI /* MSI handling */ -if (irqnr ==1 ) { -u32 msimask, msinr; - - msimask =readl_relaxed (per_cpu_int_base + -ARMADA_370_XP_IN_DRBEL_CAUSE_OFFS ) - &PCI_MSI_DOORBELL_MASK ; - -writel (~msimask, per_cpu_int_base + -ARMADA_370_XP_IN_DRBEL_CAUSE_OFFS ); - -for (msinr =PCI_MSI_DOORBELL_START ; - msinr <PCI_MSI_DOORBELL_END ; msinr++) { -int irq; - -if (!(msimask &BIT (msinr))) -continue ; - - irq =irq_find_mapping (armada_370_xp_msi_domain, - msinr -16 ); -handle_IRQ (irq, regs); - } - } -#endif +if (irqnr ==1 ) +armada_370_xp_handle_msi_irq (regs);#ifdef CONFIG_SMP /* IPI Handling */
Signature · 1 line
1.8.1.5
PATCH 2/2 irqchip: armada-370-xp: Setup a chained handler for the MPIC
In reply to Ezequiel GarciaThe new Armada 375 and Armada 38x Marvell SoCs are based on Cortex-A9 CPU cores and use the ARM GIC as their main interrupt controller. However, for various purposes (wake-up from suspend, MSI interrupts), they have kept a separate MPIC interrupt controller, acting as a slave to the GIC. This MPIC was already used as the primary controller on previous Marvell SoCs, so this commit extends the existing driver to allow the MPIC to be used as a GIC slave.
--- .../devicetree/bindings/arm/armada-370-xp-mpic.txt | 8 +++- drivers/irqchip/irq-armada-370-xp.c | 50 +++++++++++++++++++--- 2 files changed, 50 insertions(+), 8 deletions(-)
Documentation/devicetree/bindings/arm/armada-370-xp-mpic.txt +7 -1
@@ -1,4 +1,4 @@ -Marvell Armada 370 and Armada XP Interrupt Controller +Marvell Armada 370, 375, 38x, XP Interrupt Controller ----------------------------------------------------- Required properties:
@@ -16,7 +16,13 @@ Required properties: automatically map to the interrupt controller registers of the current CPU) +Optional properties: +- interrupts: If defined, then it indicates that this MPIC is + connected as a slave to another interrupt controller. This is + typically the case on Armada 375 and Armada 38x, where the MPIC is + connected as a slave to the Cortex-A9 GIC. The provided interrupt + indicate to which GIC interrupt the MPIC output is connected. Example:
drivers/irqchip/irq-armada-370-xp.c +43 -7
103 lines not on this page · raw message
Signature · 1 line
1.8.1.5
cover irqchip: Armada 370/XP MPIC as a slave controller
In reply to Ezequiel GarciaHi Thomas:
Quoted 20 lines · Ezequiel Garcia
The newly introduced Armada 375 and Armada 38x Marvell SoCs are based on Cortex-A9 CPU cores and use the ARM GIC as their main interrupt controller.
However, for various purposes (wake-up from suspend, MSI interrupts), the SoCs have a separate MPIC interrupt controller, acting as a slave to the GIC. This MPIC was already used as the primary controller on previous Marvell SoCs, so this commit extends the existing driver to allow the MPIC to be used as a GIC slave.
This series consists in two patches: the first one adds a helper function to handle MSI interrupts. The second patch implements a chained handler, which uses the previously introduced helper.
These patches apply cleanly on v3.14-rc1 plus:
36802fd irqchip: armada-370-xp: fix MSI race condition e1603bb irqchip: armada-370-xp: fix IPI race condition
Or simply on v3.14-rc2.
Quoted 8 lines
Ezequiel Garcia (2):
irqchip: armada-370-xp: Add helper for the MSI IRQ handling
irqchip: armada-370-xp: Setup a chained handler for the MPIC.../devicetree/bindings/arm/armada-370-xp-mpic.txt | 8 +- drivers/irqchip/irq-armada-370-xp.c | 96 ++++++++++++++++------ 2 files changed, 76 insertions(+), 28 deletions(-)
Any comments on this?
Signature · 3 lines
Ezequiel Garc?a, Free Electrons Embedded Linux, Kernel and Android Engineering http://free-electrons.com
cover irqchip: Armada 370/XP MPIC as a slave controller
In reply to Ezequiel GarciaQuoted 20 lines · Ezequiel Garcia
The newly introduced Armada 375 and Armada 38x Marvell SoCs are based on Cortex-A9 CPU cores and use the ARM GIC as their main interrupt controller.
However, for various purposes (wake-up from suspend, MSI interrupts), the SoCs have a separate MPIC interrupt controller, acting as a slave to the GIC. This MPIC was already used as the primary controller on previous Marvell SoCs, so this commit extends the existing driver to allow the MPIC to be used as a GIC slave.
This series consists in two patches: the first one adds a helper function to handle MSI interrupts. The second patch implements a chained handler, which uses the previously introduced helper.
These patches apply cleanly on v3.14-rc1 plus:
36802fd irqchip: armada-370-xp: fix MSI race condition e1603bb irqchip: armada-370-xp: fix IPI race condition
Or simply on v3.14-rc2.
Quoted 7 lines
Ezequiel Garcia (2):
irqchip: armada-370-xp: Add helper for the MSI IRQ handling
irqchip: armada-370-xp: Setup a chained handler for the MPIC.../devicetree/bindings/arm/armada-370-xp-mpic.txt | 8 +- drivers/irqchip/irq-armada-370-xp.c | 96 ++++++++++++++++------ 2 files changed, 76 insertions(+), 28 deletions(-)
I've tentatively applied these to mvebu/irqchip with the dependencies on v3.14-rc1 + tags/mvebu-irqchip-fixes-3.13 to get them some coverage in -next.
thx,
Jason.
cover irqchip: Armada 370/XP MPIC as a slave controller
Quoted 25 lines · Jason Cooper
Quoted 24 lines · Ezequiel Garcia
The newly introduced Armada 375 and Armada 38x Marvell SoCs are based on Cortex-A9 CPU cores and use the ARM GIC as their main interrupt controller.
However, for various purposes (wake-up from suspend, MSI interrupts), the SoCs have a separate MPIC interrupt controller, acting as a slave to the GIC. This MPIC was already used as the primary controller on previous Marvell SoCs, so this commit extends the existing driver to allow the MPIC to be used as a GIC slave.
This series consists in two patches: the first one adds a helper function to handle MSI interrupts. The second patch implements a chained handler, which uses the previously introduced helper.
These patches apply cleanly on v3.14-rc1 plus:
36802fd irqchip: armada-370-xp: fix MSI race condition e1603bb irqchip: armada-370-xp: fix IPI race condition
Or simply on v3.14-rc2.
Ezequiel Garcia (2):
irqchip: armada-370-xp: Add helper for the MSI IRQ handling
irqchip: armada-370-xp: Setup a chained handler for the MPIC
Quoted 8 lines
Quoted 3 lines
.../devicetree/bindings/arm/armada-370-xp-mpic.txt | 8 +- drivers/irqchip/irq-armada-370-xp.c | 96 ++++++++++++++++------ 2 files changed, 76 insertions(+), 28 deletions(-)I've tentatively applied these to mvebu/irqchip with the dependencies on v3.14-rc1 + tags/mvebu-irqchip-fixes-3.13 to get them some coverage in -next.
Thanks Jason. You rock.
Signature · 3 lines
Ezequiel Garc?a, Free Electrons Embedded Linux, Kernel and Android Engineering http://free-electrons.com