Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ilia Levi <ilia.levi@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: ilia.levi@intel.com, michal.wajdeczko@intel.com,
	niranjana.vishwanathapura@intel.com, koby.elbaz@intel.com,
	yaron.avizrat@intel.com
Subject: [PATCH 4/5] drm/xe: memirq handler changes
Date: Thu, 22 Aug 2024 16:08:14 +0300	[thread overview]
Message-ID: <20240822130815.1355437-5-ilia.levi@intel.com> (raw)
In-Reply-To: <20240822130815.1355437-1-ilia.levi@intel.com>

This patch exposes an interrupt processing handler for a single hw engine.
This handler also caters for the new "reports to engine instance 0" mode.
Use this handler from the VF use-case as well.

Signed-off-by: Ilia Levi <ilia.levi@intel.com>
---
 drivers/gpu/drm/xe/xe_memirq.c | 31 ++++++++++++++++++++++++-------
 drivers/gpu/drm/xe/xe_memirq.h |  1 +
 2 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_memirq.c b/drivers/gpu/drm/xe/xe_memirq.c
index a1d4bc3f9e42..c388e480b5c8 100644
--- a/drivers/gpu/drm/xe/xe_memirq.c
+++ b/drivers/gpu/drm/xe/xe_memirq.c
@@ -383,6 +383,28 @@ static void memirq_dispatch_guc(struct xe_memirq *memirq, struct iosys_map *stat
 		xe_guc_irq_handler(guc, GUC_INTR_GUC2HOST);
 }
 
+/**
+ * xe_memirq_hwe_handler - Check and process interrupts for a specific HW engine.
+ * @memirq: the &xe_memirq
+ * @hwe: the hw engine to process
+ *
+ * This function reads and dispatches `Memory Based Interrupts` for the provided HW engine.
+ */
+void xe_memirq_hwe_handler(struct xe_memirq *memirq, struct xe_hw_engine *hwe)
+{
+	u16 offset = memirq->reports_to_e0 ? hwe->e0_irq_offset : hwe->irq_offset;
+	u16 instance = memirq->reports_to_e0 ? hwe->instance : 0;
+
+	struct iosys_map src_offset = IOSYS_MAP_INIT_OFFSET(&memirq->bo->vmap,
+							    XE_MEMIRQ_SOURCE_OFFSET(instance));
+	if (memirq_received(memirq, &src_offset, offset, "SRC")) {
+		struct iosys_map status_offset =
+			IOSYS_MAP_INIT_OFFSET(&memirq->bo->vmap,
+					      XE_MEMIRQ_STATUS_OFFSET(instance) + offset * SZ_16);
+		memirq_dispatch_engine(memirq, &status_offset, hwe);
+	}
+}
+
 /**
  * xe_memirq_handler - The `Memory Based Interrupts`_ Handler.
  * @memirq: the &xe_memirq
@@ -410,13 +432,8 @@ void xe_memirq_handler(struct xe_memirq *memirq)
 		if (gt->tile != tile)
 			continue;
 
-		for_each_hw_engine(hwe, gt, id) {
-			if (memirq_received(memirq, &memirq->source, hwe->irq_offset, "SRC")) {
-				map = IOSYS_MAP_INIT_OFFSET(&memirq->status,
-							    hwe->irq_offset * SZ_16);
-				memirq_dispatch_engine(memirq, &map, hwe);
-			}
-		}
+		for_each_hw_engine(hwe, gt, id)
+			xe_memirq_hwe_handler(memirq, hwe);
 	}
 
 	/* GuC and media GuC (if present) must be checked separately */
diff --git a/drivers/gpu/drm/xe/xe_memirq.h b/drivers/gpu/drm/xe/xe_memirq.h
index 98e2b61ef973..8a9334482a9b 100644
--- a/drivers/gpu/drm/xe/xe_memirq.h
+++ b/drivers/gpu/drm/xe/xe_memirq.h
@@ -20,6 +20,7 @@ u32 xe_memirq_enable_ptr(struct xe_memirq *memirq);
 
 void xe_memirq_reset(struct xe_memirq *memirq);
 void xe_memirq_postinstall(struct xe_memirq *memirq);
+void xe_memirq_hwe_handler(struct xe_memirq *memirq, struct xe_hw_engine *hwe);
 void xe_memirq_handler(struct xe_memirq *memirq);
 
 int xe_memirq_init_guc(struct xe_memirq *memirq, struct xe_guc *guc);
-- 
2.43.2


  parent reply	other threads:[~2024-08-22 13:08 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-22 13:08 [PATCH 0/5] memirq infra changes Ilia Levi
2024-08-22 13:08 ` [PATCH 1/5] drm/xe: move memirq out of vf Ilia Levi
2024-08-22 14:39   ` Cavitt, Jonathan
2024-08-26 11:59     ` Ilia Levi
2024-08-22 13:08 ` [PATCH 2/5] drm/xe: memirq infra changes for msix Ilia Levi
2024-08-22 15:05   ` Cavitt, Jonathan
2024-08-26 12:22     ` Ilia Levi
2024-08-26 14:40       ` Cavitt, Jonathan
2024-08-22 13:08 ` [PATCH 3/5] drm/xe: add memirq offsets for engine instance 0 to hw engine properties Ilia Levi
2024-08-22 15:42   ` Cavitt, Jonathan
2024-08-26 13:31     ` Ilia Levi
2024-08-26 15:06       ` Cavitt, Jonathan
2024-08-22 13:08 ` Ilia Levi [this message]
2024-08-22 15:47   ` [PATCH 4/5] drm/xe: memirq handler changes Cavitt, Jonathan
2024-08-22 13:08 ` [PATCH 5/5] drm/xe: separate memirq reset/postinstall from vf Ilia Levi
2024-08-22 16:09   ` Cavitt, Jonathan
2024-08-22 13:13 ` ✓ CI.Patch_applied: success for memirq infra changes Patchwork
2024-08-22 13:14 ` ✓ CI.checkpatch: " Patchwork
2024-08-22 13:15 ` ✓ CI.KUnit: " Patchwork
2024-08-22 13:31 ` ✓ CI.Build: " Patchwork
2024-08-22 13:35 ` ✓ CI.Hooks: " Patchwork
2024-08-22 13:37 ` ✓ CI.checksparse: " Patchwork
2024-08-22 13:58 ` ✓ CI.BAT: " Patchwork
2024-08-22 17:19 ` ✗ CI.FULL: failure " Patchwork
2024-08-28  7:56 ` ✗ CI.Patch_applied: failure for memirq infra changes (rev2) Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240822130815.1355437-5-ilia.levi@intel.com \
    --to=ilia.levi@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=koby.elbaz@intel.com \
    --cc=michal.wajdeczko@intel.com \
    --cc=niranjana.vishwanathapura@intel.com \
    --cc=yaron.avizrat@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox