All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sagar Arun Kamble <sagar.a.kamble@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 05/11] drm/i915/guc: Make GuC log related functions depend only on log level
Date: Wed, 18 Oct 2017 12:16:56 +0530	[thread overview]
Message-ID: <1508309222-26406-6-git-send-email-sagar.a.kamble@intel.com> (raw)
In-Reply-To: <1508309222-26406-1-git-send-email-sagar.a.kamble@intel.com>

With guc_log_level parameter sanitized we can remove the GuC submission
checks from flush_guc_logs and i915_guc_log_register/unregister and
intel_uc_fini_hw. It is important to note that GuC log runtime/relay
channel data has to be freed during driver unregister.

Freeing of that data can't be gated by guc_log_level check because If we
free GuC log runtime only when log level >=0 then it will not be destroyed
when logging is disabled after enabling before driver unload and driver
will try to destroy during cleanup/fini_hw where relay will be NULL
already.

With this patch GuC interrupts are enabled first after GuC load if logging
is enabled. Earlier they were enabled only when submission was getting
enabled.

GuC to Host interrupts will be needed for GuC CT buffer recv mechanism and
hence we will be adding support to control that interrupt based on ref.
taken by Log or CT recv feature. To prepare for that all interrupt updates
are now gated by GuC log level checks.

v2: Rebase. Updated check in i915_guc_log_unregister to be based on
guc_log_level. (Michal Wajdeczko)

v3: Updated guc_log_unregister again. Made all GuC log related functions
depend only guc_log_level. Updated uC init w.r.t enabling of GuC
interrupts.

Signed-off-by: Sagar Arun Kamble <sagar.a.kamble@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_guc.c     |  3 ++-
 drivers/gpu/drm/i915/intel_guc_log.c | 12 ++++--------
 drivers/gpu/drm/i915/intel_uc.c      | 21 ++++++++++++---------
 3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_guc.c b/drivers/gpu/drm/i915/intel_guc.c
index 31f25e5..959057a 100644
--- a/drivers/gpu/drm/i915/intel_guc.c
+++ b/drivers/gpu/drm/i915/intel_guc.c
@@ -274,7 +274,8 @@ int intel_guc_suspend(struct drm_i915_private *dev_priv)
 	if (guc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS)
 		return 0;
 
-	intel_disable_guc_interrupts(guc);
+	if (i915_modparams.guc_log_level >= 0)
+		intel_disable_guc_interrupts(guc);
 
 	ctx = dev_priv->kernel_context;
 
diff --git a/drivers/gpu/drm/i915/intel_guc_log.c b/drivers/gpu/drm/i915/intel_guc_log.c
index 200f0a1..f87e9f5 100644
--- a/drivers/gpu/drm/i915/intel_guc_log.c
+++ b/drivers/gpu/drm/i915/intel_guc_log.c
@@ -504,8 +504,7 @@ static void guc_log_capture_logs(struct intel_guc *guc)
 
 static void guc_flush_logs(struct intel_guc *guc)
 {
-	if (!i915_modparams.enable_guc_submission ||
-	    (i915_modparams.guc_log_level < 0))
+	if (i915_modparams.guc_log_level < 0)
 		return;
 
 	/* First disable the interrupts, will be renabled afterwards */
@@ -645,8 +644,7 @@ int i915_guc_log_control(struct drm_i915_private *dev_priv, u64 control_val)
 
 void i915_guc_log_register(struct drm_i915_private *dev_priv)
 {
-	if (!i915_modparams.enable_guc_submission ||
-	    (i915_modparams.guc_log_level < 0))
+	if (i915_modparams.guc_log_level < 0)
 		return;
 
 	mutex_lock(&dev_priv->drm.struct_mutex);
@@ -656,12 +654,10 @@ void i915_guc_log_register(struct drm_i915_private *dev_priv)
 
 void i915_guc_log_unregister(struct drm_i915_private *dev_priv)
 {
-	if (!i915_modparams.enable_guc_submission)
-		return;
-
 	mutex_lock(&dev_priv->drm.struct_mutex);
 	/* GuC logging is currently the only user of Guc2Host interrupts */
-	intel_disable_guc_interrupts(&dev_priv->guc);
+	if (i915_modparams.guc_log_level >= 0)
+		intel_disable_guc_interrupts(&dev_priv->guc);
 	guc_log_runtime_destroy(&dev_priv->guc);
 	mutex_unlock(&dev_priv->drm.struct_mutex);
 }
diff --git a/drivers/gpu/drm/i915/intel_uc.c b/drivers/gpu/drm/i915/intel_uc.c
index 8feefcd..95c5ec4 100644
--- a/drivers/gpu/drm/i915/intel_uc.c
+++ b/drivers/gpu/drm/i915/intel_uc.c
@@ -212,18 +212,18 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv)
 	if (ret)
 		goto err_log_capture;
 
+	if (i915_modparams.guc_log_level >= 0)
+		intel_enable_guc_interrupts(guc);
+
 	ret = guc_enable_communication(guc);
 	if (ret)
-		goto err_log_capture;
+		goto err_interrupts;
 
 	intel_huc_auth(&dev_priv->huc);
 	if (i915_modparams.enable_guc_submission) {
-		if (i915_modparams.guc_log_level >= 0)
-			intel_enable_guc_interrupts(guc);
-
 		ret = i915_guc_submission_enable(dev_priv);
 		if (ret)
-			goto err_interrupts;
+			goto err_comm;
 	}
 
 	dev_info(dev_priv->drm.dev, "GuC %s (firmware %s [version %u.%u])\n",
@@ -243,9 +243,11 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv)
 	 * nonfatal error (i.e. it doesn't prevent driver load, but
 	 * marks the GPU as wedged until reset).
 	 */
-err_interrupts:
+err_comm:
 	guc_disable_communication(guc);
-	intel_disable_guc_interrupts(guc);
+err_interrupts:
+	if (i915_modparams.guc_log_level >= 0)
+		intel_disable_guc_interrupts(guc);
 err_log_capture:
 	guc_capture_load_err_log(guc);
 err_submission:
@@ -285,10 +287,11 @@ void intel_uc_fini_hw(struct drm_i915_private *dev_priv)
 
 	guc_disable_communication(&dev_priv->guc);
 
-	if (i915_modparams.enable_guc_submission) {
+	if (i915_modparams.guc_log_level >= 0)
 		intel_disable_guc_interrupts(&dev_priv->guc);
+
+	if (i915_modparams.enable_guc_submission)
 		i915_guc_submission_fini(dev_priv);
-	}
 
 	i915_ggtt_disable_guc(dev_priv);
 }
-- 
1.9.1

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

  parent reply	other threads:[~2017-10-18  6:43 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-18  6:46 [PATCH 00/11] GuC Interrupts/Log updates Sagar Arun Kamble
2017-10-18  6:46 ` [PATCH 01/11] drm/i915: Export low level PM IRQ functions to control from GuC functions Sagar Arun Kamble
2017-10-18 12:42   ` Tvrtko Ursulin
2017-10-18 13:48     ` Sagar Arun Kamble
2017-10-18  6:46 ` [PATCH 02/11] drm/i915/guc: Move GuC interrupts related functions from i915_irq.c to intel_guc.c Sagar Arun Kamble
2017-10-18 12:46   ` Tvrtko Ursulin
2017-10-18 14:06     ` Sagar Arun Kamble
2017-10-18  6:46 ` [PATCH 03/11] drm/i915/guc: Pass intel_guc struct parameter to GuC interrupts functions Sagar Arun Kamble
2017-10-18 12:47   ` Tvrtko Ursulin
2017-10-18  6:46 ` [PATCH 04/11] drm/i915/guc: Sanitize module parameter guc_log_level Sagar Arun Kamble
2017-10-18 12:59   ` Tvrtko Ursulin
2017-10-18 15:50     ` Sagar Arun Kamble
2017-10-19  7:22       ` Tvrtko Ursulin
2017-10-21  8:11         ` Sagar Arun Kamble
2017-10-18  6:46 ` Sagar Arun Kamble [this message]
2017-10-18 13:07   ` [PATCH 05/11] drm/i915/guc: Make GuC log related functions depend only on log level Tvrtko Ursulin
2017-10-18 15:57     ` Sagar Arun Kamble
2017-10-18  6:46 ` [PATCH 06/11] drm/i915/guc: Only release GuC log object during submission_fini Sagar Arun Kamble
2017-10-18 13:12   ` Tvrtko Ursulin
2017-10-18 16:04     ` Sagar Arun Kamble
2017-10-19  7:18       ` Tvrtko Ursulin
2017-10-21  8:09         ` Sagar Arun Kamble
2017-10-18  6:46 ` [PATCH 07/11] drm/i915/guc: Grab RPM wakelock while disabling GuC interrupts Sagar Arun Kamble
2017-10-19 10:09   ` Tvrtko Ursulin
2017-10-21 13:27     ` Sagar Arun Kamble
2017-10-18  6:46 ` [PATCH 08/11] drm/i915/guc: Add client support to enable/disable " Sagar Arun Kamble
2017-10-19 10:19   ` Tvrtko Ursulin
2017-10-21 16:38     ` Sagar Arun Kamble
2017-10-18  6:47 ` [PATCH 09/11] drm/i915/guc: Fix GuC interrupts disabling with Logging Sagar Arun Kamble
2017-10-19 10:24   ` Tvrtko Ursulin
2017-10-21 16:39     ` Sagar Arun Kamble
2017-10-18  6:47 ` [PATCH 10/11] drm/i915/guc: Skip interrupt enabling if logging is already enabled Sagar Arun Kamble
2017-10-19 10:31   ` Tvrtko Ursulin
2017-10-21 16:47     ` Sagar Arun Kamble
2017-10-18  6:47 ` [PATCH 11/11] drm/i915/guc: Restore GuC interrupts across suspend/reset if enabled Sagar Arun Kamble
2017-10-19 11:03   ` Tvrtko Ursulin
2017-10-21 17:09     ` Sagar Arun Kamble
2017-10-18  7:02 ` ✓ Fi.CI.BAT: success for GuC Interrupts/Log updates Patchwork
2017-10-18 13:41 ` ✓ 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=1508309222-26406-6-git-send-email-sagar.a.kamble@intel.com \
    --to=sagar.a.kamble@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.