[Intel-gfx] [PATCH 1/1] drm/i915: Add debugfs tunable for forcewake hysteresis

Rodrigo Vivi rodrigo.vivi at gmail.com
Mon Mar 16 12:54:09 PDT 2015


This patch was listed to -collector but got a hard conflict.
If it is still needed please consider to rebase and resend.

On Fri, Jan 23, 2015 at 7:46 AM, Mika Kuoppala
<mika.kuoppala at linux.intel.com> wrote:
> Add a tunable to set forcewake hysteresis timer for those
> who want explore the perf/power impacts.
>
> Signed-off-by: Mika Kuoppala <mika.kuoppala at intel.com>
> ---
>  drivers/gpu/drm/i915/i915_debugfs.c | 44 +++++++++++++++++++++++++++++++++++++
>  drivers/gpu/drm/i915/i915_drv.h     |  8 +++++++
>  drivers/gpu/drm/i915/intel_uncore.c | 19 +++++++++++++++-
>  3 files changed, 70 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 2ad4c48..3c55d40 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -1301,6 +1301,9 @@ static int i915_forcewake_domains(struct seq_file *m, void *data)
>                 seq_printf(m, "%s.wake_count = %u\n",
>                            intel_uncore_forcewake_domain_to_str(i),
>                            fw_domain->wake_count);
> +               seq_printf(m, "%s.hyst_ms = %u\n",
> +                          intel_uncore_forcewake_domain_to_str(i),
> +                          jiffies_to_msecs(fw_domain->hyst_jiffies));
>         }
>         spin_unlock_irq(&dev_priv->uncore.lock);
>
> @@ -4321,6 +4324,46 @@ DEFINE_SIMPLE_ATTRIBUTE(i915_cache_sharing_fops,
>                         i915_cache_sharing_get, i915_cache_sharing_set,
>                         "%llu\n");
>
> +static int i915_forcewake_hysteresis_get(void *data, u64 *val)
> +{
> +       struct drm_device *dev = data;
> +       struct drm_i915_private *dev_priv = dev->dev_private;
> +       struct intel_uncore_forcewake_domain *d;
> +       enum forcewake_domain_id id;
> +
> +       spin_lock_irq(&dev_priv->uncore.lock);
> +       /* Same hysteresis for all */
> +       for_each_fw_domain(d, dev_priv, id) {
> +               *val = fw_domain_get_hysteresis(d);
> +               break;
> +       }
> +       spin_unlock_irq(&dev_priv->uncore.lock);
> +
> +       return 0;
> +}
> +
> +static int i915_forcewake_hysteresis_set(void *data, u64 val)
> +{
> +       struct drm_device *dev = data;
> +       struct drm_i915_private *dev_priv = dev->dev_private;
> +       struct intel_uncore_forcewake_domain *d;
> +       enum forcewake_domain_id id;
> +
> +       spin_lock_irq(&dev_priv->uncore.lock);
> +       /* Same hysteresis for all */
> +       for_each_fw_domain(d, dev_priv, id)
> +               fw_domain_set_hysteresis(d, val);
> +
> +       spin_unlock_irq(&dev_priv->uncore.lock);
> +
> +       return 0;
> +}
> +
> +DEFINE_SIMPLE_ATTRIBUTE(i915_forcewake_hysteresis_fops,
> +                       i915_forcewake_hysteresis_get,
> +                       i915_forcewake_hysteresis_set,
> +                       "%llu\n");
> +
>  static int i915_forcewake_open(struct inode *inode, struct file *file)
>  {
>         struct drm_device *dev = inode->i_private;
> @@ -4455,6 +4498,7 @@ static const struct i915_debugfs_files {
>         {"i915_spr_wm_latency", &i915_spr_wm_latency_fops},
>         {"i915_cur_wm_latency", &i915_cur_wm_latency_fops},
>         {"i915_fbc_false_color", &i915_fbc_fc_fops},
> +       {"i915_forcewake_hysteresis", &i915_forcewake_hysteresis_fops},
>  };
>
>  void intel_display_crc_init(struct drm_device *dev)
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 0d67b17..6b10dc1 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -630,6 +630,7 @@ struct intel_uncore {
>                 enum forcewake_domain_id id;
>                 unsigned wake_count;
>                 struct timer_list timer;
> +               unsigned long hyst_jiffies;
>                 u32 reg_set;
>                 u32 val_set;
>                 u32 val_clear;
> @@ -2578,6 +2579,13 @@ void intel_uncore_forcewake_put(struct drm_i915_private *dev_priv,
>  void assert_forcewakes_inactive(struct drm_i915_private *dev_priv);
>
>  void
> +fw_domain_set_hysteresis(struct intel_uncore_forcewake_domain *d,
> +                             unsigned hyst_ms);
> +unsigned
> +fw_domain_get_hysteresis(const struct intel_uncore_forcewake_domain *d);
> +
> +
> +void
>  i915_enable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe,
>                      u32 status_mask);
>
> diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
> index b3951f2..723698c 100644
> --- a/drivers/gpu/drm/i915/intel_uncore.c
> +++ b/drivers/gpu/drm/i915/intel_uncore.c
> @@ -62,6 +62,22 @@ intel_uncore_forcewake_domain_to_str(const enum forcewake_domain_id id)
>         return "unknown";
>  }
>
> +void
> +fw_domain_set_hysteresis(struct intel_uncore_forcewake_domain *d,
> +                        unsigned hyst_ms)
> +{
> +       d->hyst_jiffies = msecs_to_jiffies_timeout(hyst_ms);
> +
> +       if (d->hyst_jiffies == 0)
> +               d->hyst_jiffies = 1;
> +}
> +
> +unsigned
> +fw_domain_get_hysteresis(const struct intel_uncore_forcewake_domain *d)
> +{
> +       return jiffies_to_msecs(d->hyst_jiffies);
> +}
> +
>  static void
>  assert_device_not_suspended(struct drm_i915_private *dev_priv)
>  {
> @@ -78,7 +94,7 @@ fw_domain_reset(const struct intel_uncore_forcewake_domain *d)
>  static inline void
>  fw_domain_arm_timer(struct intel_uncore_forcewake_domain *d)
>  {
> -       mod_timer_pinned(&d->timer, jiffies + 1);
> +       mod_timer_pinned(&d->timer, jiffies + d->hyst_jiffies);
>  }
>
>  static inline void
> @@ -956,6 +972,7 @@ static void fw_domain_init(struct drm_i915_private *dev_priv,
>         WARN_ON(d->wake_count);
>
>         d->wake_count = 0;
> +       d->hyst_jiffies = 1;
>         d->reg_set = reg_set;
>         d->reg_ack = reg_ack;
>
> --
> 1.9.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx



-- 
Rodrigo Vivi
Blog: http://blog.vivi.eng.br


More information about the Intel-gfx mailing list