From patchwork Wed Oct 18 06:46:59 2017 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: 10013507 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 B2BD2602C8 for ; Wed, 18 Oct 2017 06:43:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A553A28AD1 for ; Wed, 18 Oct 2017 06:43:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A39928AD4; Wed, 18 Oct 2017 06:43:59 +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 F1B0028AD1 for ; Wed, 18 Oct 2017 06:43:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A7E596E7E7; Wed, 18 Oct 2017 06:43:58 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id F07186E7E7 for ; Wed, 18 Oct 2017 06:43:55 +0000 (UTC) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Oct 2017 23:43:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,394,1503385200"; d="scan'208";a="161751241" Received: from sakamble-desktop.iind.intel.com ([10.223.26.118]) by orsmga005.jf.intel.com with ESMTP; 17 Oct 2017 23:43:53 -0700 From: Sagar Arun Kamble To: intel-gfx@lists.freedesktop.org Date: Wed, 18 Oct 2017 12:16:59 +0530 Message-Id: <1508309222-26406-9-git-send-email-sagar.a.kamble@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1508309222-26406-1-git-send-email-sagar.a.kamble@intel.com> References: <1508309222-26406-1-git-send-email-sagar.a.kamble@intel.com> Subject: [Intel-gfx] [PATCH 08/11] drm/i915/guc: Add client support to enable/disable GuC interrupts 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 adds support to enable/disable GuC interrupts for different features without impacting others needs. Currently GuC log capture and CT buffer receive mechanisms use the GuC interrupts. GuC interrupts are currently enabled and disabled in different Logging scenarios all gated by log level. v2: Rebase with all GuC interrupt handlers moved to intel_guc.c. Handling multiple clients for GuC interrupts enable/disable. (Michal Wajdeczko) Signed-off-by: Sagar Arun Kamble Cc: Michal Wajdeczko Cc: Daniele Ceraolo Spurio Cc: Tvrtko Ursulin Cc: Chris Wilson Cc: Joonas Lahtinen Reviewed-by: Tvrtko Ursulin --- drivers/gpu/drm/i915/i915_debugfs.c | 8 ++++++++ drivers/gpu/drm/i915/intel_guc.c | 21 ++++++++++++++------- drivers/gpu/drm/i915/intel_guc.h | 11 ++++++++--- drivers/gpu/drm/i915/intel_guc_log.c | 6 +++--- drivers/gpu/drm/i915/intel_uc.c | 6 +++--- 5 files changed, 36 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 0bb6e01..bd421da 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -2531,6 +2531,14 @@ static int i915_guc_info(struct seq_file *m, void *data) struct drm_i915_private *dev_priv = node_to_i915(m->private); const struct intel_guc *guc = &dev_priv->guc; + seq_puts(m, "GuC Interrupt Clients: "); + spin_lock_irq(&dev_priv->irq_lock); + if (guc->interrupt_clients & BIT(GUC_INTR_CLIENT_LOG)) + seq_puts(m, "GuC Logging\n"); + else + seq_puts(m, "None\n"); + spin_unlock_irq(&dev_priv->irq_lock); + if (!check_guc_submission(m)) return 0; diff --git a/drivers/gpu/drm/i915/intel_guc.c b/drivers/gpu/drm/i915/intel_guc.c index 959057a..fbd27ea 100644 --- a/drivers/gpu/drm/i915/intel_guc.c +++ b/drivers/gpu/drm/i915/intel_guc.c @@ -275,7 +275,7 @@ int intel_guc_suspend(struct drm_i915_private *dev_priv) return 0; if (i915_modparams.guc_log_level >= 0) - intel_disable_guc_interrupts(guc); + intel_put_guc_interrupts(guc, GUC_INTR_CLIENT_LOG); ctx = dev_priv->kernel_context; @@ -303,7 +303,7 @@ int intel_guc_resume(struct drm_i915_private *dev_priv) return 0; if (i915_modparams.guc_log_level >= 0) - intel_enable_guc_interrupts(guc); + intel_get_guc_interrupts(guc, GUC_INTR_CLIENT_LOG); ctx = dev_priv->kernel_context; @@ -378,26 +378,33 @@ void intel_reset_guc_interrupts(struct intel_guc *guc) spin_unlock_irq(&dev_priv->irq_lock); } -void intel_enable_guc_interrupts(struct intel_guc *guc) +void intel_get_guc_interrupts(struct intel_guc *guc, enum guc_intr_client id) { struct drm_i915_private *dev_priv = guc_to_i915(guc); spin_lock_irq(&dev_priv->irq_lock); - if (!dev_priv->guc.interrupts_enabled) { + if (!guc->interrupt_clients) { WARN_ON_ONCE(I915_READ(gen6_pm_iir(dev_priv)) & dev_priv->pm_guc_events); - dev_priv->guc.interrupts_enabled = true; gen6_enable_pm_irq(dev_priv, dev_priv->pm_guc_events); } + set_bit(id, &guc->interrupt_clients); + spin_unlock_irq(&dev_priv->irq_lock); } -void intel_disable_guc_interrupts(struct intel_guc *guc) +void intel_put_guc_interrupts(struct intel_guc *guc, enum guc_intr_client id) { struct drm_i915_private *dev_priv = guc_to_i915(guc); spin_lock_irq(&dev_priv->irq_lock); - dev_priv->guc.interrupts_enabled = false; + + clear_bit(id, &guc->interrupt_clients); + + if (guc->interrupt_clients) { + spin_unlock_irq(&dev_priv->irq_lock); + return; + } gen6_disable_pm_irq(dev_priv, dev_priv->pm_guc_events); diff --git a/drivers/gpu/drm/i915/intel_guc.h b/drivers/gpu/drm/i915/intel_guc.h index e89b4ae..4d58bf7 100644 --- a/drivers/gpu/drm/i915/intel_guc.h +++ b/drivers/gpu/drm/i915/intel_guc.h @@ -34,6 +34,11 @@ #include "i915_guc_reg.h" #include "i915_vma.h" +enum guc_intr_client { + GUC_INTR_CLIENT_LOG = 0, + GUC_INTR_CLIENT_COUNT +}; + /* * Top level structure of GuC. It handles firmware loading and manages client * pool and doorbells. intel_guc owns a i915_guc_client to replace the legacy @@ -48,7 +53,7 @@ struct intel_guc { struct drm_i915_gem_object *load_err_log; /* intel_guc_recv interrupt related state */ - bool interrupts_enabled; + unsigned long interrupt_clients; struct i915_vma *ads_vma; struct i915_vma *stage_desc_pool; @@ -117,8 +122,8 @@ static inline u32 guc_ggtt_offset(struct i915_vma *vma) struct i915_vma *intel_guc_allocate_vma(struct intel_guc *guc, u32 size); u32 intel_guc_wopcm_size(struct drm_i915_private *dev_priv); void intel_reset_guc_interrupts(struct intel_guc *guc); -void intel_enable_guc_interrupts(struct intel_guc *guc); -void intel_disable_guc_interrupts(struct intel_guc *guc); +void intel_get_guc_interrupts(struct intel_guc *guc, enum guc_intr_client id); +void intel_put_guc_interrupts(struct intel_guc *guc, enum guc_intr_client id); void intel_guc_irq_handler(struct intel_guc *guc, u32 pm_iir); #endif diff --git a/drivers/gpu/drm/i915/intel_guc_log.c b/drivers/gpu/drm/i915/intel_guc_log.c index ed239cb..8c41d9a 100644 --- a/drivers/gpu/drm/i915/intel_guc_log.c +++ b/drivers/gpu/drm/i915/intel_guc_log.c @@ -508,7 +508,7 @@ static void guc_flush_logs(struct intel_guc *guc) return; /* First disable the interrupts, will be renabled afterwards */ - intel_disable_guc_interrupts(guc); + intel_put_guc_interrupts(guc, GUC_INTR_CLIENT_LOG); /* Before initiating the forceful flush, wait for any pending/ongoing * flush to complete otherwise forceful flush may not actually happen. @@ -626,7 +626,7 @@ int i915_guc_log_control(struct drm_i915_private *dev_priv, u64 control_val) } /* GuC logging is currently the only user of Guc2Host interrupts */ - intel_enable_guc_interrupts(guc); + intel_get_guc_interrupts(guc, GUC_INTR_CLIENT_LOG); } else { /* Once logging is disabled, GuC won't generate logs & send an * interrupt. But there could be some data in the log buffer @@ -658,7 +658,7 @@ void i915_guc_log_unregister(struct drm_i915_private *dev_priv) /* GuC logging is currently the only user of Guc2Host interrupts */ if (i915_modparams.guc_log_level >= 0) { intel_runtime_pm_get(dev_priv); - intel_disable_guc_interrupts(&dev_priv->guc); + intel_put_guc_interrupts(&dev_priv->guc, GUC_INTR_CLIENT_LOG); intel_runtime_pm_put(dev_priv); } /* diff --git a/drivers/gpu/drm/i915/intel_uc.c b/drivers/gpu/drm/i915/intel_uc.c index 95c5ec4..d96c847 100644 --- a/drivers/gpu/drm/i915/intel_uc.c +++ b/drivers/gpu/drm/i915/intel_uc.c @@ -213,7 +213,7 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv) goto err_log_capture; if (i915_modparams.guc_log_level >= 0) - intel_enable_guc_interrupts(guc); + intel_get_guc_interrupts(guc, GUC_INTR_CLIENT_LOG); ret = guc_enable_communication(guc); if (ret) @@ -247,7 +247,7 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv) guc_disable_communication(guc); err_interrupts: if (i915_modparams.guc_log_level >= 0) - intel_disable_guc_interrupts(guc); + intel_put_guc_interrupts(guc, GUC_INTR_CLIENT_LOG); err_log_capture: guc_capture_load_err_log(guc); err_submission: @@ -288,7 +288,7 @@ void intel_uc_fini_hw(struct drm_i915_private *dev_priv) guc_disable_communication(&dev_priv->guc); if (i915_modparams.guc_log_level >= 0) - intel_disable_guc_interrupts(&dev_priv->guc); + intel_put_guc_interrupts(&dev_priv->guc, GUC_INTR_CLIENT_LOG); if (i915_modparams.enable_guc_submission) i915_guc_submission_fini(dev_priv);