diff mbox series

[v2,2/4] irqchip/armada-370-xp: Only call ipi_resume() if IPI is available

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

Commit Message

Marek Behún June 20, 2024, 7:37 a.m. UTC
From: Pali Rohár <pali@kernel.org>

IPI is available only on systems where the mpic controller does not
have a parent IRQ defined (e.g. on Armada XP). If a parent IRQ is
defined, inter-processor interrupts are handled by an interrupt
controller higher in the hierarchy (most probably a parent GIC).

Only call ipi_resume() on systems where IPI is available in the mpic
controller.

Signed-off-by: Pali Rohár <pali@kernel.org>
[ refactored a little and changed commit message ]
Signed-off-by: Marek Behún <kabel@kernel.org>
---
 drivers/irqchip/irq-armada-370-xp.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

Comments

Andrew Lunn June 20, 2024, 1:18 p.m. UTC | #1
On Thu, Jun 20, 2024 at 09:37:13AM +0200, Marek Behún wrote:
> From: Pali Rohár <pali@kernel.org>
> 
> IPI is available only on systems where the mpic controller does not
> have a parent IRQ defined (e.g. on Armada XP). If a parent IRQ is
> defined, inter-processor interrupts are handled by an interrupt
> controller higher in the hierarchy (most probably a parent GIC).
> 
> Only call ipi_resume() on systems where IPI is available in the mpic
> controller.
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>
> [ refactored a little and changed commit message ]
> 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 f488c35d9130..ea95e327f672 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -29,6 +29,7 @@ 
 #include <linux/slab.h>
 #include <linux/syscore_ops.h>
 #include <linux/msi.h>
+#include <linux/types.h>
 #include <asm/mach/arch.h>
 #include <asm/exception.h>
 #include <asm/smp_plat.h>
@@ -156,6 +157,17 @@  static DEFINE_MUTEX(msi_used_lock);
 static phys_addr_t msi_doorbell_addr;
 #endif
 
+static inline bool is_ipi_available(void)
+{
+	/*
+	 * We distinguish IPI availability in the IC by the IC not having a
+	 * parent irq defined. If a parent irq is defined, there is a parent
+	 * interrupt controller (e.g. GIC) that takes care of inter-processor
+	 * interrupts.
+	 */
+	return parent_irq <= 0;
+}
+
 static inline bool is_percpu_irq(irq_hw_number_t irq)
 {
 	if (irq <= ARMADA_370_XP_MAX_PER_CPU_IRQS)
@@ -527,7 +539,8 @@  static void armada_xp_mpic_reenable_percpu(void)
 		armada_370_xp_irq_unmask(data);
 	}
 
-	ipi_resume();
+	if (is_ipi_available())
+		ipi_resume();
 
 	armada_370_xp_msi_reenable_percpu();
 }
@@ -750,7 +763,8 @@  static void armada_370_xp_mpic_resume(void)
 	if (doorbell_mask_reg & PCI_MSI_DOORBELL_MASK)
 		writel(1, per_cpu_int_base + ARMADA_370_XP_INT_CLEAR_MASK_OFFS);
 
-	ipi_resume();
+	if (is_ipi_available())
+		ipi_resume();
 }
 
 static struct syscore_ops armada_370_xp_mpic_syscore_ops = {