All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 05/15] drm/i915/guc: Move Guc notification handling to separate function
Date: Fri,  4 Aug 2017 16:27:02 +0000	[thread overview]
Message-ID: <20170804162712.20468-6-michal.wajdeczko@intel.com> (raw)
In-Reply-To: <20170804162712.20468-1-michal.wajdeczko@intel.com>

To allow future code reuse. While here, fix comment style.

Suggested-by: Oscar Mateo <oscar.mateo@intel.com>
Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Oscar Mateo <oscar.mateo@intel.com>
Cc: Sagar Arun Kamble <sagar.a.kamble@intel.com>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
---
 drivers/gpu/drm/i915/i915_irq.c | 33 ++-------------------------------
 drivers/gpu/drm/i915/intel_uc.c | 37 +++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_uc.h |  1 +
 3 files changed, 40 insertions(+), 31 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 196caa4..ac69534 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -1675,37 +1675,8 @@ static void gen6_rps_irq_handler(struct drm_i915_private *dev_priv, u32 pm_iir)
 
 static void gen9_guc_irq_handler(struct drm_i915_private *dev_priv, u32 gt_iir)
 {
-	if (gt_iir & GEN9_GUC_TO_HOST_INT_EVENT) {
-		/* Sample the log buffer flush related bits & clear them out now
-		 * itself from the message identity register to minimize the
-		 * probability of losing a flush interrupt, when there are back
-		 * to back flush interrupts.
-		 * There can be a new flush interrupt, for different log buffer
-		 * type (like for ISR), whilst Host is handling one (for DPC).
-		 * Since same bit is used in message register for ISR & DPC, it
-		 * could happen that GuC sets the bit for 2nd interrupt but Host
-		 * clears out the bit on handling the 1st interrupt.
-		 */
-		u32 msg, flush;
-
-		msg = I915_READ(SOFT_SCRATCH(15));
-		flush = msg & (INTEL_GUC_RECV_MSG_CRASH_DUMP_POSTED |
-			       INTEL_GUC_RECV_MSG_FLUSH_LOG_BUFFER);
-		if (flush) {
-			/* Clear the message bits that are handled */
-			I915_WRITE(SOFT_SCRATCH(15), msg & ~flush);
-
-			/* Handle flush interrupt in bottom half */
-			queue_work(dev_priv->guc.log.runtime.flush_wq,
-				   &dev_priv->guc.log.runtime.flush_work);
-
-			dev_priv->guc.log.flush_interrupt_count++;
-		} else {
-			/* Not clearing of unhandled event bits won't result in
-			 * re-triggering of the interrupt.
-			 */
-		}
-	}
+	if (gt_iir & GEN9_GUC_TO_HOST_INT_EVENT)
+		intel_guc_notification_handler(&dev_priv->guc);
 }
 
 static void valleyview_pipestat_irq_ack(struct drm_i915_private *dev_priv,
diff --git a/drivers/gpu/drm/i915/intel_uc.c b/drivers/gpu/drm/i915/intel_uc.c
index c704968..1e6390e 100644
--- a/drivers/gpu/drm/i915/intel_uc.c
+++ b/drivers/gpu/drm/i915/intel_uc.c
@@ -532,6 +532,43 @@ int intel_guc_send_mmio(struct intel_guc *guc, const u32 *action, u32 len,
 	return ret;
 }
 
+void intel_guc_notification_handler(struct intel_guc *guc)
+{
+	struct drm_i915_private *dev_priv = guc_to_i915(guc);
+	u32 msg, flush;
+
+	/*
+	 * Sample the log buffer flush related bits & clear them out now
+	 * itself from the message identity register to minimize the
+	 * probability of losing a flush interrupt, when there are back
+	 * to back flush interrupts.
+	 * There can be a new flush interrupt, for different log buffer
+	 * type (like for ISR), whilst Host is handling one (for DPC).
+	 * Since same bit is used in message register for ISR & DPC, it
+	 * could happen that GuC sets the bit for 2nd interrupt but Host
+	 * clears out the bit on handling the 1st interrupt.
+	 */
+
+	msg = I915_READ(SOFT_SCRATCH(15));
+	flush = msg & (INTEL_GUC_RECV_MSG_CRASH_DUMP_POSTED |
+		       INTEL_GUC_RECV_MSG_FLUSH_LOG_BUFFER);
+	if (flush) {
+		/* Clear the message bits that are handled */
+		I915_WRITE(SOFT_SCRATCH(15), msg & ~flush);
+
+		/* Handle flush interrupt in bottom half */
+		queue_work(dev_priv->guc.log.runtime.flush_wq,
+				&dev_priv->guc.log.runtime.flush_work);
+
+		dev_priv->guc.log.flush_interrupt_count++;
+	} else {
+		/*
+		 * Not clearing of unhandled event bits won't result in
+		 * re-triggering of the interrupt.
+		 */
+	}
+}
+
 int intel_guc_sample_forcewake(struct intel_guc *guc)
 {
 	struct drm_i915_private *dev_priv = guc_to_i915(guc);
diff --git a/drivers/gpu/drm/i915/intel_uc.h b/drivers/gpu/drm/i915/intel_uc.h
index 9353ac3..2789179 100644
--- a/drivers/gpu/drm/i915/intel_uc.h
+++ b/drivers/gpu/drm/i915/intel_uc.h
@@ -226,6 +226,7 @@ void intel_uc_init_fw(struct drm_i915_private *dev_priv);
 void intel_uc_fini_fw(struct drm_i915_private *dev_priv);
 int intel_uc_init_hw(struct drm_i915_private *dev_priv);
 void intel_uc_fini_hw(struct drm_i915_private *dev_priv);
+void intel_guc_notification_handler(struct intel_guc *guc);
 int intel_guc_sample_forcewake(struct intel_guc *guc);
 int intel_guc_send_nop(struct intel_guc *guc, const u32 *action, u32 len, u32 *response);
 int intel_guc_send_mmio(struct intel_guc *guc, const u32 *action, u32 len, u32 *response);
-- 
2.7.4

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

  parent reply	other threads:[~2017-08-04 16:27 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-04 16:26 [PATCH 00/15] drm/i915/guc: Support for Guc responses and requests Michal Wajdeczko
2017-08-04 16:26 ` [PATCH 01/15] drm/i915/guc: Add support for data reporting in GuC responses Michal Wajdeczko
2017-08-04 20:40   ` Michel Thierry
2017-08-04 21:29     ` Daniele Ceraolo Spurio
2017-08-04 21:54       ` Michal Wajdeczko
2017-08-04 16:26 ` [PATCH 02/15] drm/i915/guc: Prepare send() function to accept bigger response Michal Wajdeczko
2017-08-04 21:13   ` Michel Thierry
2017-08-04 16:27 ` [PATCH 03/15] drm/i915/guc: Add send_and_receive() helper function Michal Wajdeczko
2017-08-04 21:38   ` Michel Thierry
2017-08-04 16:27 ` [PATCH 04/15] drm/i915/guc: Implement response handling in send_mmio() Michal Wajdeczko
2017-08-04 21:43   ` Michel Thierry
2017-08-04 16:27 ` Michal Wajdeczko [this message]
2017-08-04 18:00   ` [PATCH 05/15] drm/i915/guc: Move Guc notification handling to separate function Chris Wilson
2017-08-04 19:35     ` Michal Wajdeczko
2017-08-04 16:27 ` [PATCH 06/15] drm/i915/guc: Move flushing the GuC logs outside notification handler Michal Wajdeczko
2017-08-04 16:27 ` [PATCH 07/15] drm/i915/guc: Create a GuC receive function Michal Wajdeczko
2017-08-04 23:59   ` Michel Thierry
2017-08-04 16:27 ` [PATCH 08/15] drm/i915/guc: Update CT message header definition Michal Wajdeczko
2017-08-04 16:27 ` [PATCH 09/15] drm/i915/guc: Prepare to handle messages from CT RECV buffer Michal Wajdeczko
2017-08-04 16:27 ` [PATCH 10/15] drm/i915/guc: Use better name for helper wait function Michal Wajdeczko
2017-08-04 16:27 ` [PATCH 11/15] drm/i915/guc: Implement response handling in send_ct() Michal Wajdeczko
2017-08-04 16:27 ` [PATCH 12/15] drm/i915/guc: Prepare to process incoming requests from CT Michal Wajdeczko
2017-08-04 17:13   ` Chris Wilson
2017-08-04 19:12     ` Michal Wajdeczko
2017-08-04 16:27 ` [PATCH 13/15] drm/i915/guc: Handle default action received over CT Michal Wajdeczko
2017-08-04 16:27 ` [PATCH 14/15] drm/i915/guc: Enable GuC interrupts when using CT Michal Wajdeczko
2017-08-04 16:27 ` [PATCH 15/15] drm/i915/guc: Trace messages from CT while in debug Michal Wajdeczko
2017-08-04 18:29   ` Chris Wilson
2017-08-04 16:49 ` ✗ Fi.CI.BAT: warning for drm/i915/guc: Support for Guc responses and requests Patchwork
2017-08-07 16:14 ` [PATCH v2 00/16] " Michal Wajdeczko
2017-08-07 16:14   ` [PATCH v2 01/16] drm/i915/guc: Add support for data reporting in GuC responses Michal Wajdeczko
2017-08-07 17:13     ` Michel Thierry
2017-08-07 16:14   ` [PATCH v2 02/16] drm/i915/guc: Prepare send() function to accept bigger response Michal Wajdeczko
2017-08-07 16:14   ` [PATCH v2 03/16] drm/i915/guc: Add send_and_receive() helper function Michal Wajdeczko
2017-08-07 16:14   ` [PATCH v2 04/16] drm/i915/guc: Implement response handling in send_mmio() Michal Wajdeczko
2017-08-07 16:14   ` [PATCH v2 05/16] drm/i915/guc: Move Guc notification handling to separate function Michal Wajdeczko
2017-08-07 16:14   ` [PATCH v2 06/16] drm/i915/guc: Move flushing the GuC logs outside notification handler Michal Wajdeczko
2017-08-07 16:14   ` [PATCH v2 07/16] drm/i915/guc: Create a GuC receive function Michal Wajdeczko
2017-08-07 16:14   ` [PATCH v2 08/16] drm/i915/guc: Update CT message header definition Michal Wajdeczko
2017-08-07 20:38     ` Daniele Ceraolo Spurio
2017-08-07 16:14   ` [PATCH v2 09/16] drm/i915/guc: Prepare to handle messages from CT RECV buffer Michal Wajdeczko
2017-08-07 16:14   ` [PATCH v2 10/16] drm/i915/guc: Use better name for helper wait function Michal Wajdeczko
2017-08-07 16:14   ` [PATCH v2 11/16] drm/i915/guc: Implement response handling in send_ct() Michal Wajdeczko
2017-08-07 16:14   ` [PATCH v2 12/16] drm/i915/guc: Prepare to process incoming requests from CT Michal Wajdeczko
2017-08-07 16:14   ` [PATCH v2 13/16] drm/i915/guc: Handle default action received over CT Michal Wajdeczko
2017-08-07 16:14   ` [PATCH v2 14/16] drm/i915/guc: Enable GuC interrupts when using CT Michal Wajdeczko
2017-08-08 15:26     ` Oscar Mateo
2017-08-07 16:14   ` [PATCH v2 15/16] drm/i915/guc: Trace messages from CT while in debug Michal Wajdeczko
2017-08-07 18:42     ` Daniele Ceraolo Spurio
2017-08-07 16:14   ` [PATCH v2 16/16] HAX Enable GuC loading & submission Michal Wajdeczko
2017-08-07 16:41 ` ✗ Fi.CI.BAT: failure for drm/i915/guc: Support for Guc responses and requests Patchwork
2017-08-08 12:30 ` [PATCH v3 15/16] drm/i915/guc: Trace messages from CT while in debug Michal Wajdeczko
2017-08-10 21:17   ` Daniele Ceraolo Spurio
2017-08-09 16:24 ` [PATCH v3 14/16] drm/i915/guc: Enable GuC interrupts when using CT Michal Wajdeczko
2017-08-09 17:06   ` Oscar Mateo

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=20170804162712.20468-6-michal.wajdeczko@intel.com \
    --to=michal.wajdeczko@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.