[Intel-gfx] [PATCH v4 5/9] drm/i915/guc: Make guc_log_level parameter immutable
Sagar Arun Kamble
sagar.a.kamble at intel.com
Fri Jan 5 08:46:57 UTC 2018
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.
v2: Rebase.
Suggested-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Signed-off-by: Sagar Arun Kamble <sagar.a.kamble at intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko at intel.com>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen at 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 9dac3ee..710b4c4 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_guc_enable_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 7bae6eb..aa6434a 100644
--- a/drivers/gpu/drm/i915/intel_guc_log.c
+++ b/drivers/gpu/drm/i915/intel_guc_log.c
@@ -147,7 +147,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 */
@@ -364,7 +364,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);
@@ -426,7 +426,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;
@@ -463,7 +463,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;
}
@@ -484,7 +484,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 */
@@ -512,9 +512,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 +
@@ -551,7 +548,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;
}
@@ -574,7 +571,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);
@@ -584,7 +581,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
@@ -607,7 +604,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;
@@ -616,7 +613,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 0e1227f..4d9031d 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_guc_enable_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
More information about the Intel-gfx
mailing list