Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: intel-xe@lists.freedesktop.org
Subject: [PATCH 5/8] drm/i915: Hook in display GTT faults for ILK/SNB
Date: Thu, 16 Jan 2025 19:47:55 +0200	[thread overview]
Message-ID: <20250116174758.18298-6-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20250116174758.18298-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Hook up display GTT fault interrupts for ILK/SNB.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 .../gpu/drm/i915/display/intel_display_irq.c  | 56 ++++++++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h               | 10 ++++
 2 files changed, 65 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display_irq.c b/drivers/gpu/drm/i915/display/intel_display_irq.c
index 70e5326b86d0..c80183b0acaf 100644
--- a/drivers/gpu/drm/i915/display/intel_display_irq.c
+++ b/drivers/gpu/drm/i915/display/intel_display_irq.c
@@ -792,6 +792,56 @@ static void cpt_irq_handler(struct drm_i915_private *dev_priv, u32 pch_iir)
 		cpt_serr_int_handler(dev_priv);
 }
 
+static u32 ilk_gtt_fault_pipe_fault_mask(enum pipe pipe)
+{
+	switch (pipe) {
+	case PIPE_A:
+		return GTT_FAULT_SPRITE_A_FAULT |
+			GTT_FAULT_PRIMARY_A_FAULT |
+			GTT_FAULT_CURSOR_A_FAULT;
+	case PIPE_B:
+		return GTT_FAULT_SPRITE_B_FAULT |
+			GTT_FAULT_PRIMARY_B_FAULT |
+			GTT_FAULT_CURSOR_B_FAULT;
+	default:
+		return 0;
+	}
+}
+
+static const struct pipe_fault_handler ilk_pipe_fault_handlers[] = {
+	{ .fault = GTT_FAULT_SPRITE_A_FAULT, .handle = handle_plane_fault, .plane_id = PLANE_SPRITE0, },
+	{ .fault = GTT_FAULT_SPRITE_B_FAULT, .handle = handle_plane_fault, .plane_id = PLANE_SPRITE0, },
+	{ .fault = GTT_FAULT_PRIMARY_A_FAULT, .handle = handle_plane_fault, .plane_id = PLANE_PRIMARY, },
+	{ .fault = GTT_FAULT_PRIMARY_B_FAULT, .handle = handle_plane_fault, .plane_id = PLANE_PRIMARY, },
+	{ .fault = GTT_FAULT_CURSOR_A_FAULT, .handle = handle_plane_fault, .plane_id = PLANE_CURSOR, },
+	{ .fault = GTT_FAULT_CURSOR_B_FAULT, .handle = handle_plane_fault, .plane_id = PLANE_CURSOR, },
+	{}
+};
+
+static void ilk_gtt_fault_irq_handler(struct intel_display *display)
+{
+	enum pipe pipe;
+	u32 gtt_fault;
+
+	gtt_fault = intel_de_read(display, ILK_GTT_FAULT);
+	intel_de_write(display, ILK_GTT_FAULT, gtt_fault);
+
+	if (gtt_fault & GTT_FAULT_INVALID_GTT_PTE)
+		drm_err_ratelimited(display->drm, "Invalid GTT PTE\n");
+
+	if (gtt_fault & GTT_FAULT_INVALID_PTE_DATA)
+		drm_err_ratelimited(display->drm, "Invalid PTE data\n");
+
+	for_each_pipe(display, pipe) {
+		u32 fault_errors;
+
+		fault_errors = gtt_fault & ilk_gtt_fault_pipe_fault_mask(pipe);
+		if (fault_errors)
+			intel_pipe_fault_irq_handler(display, ilk_pipe_fault_handlers,
+						     pipe, fault_errors);
+	}
+}
+
 void ilk_display_irq_handler(struct drm_i915_private *dev_priv, u32 de_iir)
 {
 	struct intel_display *display = &dev_priv->display;
@@ -810,6 +860,9 @@ void ilk_display_irq_handler(struct drm_i915_private *dev_priv, u32 de_iir)
 	if (de_iir & DE_POISON)
 		drm_err(&dev_priv->drm, "Poison interrupt\n");
 
+	if (de_iir & DE_GTT_FAULT)
+		ilk_gtt_fault_irq_handler(display);
+
 	for_each_pipe(dev_priv, pipe) {
 		if (de_iir & DE_PIPE_VBLANK(pipe))
 			intel_handle_vblank(dev_priv, pipe);
@@ -1933,7 +1986,8 @@ void ilk_de_irq_postinstall(struct drm_i915_private *i915)
 			      DE_PLANE_FLIP_DONE_IVB(PLANE_A) |
 			      DE_DP_A_HOTPLUG_IVB);
 	} else {
-		display_mask = (DE_MASTER_IRQ_CONTROL | DE_GSE | DE_PCH_EVENT |
+		display_mask = (DE_MASTER_IRQ_CONTROL | DE_GSE |
+				DE_PCH_EVENT | DE_GTT_FAULT |
 				DE_AUX_CHANNEL_A | DE_PIPEB_CRC_DONE |
 				DE_PIPEA_CRC_DONE | DE_POISON);
 		extra_mask = (DE_PIPEA_VBLANK | DE_PIPEB_VBLANK |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 9021f3ead7e6..71d09c21695a 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -372,6 +372,16 @@
 #define GEN7_MEDIA_MAX_REQ_COUNT	_MMIO(0x4070)
 #define GEN7_GFX_MAX_REQ_COUNT		_MMIO(0x4074)
 
+#define ILK_GTT_FAULT	_MMIO(0x44040) /* ilk/snb */
+#define   GTT_FAULT_INVALID_GTT_PTE	(1 << 7)
+#define   GTT_FAULT_INVALID_PTE_DATA	(1 << 6)
+#define   GTT_FAULT_CURSOR_B_FAULT	(1 << 5)
+#define   GTT_FAULT_CURSOR_A_FAULT	(1 << 4)
+#define   GTT_FAULT_SPRITE_B_FAULT	(1 << 3)
+#define   GTT_FAULT_SPRITE_A_FAULT	(1 << 2)
+#define   GTT_FAULT_PRIMARY_B_FAULT	(1 << 1)
+#define   GTT_FAULT_PRIMARY_A_FAULT	(1 << 0)
+
 #define GEN7_ERR_INT	_MMIO(0x44040)
 #define   ERR_INT_POISON		(1 << 31)
 #define   ERR_INT_INVALID_GTT_PTE	(1 << 29)
-- 
2.45.2


  parent reply	other threads:[~2025-01-16 17:48 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-16 17:47 [PATCH 0/8] drm/i915: Provide more information on display faults Ville Syrjala
2025-01-16 17:47 ` [PATCH 1/8] drm/i915: Add missing else to the if ladder in missing else Ville Syrjala
2025-02-12 20:46   ` Govindapillai, Vinod
2025-01-16 17:47 ` [PATCH 2/8] drm/i915: Introduce a minimal plane error state Ville Syrjala
2025-02-12 21:08   ` Govindapillai, Vinod
2025-01-16 17:47 ` [PATCH 3/8] drm/i915: Pimp display fault reporting Ville Syrjala
2025-01-20 13:50   ` Maarten Lankhorst
2025-01-20 14:48     ` Ville Syrjälä
2025-02-13 19:28   ` Govindapillai, Vinod
2025-01-16 17:47 ` [PATCH 4/8] drm/i915: Hook in display GTT faults for IVB/HSW Ville Syrjala
2025-02-13 20:02   ` Govindapillai, Vinod
2025-01-16 17:47 ` Ville Syrjala [this message]
2025-02-13 20:09   ` [PATCH 5/8] drm/i915: Hook in display GTT faults for ILK/SNB Govindapillai, Vinod
2025-02-13 20:18     ` Govindapillai, Vinod
2025-01-16 17:47 ` [PATCH 6/8] drm/i915: Introduce i915_error_regs Ville Syrjala
2025-02-13 20:47   ` Govindapillai, Vinod
2025-01-16 17:47 ` [PATCH 7/8] drm/i915: Un-invert {i9xx,i965}_error_mask() Ville Syrjala
2025-02-13 20:49   ` Govindapillai, Vinod
2025-01-16 17:47 ` [PATCH 8/8] drm/i915: Hook up display fault interrupts for VLV/CHV Ville Syrjala
2025-02-13 21:03   ` Govindapillai, Vinod
2025-01-16 22:53 ` ✓ CI.Patch_applied: success for drm/i915: Provide more information on display faults Patchwork
2025-01-16 22:53 ` ✗ CI.checkpatch: warning " Patchwork
2025-01-16 22:54 ` ✓ CI.KUnit: success " Patchwork
2025-01-16 23:12 ` ✓ CI.Build: " Patchwork
2025-01-16 23:15 ` ✓ CI.Hooks: " Patchwork
2025-01-16 23:17 ` ✗ CI.checksparse: warning " Patchwork
2025-01-17  9:10 ` ✗ Xe.CI.Full: failure " Patchwork
2025-01-17 10:35 ` ✓ CI.Patch_applied: success for drm/i915: Provide more information on display faults (rev2) Patchwork
2025-01-17 10:35 ` ✗ CI.checkpatch: warning " Patchwork
2025-01-17 10:37 ` ✓ CI.KUnit: success " Patchwork
2025-01-17 10:55 ` ✓ CI.Build: " Patchwork
2025-01-17 10:57 ` ✓ CI.Hooks: " Patchwork
2025-01-17 10:59 ` ✗ CI.checksparse: warning " Patchwork
2025-01-17 11:25 ` ✓ Xe.CI.BAT: success " Patchwork
2025-01-17 12:20 ` ✓ Xe.CI.BAT: success for drm/i915: Provide more information on display faults Patchwork
2025-01-17 17:57 ` ✗ Xe.CI.Full: failure for drm/i915: Provide more information on display faults (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=20250116174758.18298-6-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    /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