diff mbox

drm/i915: debugfs interface to read module parameters

Message ID 1422015926-10406-1-git-send-email-david.s.gordon@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dave Gordon Jan. 23, 2015, 12:25 p.m. UTC
It can be useful to know what the driver's parameters have ended up set
to after sanitisation, so this commit adds a debugfs function to print
the current values of all the module parameters.
---
 drivers/gpu/drm/i915/i915_debugfs.c |   45 +++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

Comments

Ville Syrjälä Jan. 23, 2015, 12:35 p.m. UTC | #1
On Fri, Jan 23, 2015 at 12:25:26PM +0000, Dave Gordon wrote:
> It can be useful to know what the driver's parameters have ended up set
> to after sanitisation, so this commit adds a debugfs function to print
> the current values of all the module parameters.

What's wrong with eg. 'grep . /sys/module/i915/parameters/*' ?

> ---
>  drivers/gpu/drm/i915/i915_debugfs.c |   45 +++++++++++++++++++++++++++++++++++
>  1 file changed, 45 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 2ad4c48..9d75efc 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -2819,6 +2819,50 @@ static int i915_ddb_info(struct seq_file *m, void *unused)
>  	return 0;
>  }
>  
> +static int i915_params(struct seq_file *m, void *unused)
> +{
> +	size_t extra;
> +
> +	seq_printf(m, "i915.%s=%d\n", "modeset", i915.modeset);
> +	seq_printf(m, "i915.%s=%d\n", "panel_ignore_lid", i915.panel_ignore_lid);
> +	seq_printf(m, "i915.%s=%u\n", "powersave", i915.powersave);
> +	seq_printf(m, "i915.%s=%d\n", "semaphores", i915.semaphores);
> +	seq_printf(m, "i915.%s=%u\n", "lvds_downclock", i915.lvds_downclock);
> +	seq_printf(m, "i915.%s=%d\n", "lvds_channel_mode", i915.lvds_channel_mode);
> +	seq_printf(m, "i915.%s=%d\n", "panel_use_ssc", i915.panel_use_ssc);
> +	seq_printf(m, "i915.%s=%d\n", "vbt_sdvo_panel_type", i915.vbt_sdvo_panel_type);
> +	seq_printf(m, "i915.%s=%d\n", "enable_rc6", i915.enable_rc6);
> +	seq_printf(m, "i915.%s=%d\n", "enable_fbc", i915.enable_fbc);
> +	seq_printf(m, "i915.%s=%d\n", "enable_ppgtt", i915.enable_ppgtt);
> +	seq_printf(m, "i915.%s=%d\n", "enable_execlists", i915.enable_execlists);
> +	seq_printf(m, "i915.%s=%d\n", "enable_psr", i915.enable_psr);
> +	seq_printf(m, "i915.%s=%u\n", "preliminary_hw_support", i915.preliminary_hw_support);
> +	seq_printf(m, "i915.%s=%d\n", "disable_power_well", i915.disable_power_well);
> +	seq_printf(m, "i915.%s=%d\n", "enable_ips", i915.enable_ips);
> +	seq_printf(m, "i915.%s=%d\n", "invert_brightness", i915.invert_brightness);
> +	seq_printf(m, "i915.%s=%d\n", "enable_cmd_parser", i915.enable_cmd_parser);
> +	/* leave bools at the end to not create holes */
> +	seq_printf(m, "i915.%s=%#x\n", "enable_hangcheck", i915.enable_hangcheck);
> +	seq_printf(m, "i915.%s=%#x\n", "fastboot", i915.fastboot);
> +	seq_printf(m, "i915.%s=%#x\n", "prefault_disable", i915.prefault_disable);
> +	seq_printf(m, "i915.%s=%#x\n", "reset", i915.reset);
> +	seq_printf(m, "i915.%s=%#x\n", "disable_display", i915.disable_display);
> +	seq_printf(m, "i915.%s=%#x\n", "disable_vtd_wa", i915.disable_vtd_wa);
> +	seq_printf(m, "i915.%s=%d\n", "use_mmio_flip", i915.use_mmio_flip);
> +	seq_printf(m, "i915.%s=%#x\n", "mmio_debug", i915.mmio_debug);
> +	seq_printf(m, "i915.%s=%#x\n", "verbose_state_checks", i915.verbose_state_checks);
> +
> +	/* Print a message if new members have been added without this code being updated */
> +	extra = sizeof(struct i915_params)
> +		- offsetof(struct i915_params, verbose_state_checks)
> +		- sizeof(i915.verbose_state_checks);
> +	if (extra)
> +		seq_printf(m, "Note: %lu bytes of padding or unknown options found after i915.%s\n",
> +				extra, "verbose_state_checks");
> +
> +	return 0;
> +}
> +
>  struct pipe_crc_info {
>  	const char *name;
>  	struct drm_device *dev;
> @@ -4433,6 +4477,7 @@ static const struct drm_info_list i915_debugfs_list[] = {
>  	{"i915_dp_mst_info", i915_dp_mst_info, 0},
>  	{"i915_wa_registers", i915_wa_registers, 0},
>  	{"i915_ddb_info", i915_ddb_info, 0},
> +	{"i915_params", i915_params, 0},
>  };
>  #define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list)
>  
> -- 
> 1.7.9.5
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Daniel Vetter Jan. 23, 2015, 3:40 p.m. UTC | #2
On Fri, Jan 23, 2015 at 02:35:20PM +0200, Ville Syrjälä wrote:
> On Fri, Jan 23, 2015 at 12:25:26PM +0000, Dave Gordon wrote:
> > It can be useful to know what the driver's parameters have ended up set
> > to after sanitisation, so this commit adds a debugfs function to print
> > the current values of all the module parameters.
> 
> What's wrong with eg. 'grep . /sys/module/i915/parameters/*' ?

btw you can also set them through that interface at runtime if the
paramter is rw. Really handy for debugging.
-Daniel
Chris Wilson Jan. 23, 2015, 9:05 p.m. UTC | #3
On Fri, Jan 23, 2015 at 02:35:20PM +0200, Ville Syrjälä wrote:
> On Fri, Jan 23, 2015 at 12:25:26PM +0000, Dave Gordon wrote:
> > It can be useful to know what the driver's parameters have ended up set
> > to after sanitisation, so this commit adds a debugfs function to print
> > the current values of all the module parameters.
> 
> What's wrong with eg. 'grep . /sys/module/i915/parameters/*' ?

What I really want are these captured in the error-state. Can be handy
to know at times. 
-Chris
Shuang He Jan. 24, 2015, 5:02 a.m. UTC | #4
Tested-By: PRC QA PRTS (Patch Regression Test System Contact: shuang.he@intel.com)
Task id: 5633
-------------------------------------Summary-------------------------------------
Platform          Delta          drm-intel-nightly          Series Applied
PNV                                  353/353              353/353
ILK                 -1              355/355              354/355
SNB              +2                 399/422              401/422
IVB                 -1              486/487              485/487
BYT                                  296/296              296/296
HSW              +1-2              507/508              506/508
BDW              +2                 399/402              401/402
-------------------------------------Detailed-------------------------------------
Platform  Test                                drm-intel-nightly          Series Applied
*ILK  igt_gem_unfence_active_buffers      PASS(2, M37M26)      DMESG_WARN(1, M26)
*SNB  igt_kms_flip_event_leak      NSPT(2, M35)      PASS(1, M35)
 SNB  igt_kms_flip_nonexisting-fb      NSPT(1, M35)PASS(5, M35M22)      PASS(1, M35)
 IVB  igt_gem_storedw_batches_loop_secure-dispatch      DMESG_WARN(1, M34)PASS(1, M21)      DMESG_WARN(1, M34)
*HSW  igt_gem_pwrite_pread_uncached-copy-performance      PASS(2, M19M40)      DMESG_WARN(1, M40)
 HSW  igt_gem_storedw_loop_blt      DMESG_WARN(2, M19M20)PASS(4, M20M40)      PASS(1, M40)
*HSW  igt_gem_storedw_loop_bsd      PASS(2, M19M40)      DMESG_WARN(1, M40)
 BDW  igt_gem_pwrite_pread_display-pwrite-blt-gtt_mmap-performance      DMESG_WARN(2, M28)PASS(3, M30M28)      PASS(1, M30)
 BDW  igt_gem_pwrite_pread_uncached-pwrite-blt-gtt_mmap-performance      DMESG_WARN(2, M28M30)PASS(1, M28)      PASS(1, M30)
Note: You need to pay more attention to line start with '*'
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 2ad4c48..9d75efc 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2819,6 +2819,50 @@  static int i915_ddb_info(struct seq_file *m, void *unused)
 	return 0;
 }
 
+static int i915_params(struct seq_file *m, void *unused)
+{
+	size_t extra;
+
+	seq_printf(m, "i915.%s=%d\n", "modeset", i915.modeset);
+	seq_printf(m, "i915.%s=%d\n", "panel_ignore_lid", i915.panel_ignore_lid);
+	seq_printf(m, "i915.%s=%u\n", "powersave", i915.powersave);
+	seq_printf(m, "i915.%s=%d\n", "semaphores", i915.semaphores);
+	seq_printf(m, "i915.%s=%u\n", "lvds_downclock", i915.lvds_downclock);
+	seq_printf(m, "i915.%s=%d\n", "lvds_channel_mode", i915.lvds_channel_mode);
+	seq_printf(m, "i915.%s=%d\n", "panel_use_ssc", i915.panel_use_ssc);
+	seq_printf(m, "i915.%s=%d\n", "vbt_sdvo_panel_type", i915.vbt_sdvo_panel_type);
+	seq_printf(m, "i915.%s=%d\n", "enable_rc6", i915.enable_rc6);
+	seq_printf(m, "i915.%s=%d\n", "enable_fbc", i915.enable_fbc);
+	seq_printf(m, "i915.%s=%d\n", "enable_ppgtt", i915.enable_ppgtt);
+	seq_printf(m, "i915.%s=%d\n", "enable_execlists", i915.enable_execlists);
+	seq_printf(m, "i915.%s=%d\n", "enable_psr", i915.enable_psr);
+	seq_printf(m, "i915.%s=%u\n", "preliminary_hw_support", i915.preliminary_hw_support);
+	seq_printf(m, "i915.%s=%d\n", "disable_power_well", i915.disable_power_well);
+	seq_printf(m, "i915.%s=%d\n", "enable_ips", i915.enable_ips);
+	seq_printf(m, "i915.%s=%d\n", "invert_brightness", i915.invert_brightness);
+	seq_printf(m, "i915.%s=%d\n", "enable_cmd_parser", i915.enable_cmd_parser);
+	/* leave bools at the end to not create holes */
+	seq_printf(m, "i915.%s=%#x\n", "enable_hangcheck", i915.enable_hangcheck);
+	seq_printf(m, "i915.%s=%#x\n", "fastboot", i915.fastboot);
+	seq_printf(m, "i915.%s=%#x\n", "prefault_disable", i915.prefault_disable);
+	seq_printf(m, "i915.%s=%#x\n", "reset", i915.reset);
+	seq_printf(m, "i915.%s=%#x\n", "disable_display", i915.disable_display);
+	seq_printf(m, "i915.%s=%#x\n", "disable_vtd_wa", i915.disable_vtd_wa);
+	seq_printf(m, "i915.%s=%d\n", "use_mmio_flip", i915.use_mmio_flip);
+	seq_printf(m, "i915.%s=%#x\n", "mmio_debug", i915.mmio_debug);
+	seq_printf(m, "i915.%s=%#x\n", "verbose_state_checks", i915.verbose_state_checks);
+
+	/* Print a message if new members have been added without this code being updated */
+	extra = sizeof(struct i915_params)
+		- offsetof(struct i915_params, verbose_state_checks)
+		- sizeof(i915.verbose_state_checks);
+	if (extra)
+		seq_printf(m, "Note: %lu bytes of padding or unknown options found after i915.%s\n",
+				extra, "verbose_state_checks");
+
+	return 0;
+}
+
 struct pipe_crc_info {
 	const char *name;
 	struct drm_device *dev;
@@ -4433,6 +4477,7 @@  static const struct drm_info_list i915_debugfs_list[] = {
 	{"i915_dp_mst_info", i915_dp_mst_info, 0},
 	{"i915_wa_registers", i915_wa_registers, 0},
 	{"i915_ddb_info", i915_ddb_info, 0},
+	{"i915_params", i915_params, 0},
 };
 #define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list)