From patchwork Fri Jan 5 08:46:57 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: 10146089 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 F359860244 for ; Fri, 5 Jan 2018 08:43:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EAED6288A1 for ; Fri, 5 Jan 2018 08:43:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DFCF3288A7; Fri, 5 Jan 2018 08:43:42 +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 6183C288A1 for ; Fri, 5 Jan 2018 08:43:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 18B696E2EE; Fri, 5 Jan 2018 08:43:42 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 83FEE6E2EE for ; Fri, 5 Jan 2018 08:43:40 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jan 2018 00:43:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,317,1511856000"; d="scan'208";a="192452323" Received: from sakamble-desktop.iind.intel.com ([10.223.26.10]) by fmsmga005.fm.intel.com with ESMTP; 05 Jan 2018 00:43:38 -0800 From: Sagar Arun Kamble To: intel-gfx@lists.freedesktop.org Date: Fri, 5 Jan 2018 14:16:57 +0530 Message-Id: <1515142021-24232-6-git-send-email-sagar.a.kamble@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1515142021-24232-1-git-send-email-sagar.a.kamble@intel.com> References: <1515142021-24232-1-git-send-email-sagar.a.kamble@intel.com> Subject: [Intel-gfx] [PATCH v4 5/9] 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. v2: Rebase. 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 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; }