[Intel-gfx] [PATCH v2 3/4] drm/i915/psr: Control PSR interrupts via debugfs

Chris Wilson chris at chris-wilson.co.uk
Tue Mar 27 10:26:43 UTC 2018


Quoting Dhinakaran Pandiyan (2018-03-27 02:16:22)
> Interrupts other than the one for AUX errors are required only for debug,
> so unmask them via debugfs when the user requests debug.
> 
> User can make such a request with
> echo 1 > <DEBUG_FS>/dri/0/i915_edp_psr_debug
> 
> v2: Unroll loops (Ville)
>     Avoid resetting error mask bits.
> 
> Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
> Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
> Cc: Chris Wilson <chris at chris-wilson.co.uk>
> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan at intel.com>
> ---
>  drivers/gpu/drm/i915/i915_debugfs.c | 36 +++++++++++++++++++++++-
>  drivers/gpu/drm/i915/i915_drv.h     |  1 +
>  drivers/gpu/drm/i915/i915_irq.c     | 55 +++++++++++--------------------------
>  drivers/gpu/drm/i915/intel_drv.h    |  2 ++
>  drivers/gpu/drm/i915/intel_psr.c    | 54 ++++++++++++++++++++++++++++++++++++
>  5 files changed, 108 insertions(+), 40 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 7816cd53100a..6fd801ef7cbb 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -2690,6 +2690,39 @@ static int i915_edp_psr_status(struct seq_file *m, void *data)
>         return 0;
>  }
>  
> +static int
> +i915_edp_psr_debug_set(void *data, u64 val)
> +{
> +       struct drm_i915_private *dev_priv = data;
> +
> +       if (!CAN_PSR(dev_priv))
> +               return -ENODEV;
> +
> +       if (val < 0  || val > 1)
> +               return -EINVAL;
> +
> +       DRM_DEBUG_KMS("%s PSR debug\n", val == 1 ? "Enabling" : "Disabling");
> +       intel_psr_debug_control(dev_priv, val);
> +
> +       return 0;
> +}

A really useful trick for features like this (that we think should be
used wherever it can) is just to enable debug while the debugfs file is
open. igt need only do something like
	openat(debugfs_dir, "i915_edp_psr_debug", O_RDONLY);
and then it will be automatically released and the system returned to
default when terminated. You can then enforce exclusive access or keep an
open count.
-Chris


More information about the Intel-gfx mailing list