[PATCH v3 06/11] drm/xe/irq: add hw engine irq handler

Ilia Levi ilia.levi at intel.com
Wed Jul 17 07:32:18 UTC 2024


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 <ilia.levi at intel.com>
---
 drivers/gpu/drm/xe/xe_irq.c | 17 +++++++++++++++++
 drivers/gpu/drm/xe/xe_irq.h |  1 +
 2 files changed, 18 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_irq.c b/drivers/gpu/drm/xe/xe_irq.c
index 2f17b85bf93c..31ddcbefe9a5 100644
--- a/drivers/gpu/drm/xe/xe_irq.c
+++ b/drivers/gpu/drm/xe/xe_irq.c
@@ -836,6 +836,23 @@ void xe_irq_resume(struct xe_device *xe)
 		xe_irq_enable_hwe(gt);
 }
 
+/**
+ * xe_irq_msix_hwe_handler - MSI-X IRQ handler for hw engines
+ * @irq: the irq raised
+ * @arg: the hw engine that raised the interrupt
+ *
+ * In MSI-X mode command streamers raise an interrupt only as a result of
+ * MI_USER_INTERRUPT and MI_FLUSH_DW_NOTIFY commands.
+ */
+irqreturn_t xe_irq_msix_hwe_handler(int irq, void *arg)
+{
+	struct xe_hw_engine *hwe = arg;
+
+	xe_memirq_hwe_handler(&gt_to_tile(hwe->gt)->memirq, hwe);
+
+	return IRQ_HANDLED;
+}
+
 static int xe_irq_alloc_msix(struct xe_device *xe, void *irq_buf, bool dynamic_msix, u16 *msix)
 {
 	struct xa_limit limit;
diff --git a/drivers/gpu/drm/xe/xe_irq.h b/drivers/gpu/drm/xe/xe_irq.h
index 78d3321da6e3..94b32a780c68 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_irq_request_irq(struct xe_device *xe, irq_handler_t handler, void *irq_buf,
 		       const char *name, bool dynamic_msix, u16 *msix);
 void xe_irq_free_irq(struct xe_device *xe, u16 msix);
+irqreturn_t xe_irq_msix_hwe_handler(int irq, void *arg);
 
 #endif
-- 
2.43.2



More information about the Intel-xe mailing list