diff mbox series

[12/13] irqchip/armada-370-xp: Allow mapping only per-CPU interrupts

Message ID 20240715105156.18388-13-kabel@kernel.org (mailing list archive)
State New, archived
Headers show
Series armada-370-xp irqchip updates round 5 | expand

Commit Message

Marek Behún July 15, 2024, 10:51 a.m. UTC
On platforms where MPIC is not the top-level interrupt controller the
driver currently only supports handling of the per-CPU interrupts (the
first 29 interrupts). This is obvious from the code of
mpic_handle_cascade_irq(), where we read only one cause register.

Bound the number of available interrupts in the IRQ domain to 29 for
these platforms.

The corresponding device-trees refer only to per-CPU interrupts via
MPIC, the other interrupts are referred to via GIC.

Signed-off-by: Marek Behún <kabel@kernel.org>
---
 drivers/irqchip/irq-armada-370-xp.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

Comments

Thomas Gleixner July 28, 2024, 9:55 p.m. UTC | #1
On Mon, Jul 15 2024 at 12:51, Marek Behún wrote:

> On platforms where MPIC is not the top-level interrupt controller the
> driver currently only supports handling of the per-CPU interrupts (the
> first 29 interrupts). This is obvious from the code of
> mpic_handle_cascade_irq(), where we read only one cause register.

which reads only ....

We read nothing :)

Thanks,

        tglx
diff mbox series

Patch

diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 1db9160da20a..3cae6ceacc73 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -858,6 +858,19 @@  static int __init mpic_of_init(struct device_node *node,
 	for (irq_hw_number_t i = 0; i < nr_irqs; i++)
 		writel(i, mpic->base + MPIC_INT_CLEAR_ENABLE);
 
+	/*
+	 * Initialize mpic->parent_irq before calling any other functions, since
+	 * it is used to distinguish between IPI and non-IPI platforms.
+	 */
+	mpic->parent_irq = irq_of_parse_and_map(node, 0);
+
+	/*
+	 * On non-IPI platforms the driver currently supports only the per-CPU
+	 * interrupts (the first 29 interrupts). See mpic_handle_cascade_irq().
+	 */
+	if (!mpic_is_ipi_available(mpic))
+		nr_irqs = MPIC_PER_CPU_IRQS_NR;
+
 	mpic->domain = irq_domain_add_linear(node, nr_irqs, &mpic_irq_ops, mpic);
 	if (!mpic->domain) {
 		pr_err("%pOF: Unable to add IRQ domain\n", node);
@@ -866,12 +879,6 @@  static int __init mpic_of_init(struct device_node *node,
 
 	irq_domain_update_bus_token(mpic->domain, DOMAIN_BUS_WIRED);
 
-	/*
-	 * Initialize mpic->parent_irq before calling any other functions, since
-	 * it is used to distinguish between IPI and non-IPI platforms.
-	 */
-	mpic->parent_irq = irq_of_parse_and_map(node, 0);
-
 	/* Setup for the boot CPU */
 	mpic_perf_init(mpic);
 	mpic_smp_cpu_init(mpic);