[PATCH v2 3/8] drm/xe/irq: add hw engine irq handler

Dani Liberman dliberman at habana.ai
Thu Jun 27 12:40:38 UTC 2024


From: Ilia Levi <illevi at habana.ai>

Introduce a simplified MSIX IRQ handler for HW engines.

Rather than having a single handler for all kinds of interrupts, we
will allocate different MSIX IRQs which will map directly to the HW
engine that generated the interrupt.

This patch provides only the handler itself - its usage will be introduced
later.

Signed-off-by: Ilia Levi <illevi at habana.ai>
---
 drivers/gpu/drm/xe/xe_irq.c | 18 +++++++++++++++++-
 drivers/gpu/drm/xe/xe_irq.h |  1 +
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/xe_irq.c b/drivers/gpu/drm/xe/xe_irq.c
index b552af53db2f..28173e946e77 100644
--- a/drivers/gpu/drm/xe/xe_irq.c
+++ b/drivers/gpu/drm/xe/xe_irq.c
@@ -821,7 +821,23 @@ void xe_irq_resume(struct xe_device *xe)
 		xe_irq_enable_hwe(gt);
 }
 
-static int xe_irq_alloc_msix(struct xe_device *xe, void *irq_buf, bool dynamic_msix, u32 *msix)
+/*
+ * This handles MI_USER_INTERRUPT.
+ * In MSI-X mode command streamers raise an interrupt only as a result of
+ * MI_USER_INTERRUPT and MI_FLUSH_DW_NOTIFY commands.
+ * Currently, there is no use-case for MI_FLUSH_DW_NOTIFY.
+ */
+irqreturn_t xe_irq_hwe_handler(int irq, void *arg)
+{
+	struct xe_hw_engine *hwe = arg;
+
+	xe_hw_engine_handle_irq(hwe, GT_RENDER_USER_INTERRUPT);
+
+	return IRQ_HANDLED;
+}
+
+static int xe_irq_alloc_msix(struct xe_device *xe, void *irq_buf,
+			     bool dynamic_msix, u32 *msix)
 {
 	struct xa_limit limit;
 	int ret = 0;
diff --git a/drivers/gpu/drm/xe/xe_irq.h b/drivers/gpu/drm/xe/xe_irq.h
index 6529dff90f76..4ab63e61a062 100644
--- a/drivers/gpu/drm/xe/xe_irq.h
+++ b/drivers/gpu/drm/xe/xe_irq.h
@@ -19,5 +19,6 @@ void xe_irq_enable_hwe(struct xe_gt *gt);
 int xe_request_irq(struct xe_device *xe, irq_handler_t handler, void *irq_buf, const char *name,
 		   bool dynamic_msix, u32 *msix);
 void xe_free_irq(struct xe_device *xe, u32 msix);
+irqreturn_t xe_irq_hwe_handler(int irq, void *arg);
 
 #endif
-- 
2.34.1



More information about the Intel-xe mailing list