diff mbox series

[22/25] irqchip/armada-370-xp: Refactor handling IPI interrupts into own function

Message ID 20240701170249.8128-23-kabel@kernel.org (mailing list archive)
State Superseded
Headers show
Series armada-370-xp irqchip updates round 2 | expand

Commit Message

Marek Behún July 1, 2024, 5:02 p.m. UTC
Refactor the handling of IPI interrupts into its own function
mpic_handle_ipi_irq(), similar to mpic_handle_msi_irq().

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

Comments

Andrew Lunn July 3, 2024, 1:38 a.m. UTC | #1
On Mon, Jul 01, 2024 at 07:02:46PM +0200, Marek Behún wrote:
> Refactor the handling of IPI interrupts into its own function
> mpic_handle_ipi_irq(), similar to mpic_handle_msi_irq().
> 
> Signed-off-by: Marek Behún <kabel@kernel.org>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
diff mbox series

Patch

diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 4b4c0dae72b0..5ce55cc15572 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -625,6 +625,22 @@  static void mpic_handle_msi_irq(struct pt_regs *regs, bool is_chained)
 static void mpic_handle_msi_irq(struct pt_regs *r, bool b) {}
 #endif
 
+#ifdef CONFIG_SMP
+static void mpic_handle_ipi_irq(void)
+{
+	irq_hw_number_t hwirq;
+	unsigned long cause;
+
+	cause = readl_relaxed(per_cpu_int_base + MPIC_IN_DRBEL_CAUSE);
+	cause &= IPI_DOORBELL_MASK;
+
+	for_each_set_bit(hwirq, &cause, IPI_DOORBELL_END)
+		generic_handle_domain_irq(mpic_ipi_domain, hwirq);
+}
+#else
+static inline void mpic_handle_ipi_irq(void) {}
+#endif
+
 static void mpic_handle_cascade_irq(struct irq_desc *desc)
 {
 	struct irq_chip *chip = irq_desc_get_chip(desc);
@@ -677,20 +693,9 @@  static void __exception_irq_entry mpic_handle_irq(struct pt_regs *regs)
 		if (hwirq == 1)
 			mpic_handle_msi_irq(regs, false);
 
-#ifdef CONFIG_SMP
 		/* IPI Handling */
-		if (hwirq == 0) {
-			unsigned long ipimask;
-			irq_hw_number_t ipi;
-
-			ipimask = readl_relaxed(per_cpu_int_base +
-						MPIC_IN_DRBEL_CAUSE) &
-				  IPI_DOORBELL_MASK;
-
-			for_each_set_bit(ipi, &ipimask, IPI_DOORBELL_END)
-				generic_handle_domain_irq(mpic_ipi_domain, ipi);
-		}
-#endif
+		if (hwirq == 0)
+			mpic_handle_ipi_irq();
 	} while (1);
 }