public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Sagar Arun Kamble <sagar.a.kamble@intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 08/11] drm/i915/guc: Add client support to enable/disable GuC interrupts
Date: Thu, 19 Oct 2017 11:19:06 +0100	[thread overview]
Message-ID: <d39fabc8-b77b-68c5-e1dd-754283a83f92@linux.intel.com> (raw)
In-Reply-To: <1508309222-26406-9-git-send-email-sagar.a.kamble@intel.com>


On 18/10/2017 07:46, Sagar Arun Kamble wrote:
> 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 <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  |  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))

Could use test_bit.

Also, spinlock not required here apart from documentation purposes?

> +		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);

Can use __set_bit to save one atomic since it is already under the spinlock.

> +
>   	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);

Equally as above __clear_bit would work.

> +
> +	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);
> 

With the bit ops tidy:

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

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

  reply	other threads:[~2017-10-19 10:19 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-18  6:46 [PATCH 00/11] GuC Interrupts/Log updates Sagar Arun Kamble
2017-10-18  6:46 ` [PATCH 01/11] drm/i915: Export low level PM IRQ functions to control from GuC functions Sagar Arun Kamble
2017-10-18 12:42   ` Tvrtko Ursulin
2017-10-18 13:48     ` Sagar Arun Kamble
2017-10-18  6:46 ` [PATCH 02/11] drm/i915/guc: Move GuC interrupts related functions from i915_irq.c to intel_guc.c Sagar Arun Kamble
2017-10-18 12:46   ` Tvrtko Ursulin
2017-10-18 14:06     ` Sagar Arun Kamble
2017-10-18  6:46 ` [PATCH 03/11] drm/i915/guc: Pass intel_guc struct parameter to GuC interrupts functions Sagar Arun Kamble
2017-10-18 12:47   ` Tvrtko Ursulin
2017-10-18  6:46 ` [PATCH 04/11] drm/i915/guc: Sanitize module parameter guc_log_level Sagar Arun Kamble
2017-10-18 12:59   ` Tvrtko Ursulin
2017-10-18 15:50     ` Sagar Arun Kamble
2017-10-19  7:22       ` Tvrtko Ursulin
2017-10-21  8:11         ` Sagar Arun Kamble
2017-10-18  6:46 ` [PATCH 05/11] drm/i915/guc: Make GuC log related functions depend only on log level Sagar Arun Kamble
2017-10-18 13:07   ` Tvrtko Ursulin
2017-10-18 15:57     ` Sagar Arun Kamble
2017-10-18  6:46 ` [PATCH 06/11] drm/i915/guc: Only release GuC log object during submission_fini Sagar Arun Kamble
2017-10-18 13:12   ` Tvrtko Ursulin
2017-10-18 16:04     ` Sagar Arun Kamble
2017-10-19  7:18       ` Tvrtko Ursulin
2017-10-21  8:09         ` Sagar Arun Kamble
2017-10-18  6:46 ` [PATCH 07/11] drm/i915/guc: Grab RPM wakelock while disabling GuC interrupts Sagar Arun Kamble
2017-10-19 10:09   ` Tvrtko Ursulin
2017-10-21 13:27     ` Sagar Arun Kamble
2017-10-18  6:46 ` [PATCH 08/11] drm/i915/guc: Add client support to enable/disable " Sagar Arun Kamble
2017-10-19 10:19   ` Tvrtko Ursulin [this message]
2017-10-21 16:38     ` Sagar Arun Kamble
2017-10-18  6:47 ` [PATCH 09/11] drm/i915/guc: Fix GuC interrupts disabling with Logging Sagar Arun Kamble
2017-10-19 10:24   ` Tvrtko Ursulin
2017-10-21 16:39     ` Sagar Arun Kamble
2017-10-18  6:47 ` [PATCH 10/11] drm/i915/guc: Skip interrupt enabling if logging is already enabled Sagar Arun Kamble
2017-10-19 10:31   ` Tvrtko Ursulin
2017-10-21 16:47     ` Sagar Arun Kamble
2017-10-18  6:47 ` [PATCH 11/11] drm/i915/guc: Restore GuC interrupts across suspend/reset if enabled Sagar Arun Kamble
2017-10-19 11:03   ` Tvrtko Ursulin
2017-10-21 17:09     ` Sagar Arun Kamble
2017-10-18  7:02 ` ✓ Fi.CI.BAT: success for GuC Interrupts/Log updates Patchwork
2017-10-18 13:41 ` ✓ Fi.CI.IGT: " 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=d39fabc8-b77b-68c5-e1dd-754283a83f92@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=sagar.a.kamble@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox