[PATCH 3/4] lib: utils: irqchip: imsic: Dispatch non-IPI interrupts via irqchip framework

David E. Garcia Porras david.garcia at aheadcomputing.com
Fri Mar 27 22:43:46 PDT 2026


Currently imsic_process_hwirqs() only handles the IPI interrupt
(IMSIC_IPI_ID) and logs all other external interrupts as unhandled.
Platforms using IMSIC in MSI delivery mode (APLIC wired to IMSIC)
have no way to handle M-mode external interrupts through the
existing sbi_irqchip handler registration framework.

Route non-IPI interrupts through sbi_irqchip_process_hwirq() so
that handlers registered via sbi_irqchip_register_handler() are
invoked. Also implement hwirq_unmask and hwirq_mask callbacks
using the existing imsic_local_eix_update() helper, enabling
sbi_irqchip_register_handler() to automatically enable interrupt
identities when a handler is registered.

Signed-off-by: David E. Garcia Porras <david.garcia at aheadcomputing.com>
---
 lib/utils/irqchip/imsic.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/lib/utils/irqchip/imsic.c b/lib/utils/irqchip/imsic.c
index 7559a069..6fd82688 100644
--- a/lib/utils/irqchip/imsic.c
+++ b/lib/utils/irqchip/imsic.c
@@ -159,8 +159,7 @@ static int imsic_process_hwirqs(struct sbi_irqchip_device *chip)
 			sbi_ipi_process();
 			break;
 		default:
-			sbi_printf("%s: unhandled IRQ%d\n",
-				   __func__, (u32)mirq);
+			sbi_irqchip_process_hwirq(chip, mirq);
 			break;
 		}
 	}
@@ -353,10 +352,22 @@ static int imsic_hwirq_setup(struct sbi_irqchip_device *chip, u32 hwirq)
 	return 0;
 }
 
+static void imsic_hwirq_unmask(struct sbi_irqchip_device *chip, u32 hwirq)
+{
+	imsic_local_eix_update(hwirq, 1, false, true);
+}
+
+static void imsic_hwirq_mask(struct sbi_irqchip_device *chip, u32 hwirq)
+{
+	imsic_local_eix_update(hwirq, 1, false, false);
+}
+
 static struct sbi_irqchip_device imsic_device = {
 	.warm_init	= imsic_warm_irqchip_init,
 	.process_hwirqs	= imsic_process_hwirqs,
 	.hwirq_setup	= imsic_hwirq_setup,
+	.hwirq_unmask	= imsic_hwirq_unmask,
+	.hwirq_mask	= imsic_hwirq_mask,
 };
 
 int imsic_cold_irqchip_init(struct imsic_data *imsic)
-- 
2.43.0




More information about the opensbi mailing list