From patchwork Thu Jan 4 16:21:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sagar.a.kamble@intel.com X-Patchwork-Id: 10145115 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 310CE601A1 for ; Thu, 4 Jan 2018 16:19:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B383286EB for ; Thu, 4 Jan 2018 16:19:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1006B286EF; Thu, 4 Jan 2018 16:19:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 58CC6286E7 for ; Thu, 4 Jan 2018 16:19:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A54106E1A3; Thu, 4 Jan 2018 16:18:59 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9F0CC6E194 for ; Thu, 4 Jan 2018 16:18:58 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Jan 2018 08:18:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,507,1508828400"; d="scan'208";a="24309189" Received: from sakamble-desktop.iind.intel.com ([10.223.26.10]) by orsmga002.jf.intel.com with ESMTP; 04 Jan 2018 08:18:40 -0800 From: Sagar Arun Kamble To: intel-gfx@lists.freedesktop.org Date: Thu, 4 Jan 2018 21:51:50 +0530 Message-Id: <1515082914-4111-9-git-send-email-sagar.a.kamble@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1515082914-4111-1-git-send-email-sagar.a.kamble@intel.com> References: <1515082914-4111-1-git-send-email-sagar.a.kamble@intel.com> Subject: [Intel-gfx] [PATCH v3 08/12] drm/i915/guc: Make guc_log_level parameter immutable X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Sagar Arun Kamble Cc: Michal Wajdeczko Cc: Daniele Ceraolo Spurio Cc: Tvrtko Ursulin Cc: Chris Wilson Cc: Joonas Lahtinen --- 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; }