All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 10/10] drm/i915/icl: Only ack irq identities we did handle
Date: Thu, 20 Sep 2018 17:33:50 +0300	[thread overview]
Message-ID: <20180920143350.29249-11-mika.kuoppala@linux.intel.com> (raw)
In-Reply-To: <20180920143350.29249-1-mika.kuoppala@linux.intel.com>

If we ack the identities immediately after they have been
handled, it should unblock next interrupt accumulation
in the gathering register earlier. It also allows us to
remove time based polling of valid bit. If we don't get a valid
sample now, we will likely get a valid sample on next interrupt,
which will be generated due to skipping the ack. The downside
is that we will have as many ack writes as there were identities
handled.

Leave small retry loop for safety and with debugs to see if we
ever encounter read with valid not set.

Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_irq.c | 26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 27116e3f21af..beb9fe4abf1f 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -2965,22 +2965,18 @@ gen11_gt_engine_identity(struct drm_i915_private * const i915,
 			 const unsigned int bank, const unsigned int bit)
 {
 	void __iomem * const regs = i915->regs;
-	u32 timeout_ts;
-	u32 ident;
+	u32 ident, retry = 0;
 
 	lockdep_assert_held(&i915->irq_lock);
 
 	raw_reg_write(regs, GEN11_IIR_REG_SELECTOR(bank), BIT(bit));
 
-	/*
-	 * NB: Specs do not specify how long to spin wait,
-	 * so we do ~100us as an educated guess.
-	 */
-	timeout_ts = (local_clock() >> 10) + 100;
 	do {
 		ident = raw_reg_read(regs, GEN11_INTR_IDENTITY_REG(bank));
-	} while (!(ident & GEN11_INTR_DATA_VALID) &&
-		 !time_after32(local_clock() >> 10, timeout_ts));
+	} while (!(ident & GEN11_INTR_DATA_VALID) && ++retry <= 10);
+
+	if (unlikely(GEM_SHOW_DEBUG() && retry))
+		WARN_ONCE(1, "INTR_IDENTITY took %u reads to settle\n", retry);
 
 	if (unlikely(!(ident & GEN11_INTR_DATA_VALID))) {
 		DRM_ERROR("INTR_IDENTITY_REG%u:%u 0x%08x not valid!\n",
@@ -3031,9 +3027,6 @@ gen11_gt_identity_handler(struct drm_i915_private * const i915,
 	const u8 instance = GEN11_INTR_ENGINE_INSTANCE(identity);
 	const u16 intr = GEN11_INTR_ENGINE_INTR(identity);
 
-	if (unlikely(!intr))
-		return;
-
 	if (class <= COPY_ENGINE_CLASS)
 		return gen11_engine_irq_handler(i915, class, instance, intr);
 
@@ -3065,11 +3058,14 @@ gen11_gt_bank_handler(struct drm_i915_private * const i915,
 		const u32 ident = gen11_gt_engine_identity(i915,
 							   bank, bit);
 
+		if (unlikely(!ident))
+			continue;
+
 		gen11_gt_identity_handler(i915, ident);
-	}
 
-	/* Clear must be after shared has been served for engine */
-	raw_reg_write(regs, GEN11_GT_INTR_DW(bank), intr_dw);
+		/* Clear must be after shared has been served for engine */
+		raw_reg_write(regs, GEN11_GT_INTR_DW(bank), BIT(bit));
+	}
 }
 
 static void
-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2018-09-20 14:34 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-20 14:33 [PATCH 00/10] ICL interrupt handling improvements Mika Kuoppala
2018-09-20 14:33 ` [PATCH 01/10] drm/i915/icl: No need to ack intr through master control Mika Kuoppala
2018-09-20 14:33 ` [PATCH 02/10] drm/i915/icl: Disable master intr early Mika Kuoppala
2018-09-20 14:37   ` Chris Wilson
2018-09-20 14:33 ` [PATCH 03/10] drm/i915/icl: No need to early bailout on interrupt Mika Kuoppala
2018-09-20 14:55   ` Chris Wilson
2018-09-20 16:11   ` Daniele Ceraolo Spurio
2018-09-20 14:33 ` [PATCH 04/10] drm/i915/icl: Add helper to enable/disable master irq Mika Kuoppala
2018-09-20 14:57   ` Chris Wilson
2018-09-20 14:33 ` [PATCH 05/10] drm/i915/icl: Trim down posting reads on master intr control Mika Kuoppala
2018-09-20 14:58   ` Chris Wilson
2018-09-20 14:33 ` [PATCH 06/10] drm/i915/icl: Streamline guc irq handling Mika Kuoppala
2018-09-20 15:00   ` Chris Wilson
2018-09-20 17:31   ` Daniele Ceraolo Spurio
2018-09-20 14:33 ` [PATCH 07/10] drm/i915/icl: Make own function for display irq handler Mika Kuoppala
2018-09-20 15:02   ` Chris Wilson
2018-09-20 14:33 ` [PATCH 08/10] drm/i915/icl: Handle GT interrupts after enabling master Mika Kuoppala
2018-09-20 14:33 ` [PATCH 09/10] drm/i915/icl: Handle display " Mika Kuoppala
2018-09-20 15:06   ` Chris Wilson
2018-09-20 14:33 ` Mika Kuoppala [this message]
2018-09-20 17:14   ` [PATCH 10/10] drm/i915/icl: Only ack irq identities we did handle Daniele Ceraolo Spurio
2018-09-20 15:26 ` ✓ Fi.CI.BAT: success for ICL interrupt handling improvements Patchwork
2018-09-20 20:52 ` ✓ Fi.CI.IGT: " 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=20180920143350.29249-11-mika.kuoppala@linux.intel.com \
    --to=mika.kuoppala@linux.intel.com \
    --cc=intel-gfx@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.