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 v3 08/12] drm/i915/guc: Make guc_log_level parameter immutable
Date: Thu,  4 Jan 2018 21:51:50 +0530	[thread overview]
Message-ID: <1515082914-4111-9-git-send-email-sagar.a.kamble@intel.com> (raw)
In-Reply-To: <1515082914-4111-1-git-send-email-sagar.a.kamble@intel.com>

This patch introduces i915 internal state variable in GuC log struct,
"level" which will be copied from guc_log_level modparam during i915
load and thereafter be available for user updates. This will make
guc_log_level parameter immutable.

Suggested-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
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/i915_debugfs.c  |  2 +-
 drivers/gpu/drm/i915/intel_guc.c     |  6 +++---
 drivers/gpu/drm/i915/intel_guc_log.c | 23 ++++++++++-------------
 drivers/gpu/drm/i915/intel_guc_log.h |  6 ++++++
 drivers/gpu/drm/i915/intel_uc.c      | 11 +++++++++--
 5 files changed, 29 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 2bb6307..16f9a95 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2459,7 +2459,7 @@ static int i915_guc_log_control_get(void *data, u64 *val)
 	if (!dev_priv->guc.log.vma)
 		return -EINVAL;
 
-	*val = i915_modparams.guc_log_level;
+	*val = dev_priv->guc.log.level;
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/i915/intel_guc.c b/drivers/gpu/drm/i915/intel_guc.c
index 0184c86..d351642 100644
--- a/drivers/gpu/drm/i915/intel_guc.c
+++ b/drivers/gpu/drm/i915/intel_guc.c
@@ -253,9 +253,9 @@ void intel_guc_init_params(struct intel_guc *guc)
 
 	params[GUC_CTL_LOG_PARAMS] = guc->log.flags;
 
-	if (i915_modparams.guc_log_level >= 0) {
+	if (guc->log.level >= 0) {
 		params[GUC_CTL_DEBUG] =
-			i915_modparams.guc_log_level << GUC_LOG_VERBOSITY_SHIFT;
+			guc->log.level << GUC_LOG_VERBOSITY_SHIFT;
 	} else {
 		params[GUC_CTL_DEBUG] = GUC_LOG_DISABLED;
 	}
@@ -451,7 +451,7 @@ int intel_guc_resume(struct drm_i915_private *dev_priv)
 	if (guc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS)
 		return 0;
 
-	if (i915_modparams.guc_log_level >= 0)
+	if (guc->log.level >= 0)
 		intel_enable_guc_interrupts(guc);
 
 	data[0] = INTEL_GUC_ACTION_EXIT_S_STATE;
diff --git a/drivers/gpu/drm/i915/intel_guc_log.c b/drivers/gpu/drm/i915/intel_guc_log.c
index 3a895a3..d979830 100644
--- a/drivers/gpu/drm/i915/intel_guc_log.c
+++ b/drivers/gpu/drm/i915/intel_guc_log.c
@@ -148,7 +148,7 @@ static int guc_log_relay_file_create(struct intel_guc *guc)
 	struct dentry *log_dir;
 	int ret;
 
-	if (i915_modparams.guc_log_level < 0)
+	if (guc->log.level < 0)
 		return 0;
 
 	/* For now create the log file in /sys/kernel/debug/dri/0 dir */
@@ -365,7 +365,7 @@ int intel_guc_log_runtime_create(struct intel_guc *guc)
 	size_t n_subbufs, subbuf_size;
 	int ret;
 
-	if (i915_modparams.guc_log_level < 0)
+	if (guc->log.level < 0)
 		return 0;
 
 	lockdep_assert_held(&dev_priv->drm.struct_mutex);
@@ -427,7 +427,7 @@ void intel_guc_log_runtime_destroy(struct intel_guc *guc)
 {
 	/*
 	 * It's possible that the runtime stuff was never allocated because
-	 * guc_log_level was < 0 at the time
+	 * guc->log.level was < 0 at the time
 	 **/
 	if (!guc_log_has_runtime(guc))
 		return;
@@ -464,7 +464,7 @@ static int guc_log_late_setup(struct intel_guc *guc)
 	intel_guc_log_runtime_destroy(guc);
 err:
 	/* logging will remain off */
-	i915_modparams.guc_log_level = -1;
+	guc->log.level = -1;
 	return ret;
 }
 
@@ -485,7 +485,7 @@ static void guc_log_capture_logs(struct intel_guc *guc)
 static void guc_flush_logs(struct intel_guc *guc)
 {
 	if (!USES_GUC_SUBMISSION(dev_priv) ||
-	    (i915_modparams.guc_log_level < 0))
+	    guc->log.level < 0)
 		return;
 
 	/* First disable the interrupts, will be renabled afterwards */
@@ -513,9 +513,6 @@ int intel_guc_log_create(struct intel_guc *guc)
 
 	GEM_BUG_ON(guc->log.vma);
 
-	if (i915_modparams.guc_log_level > GUC_LOG_VERBOSITY_MAX)
-		i915_modparams.guc_log_level = GUC_LOG_VERBOSITY_MAX;
-
 	/* The first page is to save log buffer state. Allocate one
 	 * extra page for others in case for overlap */
 	size = (1 + GUC_LOG_DPC_PAGES + 1 +
@@ -552,7 +549,7 @@ int intel_guc_log_create(struct intel_guc *guc)
 
 err:
 	/* logging will be off */
-	i915_modparams.guc_log_level = -1;
+	guc->log.level = -1;
 	return ret;
 }
 
@@ -575,7 +572,7 @@ int i915_guc_log_control(struct drm_i915_private *dev_priv, u64 control_val)
 		return -EINVAL;
 
 	/* This combination doesn't make sense & won't have any effect */
-	if (!log_param.logging_enabled && (i915_modparams.guc_log_level < 0))
+	if (!log_param.logging_enabled && guc->log.level < 0)
 		return 0;
 
 	ret = guc_log_control(guc, log_param.value);
@@ -585,7 +582,7 @@ int i915_guc_log_control(struct drm_i915_private *dev_priv, u64 control_val)
 	}
 
 	if (log_param.logging_enabled) {
-		i915_modparams.guc_log_level = log_param.verbosity;
+		guc->log.level = log_param.verbosity;
 
 		/* If log_level was set as -1 at boot time, then the relay channel file
 		 * wouldn't have been created by now and interrupts also would not have
@@ -608,7 +605,7 @@ int i915_guc_log_control(struct drm_i915_private *dev_priv, u64 control_val)
 		guc_flush_logs(guc);
 
 		/* As logging is disabled, update log level to reflect that */
-		i915_modparams.guc_log_level = -1;
+		guc->log.level = -1;
 	}
 
 	return ret;
@@ -617,7 +614,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 (!USES_GUC_SUBMISSION(dev_priv) ||
-	    (i915_modparams.guc_log_level < 0))
+	    dev_priv->guc.log.level < 0)
 		return;
 
 	mutex_lock(&dev_priv->drm.struct_mutex);
diff --git a/drivers/gpu/drm/i915/intel_guc_log.h b/drivers/gpu/drm/i915/intel_guc_log.h
index 345447a..362bbef 100644
--- a/drivers/gpu/drm/i915/intel_guc_log.h
+++ b/drivers/gpu/drm/i915/intel_guc_log.h
@@ -33,6 +33,12 @@
 struct intel_guc;
 
 struct intel_guc_log {
+	/*
+	 * Current GuC firmware logging level. This depends on kernel parameter
+	 * guc_log_level during load and thereafter on user requests. It has
+	 * similar semantics as guc_log_level. (-1:disabled, "0-3:enabled)")
+	 */
+	int level;
 	u32 flags;
 	struct i915_vma *vma;
 	/* The runtime stuff gets created only when GuC logging gets enabled */
diff --git a/drivers/gpu/drm/i915/intel_uc.c b/drivers/gpu/drm/i915/intel_uc.c
index bc7f549..e2e2020 100644
--- a/drivers/gpu/drm/i915/intel_uc.c
+++ b/drivers/gpu/drm/i915/intel_uc.c
@@ -107,6 +107,11 @@ void intel_uc_sanitize_options(struct drm_i915_private *dev_priv)
 
 	/* Make sure that sanitization was done */
 	GEM_BUG_ON(i915_modparams.enable_guc < 0);
+
+	if (i915_modparams.guc_log_level > GUC_LOG_VERBOSITY_MAX)
+		i915_modparams.guc_log_level = GUC_LOG_VERBOSITY_MAX;
+
+	dev_priv->guc.log.level = i915_modparams.guc_log_level;
 }
 
 void intel_uc_init_early(struct drm_i915_private *dev_priv)
@@ -152,7 +157,7 @@ void intel_uc_init_mmio(struct drm_i915_private *dev_priv)
 
 static void guc_capture_load_err_log(struct intel_guc *guc)
 {
-	if (!guc->log.vma || i915_modparams.guc_log_level < 0)
+	if (!guc->log.vma || guc->log.level < 0)
 		return;
 
 	if (!guc->load_err_log)
@@ -324,7 +329,7 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv)
 	}
 
 	if (USES_GUC_SUBMISSION(dev_priv)) {
-		if (i915_modparams.guc_log_level >= 0)
+		if (guc->log.level >= 0)
 			intel_enable_guc_interrupts(guc);
 
 		ret = intel_guc_submission_enable(guc);
@@ -358,6 +363,8 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv)
 	if (GEM_WARN_ON(ret == -EIO))
 		ret = -EINVAL;
 
+	guc->log.level = -1;
+
 	dev_err(dev_priv->drm.dev, "GuC initialization failed %d\n", ret);
 	return ret;
 }
-- 
1.9.1

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

  parent reply	other threads:[~2018-01-04 16:18 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-04 16:21 [PATCH v3 00/12] GuC Interrupts/Log updates Sagar Arun Kamble
2018-01-04 16:21 ` [PATCH v3 01/12] drm/i915: Export low level PM IRQ functions to use from GuC functions Sagar Arun Kamble
2018-01-04 16:21 ` [PATCH v3 02/12] drm/i915/guc: Move GuC interrupts related functions from i915_irq.c to intel_guc.c Sagar Arun Kamble
2018-01-04 16:21 ` [PATCH v3 03/12] drm/i915/guc: Pass intel_guc struct parameter to GuC interrupts functions Sagar Arun Kamble
2018-01-04 16:23   ` Chris Wilson
2018-01-04 16:31     ` Michal Wajdeczko
2018-01-05  4:30       ` Sagar Arun Kamble
2018-01-04 17:22   ` Michal Wajdeczko
2018-01-05  5:00     ` Sagar Arun Kamble
2018-01-04 16:21 ` [PATCH v3 04/12] drm/i915/guc: Add description and comments about guc_log_level parameter Sagar Arun Kamble
2018-01-04 16:52   ` Michal Wajdeczko
2018-01-05  4:54     ` Sagar Arun Kamble
2018-01-05  8:53       ` Sagar Arun Kamble
2018-01-04 16:21 ` [PATCH v3 05/12] drm/i915/guc: Fix GuC interrupts disabling with logging Sagar Arun Kamble
2018-01-04 16:21 ` [PATCH v3 06/12] drm/i915/guc: Separate creation/release of runtime logging data from base logging data Sagar Arun Kamble
2018-01-04 16:21 ` [PATCH v3 07/12] drm/i915/guc: Grab RPM wakelock while disabling GuC interrupts Sagar Arun Kamble
2018-01-04 16:21 ` Sagar Arun Kamble [this message]
2018-01-04 16:21 ` [PATCH v3 09/12] drm/i915/guc: Make GuC log related functions depend only on log level Sagar Arun Kamble
2018-01-04 17:15   ` Michal Wajdeczko
2018-01-05  4:58     ` Sagar Arun Kamble
2018-01-04 16:21 ` [PATCH v3 10/12] drm/i915/guc: Add client support to enable/disable GuC interrupts Sagar Arun Kamble
2018-01-04 17:39   ` Michal Wajdeczko
2018-01-05  5:07     ` Sagar Arun Kamble
2018-01-04 16:21 ` [PATCH v3 11/12] drm/i915/guc: Restore GuC interrupts across suspend/reset if enabled Sagar Arun Kamble
2018-01-04 17:49   ` Michal Wajdeczko
2018-01-05  5:13     ` Sagar Arun Kamble
2018-01-04 16:21 ` [PATCH v3 12/12] HAX: drm/i915/guc: enable GuC submission/logging for CI Sagar Arun Kamble
2018-01-04 16:29   ` Chris Wilson
2018-01-05  4:37     ` Sagar Arun Kamble
2018-01-04 16:45 ` ✗ Fi.CI.BAT: failure for GuC Interrupts/Log updates (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=1515082914-4111-9-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.