diff mbox series

drm/i915/csr Added DC5 and DC6 counter register for ICL in debugfs entry.

Message ID 1537202975-19652-1-git-send-email-jyoti.r.yadav@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/csr Added DC5 and DC6 counter register for ICL in debugfs entry. | expand

Commit Message

Yadav, Jyoti R Sept. 17, 2018, 4:49 p.m. UTC
DC5 and DC6 counter register tells about residency of DC5 and DC6.
These registers are same for SKL and ICL.

Signed-off-by: Jyoti Yadav <jyoti.r.yadav@intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 3 ++-
 drivers/gpu/drm/i915/i915_reg.h     | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

Comments

Rodrigo Vivi Sept. 17, 2018, 5:02 p.m. UTC | #1
On Mon, Sep 17, 2018 at 12:49:35PM -0400, Jyoti Yadav wrote:
> DC5 and DC6 counter register tells about residency of DC5 and DC6.
> These registers are same for SKL and ICL.
> 
> Signed-off-by: Jyoti Yadav <jyoti.r.yadav@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_debugfs.c | 3 ++-
>  drivers/gpu/drm/i915/i915_reg.h     | 1 +
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index a5265c2..328e39c 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -2898,7 +2898,8 @@ static int i915_dmc_info(struct seq_file *m, void *unused)
>  		   CSR_VERSION_MINOR(csr->version));
>  
>  	if (IS_KABYLAKE(dev_priv) ||
> -	    (IS_SKYLAKE(dev_priv) && csr->version >= CSR_VERSION(1, 6))) {
> +	    (IS_SKYLAKE(dev_priv) && csr->version >= CSR_VERSION(1, 6))
> +		(IS_ICELAKE(dev_priv) && csr->version >= CSR_VERSION(1, 7))) {

Why on ICELAKE we need to be greater than version 1.7?
Specially because our only version starts on 1.7 I don't believe we should
be checking version here.

Also SKL check is useless nowadays and should be removed. It came from
the times we didn't have tied version of kernel and firmware...

Also I'm missing CFL, BXT, GLK and CNL on this range here...

Probably good to replace everything

if gen >= 9 && gen <= 11

?

>  		seq_printf(m, "DC3 -> DC5 count: %d\n",
>  			   I915_READ(SKL_CSR_DC3_DC5_COUNT));
>  		seq_printf(m, "DC5 -> DC6 count: %d\n",
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index 8534f88..573d5f3 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -6985,6 +6985,7 @@ enum {
>  /* MMIO address range for CSR program (0x80000 - 0x82FFF) */
>  #define CSR_MMIO_START_RANGE	0x80000
>  #define CSR_MMIO_END_RANGE	0x8FFFF
> +/* DC3_DC5 count and DC5_DC6 count registers are same for SKL and ICL */
>  #define SKL_CSR_DC3_DC5_COUNT	_MMIO(0x80030)
>  #define SKL_CSR_DC5_DC6_COUNT	_MMIO(0x8002C)
>  #define BXT_CSR_DC3_DC5_COUNT	_MMIO(0x80038)
> -- 
> 1.9.1
>
kernel test robot Sept. 17, 2018, 5:48 p.m. UTC | #2
Hi Jyoti,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on v4.19-rc4 next-20180913]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Jyoti-Yadav/drm-i915-csr-Added-DC5-and-DC6-counter-register-for-ICL-in-debugfs-entry/20180918-012350
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: i386-randconfig-x005-201837 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/gpu//drm/i915/i915_debugfs.c: In function 'i915_dmc_info':
>> drivers/gpu//drm/i915/i915_debugfs.c:2884:28: error: called object is not a function or function pointer
         (IS_SKYLAKE(dev_priv) && csr->version >= CSR_VERSION(1, 6))
         ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +2884 drivers/gpu//drm/i915/i915_debugfs.c

  2861	
  2862	static int i915_dmc_info(struct seq_file *m, void *unused)
  2863	{
  2864		struct drm_i915_private *dev_priv = node_to_i915(m->private);
  2865		struct intel_csr *csr;
  2866	
  2867		if (!HAS_CSR(dev_priv))
  2868			return -ENODEV;
  2869	
  2870		csr = &dev_priv->csr;
  2871	
  2872		intel_runtime_pm_get(dev_priv);
  2873	
  2874		seq_printf(m, "fw loaded: %s\n", yesno(csr->dmc_payload != NULL));
  2875		seq_printf(m, "path: %s\n", csr->fw_path);
  2876	
  2877		if (!csr->dmc_payload)
  2878			goto out;
  2879	
  2880		seq_printf(m, "version: %d.%d\n", CSR_VERSION_MAJOR(csr->version),
  2881			   CSR_VERSION_MINOR(csr->version));
  2882	
  2883		if (IS_KABYLAKE(dev_priv) ||
> 2884		    (IS_SKYLAKE(dev_priv) && csr->version >= CSR_VERSION(1, 6))
  2885			(IS_ICELAKE(dev_priv) && csr->version >= CSR_VERSION(1, 7))) {
  2886			seq_printf(m, "DC3 -> DC5 count: %d\n",
  2887				   I915_READ(SKL_CSR_DC3_DC5_COUNT));
  2888			seq_printf(m, "DC5 -> DC6 count: %d\n",
  2889				   I915_READ(SKL_CSR_DC5_DC6_COUNT));
  2890		} else if (IS_BROXTON(dev_priv) && csr->version >= CSR_VERSION(1, 4)) {
  2891			seq_printf(m, "DC3 -> DC5 count: %d\n",
  2892				   I915_READ(BXT_CSR_DC3_DC5_COUNT));
  2893		}
  2894	
  2895	out:
  2896		seq_printf(m, "program base: 0x%08x\n", I915_READ(CSR_PROGRAM(0)));
  2897		seq_printf(m, "ssp base: 0x%08x\n", I915_READ(CSR_SSP_BASE));
  2898		seq_printf(m, "htp: 0x%08x\n", I915_READ(CSR_HTP_SKL));
  2899	
  2900		intel_runtime_pm_put(dev_priv);
  2901	
  2902		return 0;
  2903	}
  2904	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot Sept. 17, 2018, 6:15 p.m. UTC | #3
Hi Jyoti,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on v4.19-rc4 next-20180913]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Jyoti-Yadav/drm-i915-csr-Added-DC5-and-DC6-counter-register-for-ICL-in-debugfs-entry/20180918-012350
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: i386-randconfig-x077-201837 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from include/linux/kernel.h:10:0,
                    from include/linux/list.h:9,
                    from include/linux/wait.h:7,
                    from include/linux/wait_bit.h:8,
                    from include/linux/fs.h:6,
                    from include/linux/debugfs.h:15,
                    from drivers/gpu//drm/i915/i915_debugfs.c:29:
   drivers/gpu//drm/i915/i915_debugfs.c: In function 'i915_dmc_info':
   drivers/gpu//drm/i915/i915_debugfs.c:2884:28: error: called object is not a function or function pointer
         (IS_SKYLAKE(dev_priv) && csr->version >= CSR_VERSION(1, 6))
         ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:58:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
>> drivers/gpu//drm/i915/i915_debugfs.c:2883:2: note: in expansion of macro 'if'
     if (IS_KABYLAKE(dev_priv) ||
     ^~
   drivers/gpu//drm/i915/i915_debugfs.c:2884:28: error: called object is not a function or function pointer
         (IS_SKYLAKE(dev_priv) && csr->version >= CSR_VERSION(1, 6))
         ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:58:42: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                             ^~~~
>> drivers/gpu//drm/i915/i915_debugfs.c:2883:2: note: in expansion of macro 'if'
     if (IS_KABYLAKE(dev_priv) ||
     ^~
   drivers/gpu//drm/i915/i915_debugfs.c:2884:28: error: called object is not a function or function pointer
         (IS_SKYLAKE(dev_priv) && csr->version >= CSR_VERSION(1, 6))
         ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:69:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^~~~
>> drivers/gpu//drm/i915/i915_debugfs.c:2883:2: note: in expansion of macro 'if'
     if (IS_KABYLAKE(dev_priv) ||
     ^~

vim +/if +2883 drivers/gpu//drm/i915/i915_debugfs.c

1da51581 Imre Deak        2013-11-25  2861  
b7cec66d Damien Lespiau   2015-10-27  2862  static int i915_dmc_info(struct seq_file *m, void *unused)
b7cec66d Damien Lespiau   2015-10-27  2863  {
36cdd013 David Weinehall  2016-08-22  2864  	struct drm_i915_private *dev_priv = node_to_i915(m->private);
b7cec66d Damien Lespiau   2015-10-27  2865  	struct intel_csr *csr;
b7cec66d Damien Lespiau   2015-10-27  2866  
ab309a6a Michal Wajdeczko 2017-12-15  2867  	if (!HAS_CSR(dev_priv))
ab309a6a Michal Wajdeczko 2017-12-15  2868  		return -ENODEV;
b7cec66d Damien Lespiau   2015-10-27  2869  
b7cec66d Damien Lespiau   2015-10-27  2870  	csr = &dev_priv->csr;
b7cec66d Damien Lespiau   2015-10-27  2871  
6fb403de Mika Kuoppala    2015-10-30  2872  	intel_runtime_pm_get(dev_priv);
6fb403de Mika Kuoppala    2015-10-30  2873  
b7cec66d Damien Lespiau   2015-10-27  2874  	seq_printf(m, "fw loaded: %s\n", yesno(csr->dmc_payload != NULL));
b7cec66d Damien Lespiau   2015-10-27  2875  	seq_printf(m, "path: %s\n", csr->fw_path);
b7cec66d Damien Lespiau   2015-10-27  2876  
b7cec66d Damien Lespiau   2015-10-27  2877  	if (!csr->dmc_payload)
6fb403de Mika Kuoppala    2015-10-30  2878  		goto out;
b7cec66d Damien Lespiau   2015-10-27  2879  
b7cec66d Damien Lespiau   2015-10-27  2880  	seq_printf(m, "version: %d.%d\n", CSR_VERSION_MAJOR(csr->version),
b7cec66d Damien Lespiau   2015-10-27  2881  		   CSR_VERSION_MINOR(csr->version));
b7cec66d Damien Lespiau   2015-10-27  2882  
48de568c Mika Kuoppala    2017-05-09 @2883  	if (IS_KABYLAKE(dev_priv) ||
71660c92 Jyoti Yadav      2018-09-17  2884  	    (IS_SKYLAKE(dev_priv) && csr->version >= CSR_VERSION(1, 6))
71660c92 Jyoti Yadav      2018-09-17  2885  		(IS_ICELAKE(dev_priv) && csr->version >= CSR_VERSION(1, 7))) {
8337206d Damien Lespiau   2015-10-30  2886  		seq_printf(m, "DC3 -> DC5 count: %d\n",
8337206d Damien Lespiau   2015-10-30  2887  			   I915_READ(SKL_CSR_DC3_DC5_COUNT));
8337206d Damien Lespiau   2015-10-30  2888  		seq_printf(m, "DC5 -> DC6 count: %d\n",
8337206d Damien Lespiau   2015-10-30  2889  			   I915_READ(SKL_CSR_DC5_DC6_COUNT));
36cdd013 David Weinehall  2016-08-22  2890  	} else if (IS_BROXTON(dev_priv) && csr->version >= CSR_VERSION(1, 4)) {
16e11b99 Mika Kuoppala    2015-10-27  2891  		seq_printf(m, "DC3 -> DC5 count: %d\n",
16e11b99 Mika Kuoppala    2015-10-27  2892  			   I915_READ(BXT_CSR_DC3_DC5_COUNT));
8337206d Damien Lespiau   2015-10-30  2893  	}
8337206d Damien Lespiau   2015-10-30  2894  
6fb403de Mika Kuoppala    2015-10-30  2895  out:
6fb403de Mika Kuoppala    2015-10-30  2896  	seq_printf(m, "program base: 0x%08x\n", I915_READ(CSR_PROGRAM(0)));
6fb403de Mika Kuoppala    2015-10-30  2897  	seq_printf(m, "ssp base: 0x%08x\n", I915_READ(CSR_SSP_BASE));
6fb403de Mika Kuoppala    2015-10-30  2898  	seq_printf(m, "htp: 0x%08x\n", I915_READ(CSR_HTP_SKL));
6fb403de Mika Kuoppala    2015-10-30  2899  
8337206d Damien Lespiau   2015-10-30  2900  	intel_runtime_pm_put(dev_priv);
8337206d Damien Lespiau   2015-10-30  2901  
b7cec66d Damien Lespiau   2015-10-27  2902  	return 0;
b7cec66d Damien Lespiau   2015-10-27  2903  }
b7cec66d Damien Lespiau   2015-10-27  2904  

:::::: The code at line 2883 was first introduced by commit
:::::: 48de568c644c5b5a9307c92b13c53811c5a93999 drm/i915: Show dmc debug registers on Kabylake

:::::: TO: Mika Kuoppala <mika.kuoppala@linux.intel.com>
:::::: CC: Mika Kuoppala <mika.kuoppala@intel.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index a5265c2..328e39c 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2898,7 +2898,8 @@  static int i915_dmc_info(struct seq_file *m, void *unused)
 		   CSR_VERSION_MINOR(csr->version));
 
 	if (IS_KABYLAKE(dev_priv) ||
-	    (IS_SKYLAKE(dev_priv) && csr->version >= CSR_VERSION(1, 6))) {
+	    (IS_SKYLAKE(dev_priv) && csr->version >= CSR_VERSION(1, 6))
+		(IS_ICELAKE(dev_priv) && csr->version >= CSR_VERSION(1, 7))) {
 		seq_printf(m, "DC3 -> DC5 count: %d\n",
 			   I915_READ(SKL_CSR_DC3_DC5_COUNT));
 		seq_printf(m, "DC5 -> DC6 count: %d\n",
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 8534f88..573d5f3 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -6985,6 +6985,7 @@  enum {
 /* MMIO address range for CSR program (0x80000 - 0x82FFF) */
 #define CSR_MMIO_START_RANGE	0x80000
 #define CSR_MMIO_END_RANGE	0x8FFFF
+/* DC3_DC5 count and DC5_DC6 count registers are same for SKL and ICL */
 #define SKL_CSR_DC3_DC5_COUNT	_MMIO(0x80030)
 #define SKL_CSR_DC5_DC6_COUNT	_MMIO(0x8002C)
 #define BXT_CSR_DC3_DC5_COUNT	_MMIO(0x80038)