[v2] Revert "drm/i915/chv: Set min freq to efficient frequency on chv"
diff mbox

Message ID 1471000935-77366-1-git-send-email-deepak.s@linux.intel.com
State New
Headers show

Commit Message

deepak.s@linux.intel.com Aug. 12, 2016, 11:22 a.m. UTC
From: Deepak S <deepak.s@linux.intel.com>

With latest Punit FW, vgg input voltag drop falling to minimum is fixed.
So reverting the WA patch & moving to turbo freq opreation range to [RPn -> RP0]

This reverts commit 5b7c91b78b1ce6663e0f1f037f6cb4d7c9537d44.

commit 5b7c91b78b1ce6663e0f1f037f6cb4d7c9537d44
Author: Deepak S <deepak.s@linux.intel.com>
Date:   Sat May 9 18:15:46 2015 +0530

    drm/i915/chv: Set min freq to efficient frequency on chv

v2: Fix inconsistent return type. (Chris)

Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Deepak S <deepak.s@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_pm.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

Comments

kbuild test robot Aug. 12, 2016, 6:12 a.m. UTC | #1
Hi Deepak,

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on v4.8-rc1 next-20160811]
[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/deepak-s-linux-intel-com/Revert-drm-i915-chv-Set-min-freq-to-efficient-frequency-on-chv/20160812-135320
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-x012-201632 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/gpu/drm/i915/intel_pm.c: In function 'cherryview_rps_min_freq':
>> drivers/gpu/drm/i915/intel_pm.c:5610:28: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
     struct pci_device *pdev = dev_priv->drm.pdev;
                               ^~~~~~~~
>> drivers/gpu/drm/i915/intel_pm.c:5613:10: error: dereferencing pointer to incomplete type 'struct pci_device'
     if (pdev->revision >= 0x20) {
             ^~
   cc1: some warnings being treated as errors

vim +5610 drivers/gpu/drm/i915/intel_pm.c

  5604	
  5605		return rp1;
  5606	}
  5607	
  5608	static u32 cherryview_rps_min_freq(struct drm_i915_private *dev_priv)
  5609	{
> 5610		struct pci_device *pdev = dev_priv->drm.pdev;
  5611		u32 val, rpn;
  5612	
> 5613		if (pdev->revision >= 0x20) {
  5614			val = vlv_punit_read(dev_priv, FB_GFX_FMIN_AT_VMIN_FUSE);
  5615			rpn = ((val >> FB_GFX_FMIN_AT_VMIN_FUSE_SHIFT) &
  5616			       FB_GFX_FREQ_FUSE_MASK);

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kbuild test robot Aug. 12, 2016, 6:14 a.m. UTC | #2
Hi Deepak,

[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on v4.8-rc1 next-20160811]
[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/deepak-s-linux-intel-com/Revert-drm-i915-chv-Set-min-freq-to-efficient-frequency-on-chv/20160812-135320
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-x019-201632 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/i915/intel_pm.c: In function 'cherryview_rps_min_freq':
   drivers/gpu/drm/i915/intel_pm.c:5610:28: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
     struct pci_device *pdev = dev_priv->drm.pdev;
                               ^~~~~~~~
   In file included from include/linux/err.h:4:0,
                    from include/linux/clk.h:15,
                    from include/linux/cpufreq.h:14,
                    from drivers/gpu/drm/i915/intel_pm.c:28:
   drivers/gpu/drm/i915/intel_pm.c:5613:10: error: dereferencing pointer to incomplete type 'struct pci_device'
     if (pdev->revision >= 0x20) {
             ^
   include/linux/compiler.h:151:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
>> drivers/gpu/drm/i915/intel_pm.c:5613:2: note: in expansion of macro 'if'
     if (pdev->revision >= 0x20) {
     ^~
   cc1: some warnings being treated as errors

vim +/if +5613 drivers/gpu/drm/i915/intel_pm.c

  5597	
  5598	static int cherryview_rps_guar_freq(struct drm_i915_private *dev_priv)
  5599	{
  5600		u32 val, rp1;
  5601	
  5602		val = vlv_punit_read(dev_priv, FB_GFX_FMAX_AT_VMAX_FUSE);
  5603		rp1 = (val & FB_GFX_FREQ_FUSE_MASK);
  5604	
  5605		return rp1;
  5606	}
  5607	
  5608	static u32 cherryview_rps_min_freq(struct drm_i915_private *dev_priv)
  5609	{
  5610		struct pci_device *pdev = dev_priv->drm.pdev;
  5611		u32 val, rpn;
  5612	
> 5613		if (pdev->revision >= 0x20) {
  5614			val = vlv_punit_read(dev_priv, FB_GFX_FMIN_AT_VMIN_FUSE);
  5615			rpn = ((val >> FB_GFX_FMIN_AT_VMIN_FUSE_SHIFT) &
  5616			       FB_GFX_FREQ_FUSE_MASK);
  5617		} else { /* For pre-production hardware */
  5618			val = vlv_punit_read(dev_priv, PUNIT_GPU_STATUS_REG);
  5619			rpn = ((val >> PUNIT_GPU_STATIS_GFX_MIN_FREQ_SHIFT) &
  5620			       PUNIT_GPU_STATUS_GFX_MIN_FREQ_MASK);
  5621		}

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Chris Wilson Aug. 12, 2016, 6:23 a.m. UTC | #3
On Fri, Aug 12, 2016 at 02:12:42PM +0800, kbuild test robot wrote:
> Hi Deepak,
> 
> [auto build test ERROR on drm-intel/for-linux-next]
> [also build test ERROR on v4.8-rc1 next-20160811]
> [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/deepak-s-linux-intel-com/Revert-drm-i915-chv-Set-min-freq-to-efficient-frequency-on-chv/20160812-135320
> base:   git://anongit.freedesktop.org/drm-intel for-linux-next
> config: x86_64-randconfig-x012-201632 (attached as .config)
> compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
> reproduce:
>         # save the attached .config to linux build tree
>         make ARCH=x86_64 
> 
> All errors (new ones prefixed by >>):
> 
>    drivers/gpu/drm/i915/intel_pm.c: In function 'cherryview_rps_min_freq':
> >> drivers/gpu/drm/i915/intel_pm.c:5610:28: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
>      struct pci_device *pdev = dev_priv->drm.pdev;

My bad, it's struct pci_dev.
-Chris
Ville Syrjälä Aug. 12, 2016, 6:35 a.m. UTC | #4
On Fri, Aug 12, 2016 at 04:52:15PM +0530, deepak.s@linux.intel.com wrote:
> From: Deepak S <deepak.s@linux.intel.com>
> 
> With latest Punit FW, vgg input voltag drop falling to minimum is fixed.
> So reverting the WA patch & moving to turbo freq opreation range to [RPn -> RP0]
> 
> This reverts commit 5b7c91b78b1ce6663e0f1f037f6cb4d7c9537d44.
> 
> commit 5b7c91b78b1ce6663e0f1f037f6cb4d7c9537d44
> Author: Deepak S <deepak.s@linux.intel.com>
> Date:   Sat May 9 18:15:46 2015 +0530
> 
>     drm/i915/chv: Set min freq to efficient frequency on chv
> 
> v2: Fix inconsistent return type. (Chris)
> 
> Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Deepak S <deepak.s@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_pm.c | 21 +++++++++++++++++++--
>  1 file changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 81ab119..7844bf5 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -5579,6 +5579,24 @@ static int cherryview_rps_guar_freq(struct drm_i915_private *dev_priv)
>  	return rp1;
>  }
>  
> +static u32 cherryview_rps_min_freq(struct drm_i915_private *dev_priv)
> +{
> +	struct pci_device *pdev = dev_priv->drm.pdev;
> +	u32 val, rpn;
> +
> +	if (pdev->revision >= 0x20) {
> +		val = vlv_punit_read(dev_priv, FB_GFX_FMIN_AT_VMIN_FUSE);
> +		rpn = ((val >> FB_GFX_FMIN_AT_VMIN_FUSE_SHIFT) &
> +		       FB_GFX_FREQ_FUSE_MASK);
> +	} else { /* For pre-production hardware */
> +		val = vlv_punit_read(dev_priv, PUNIT_GPU_STATUS_REG);
> +		rpn = ((val >> PUNIT_GPU_STATIS_GFX_MIN_FREQ_SHIFT) &
> +		       PUNIT_GPU_STATUS_GFX_MIN_FREQ_MASK);

Please drop the pre-production hw case. We got rid of all pre-production
junk long ago.

> +	}
> +
> +	return rpn;
> +}
> +
>  static int valleyview_rps_guar_freq(struct drm_i915_private *dev_priv)
>  {
>  	u32 val, rp1;
> @@ -5818,8 +5836,7 @@ static void cherryview_init_gt_powersave(struct drm_i915_private *dev_priv)
>  			 intel_gpu_freq(dev_priv, dev_priv->rps.rp1_freq),
>  			 dev_priv->rps.rp1_freq);
>  
> -	/* PUnit validated range is only [RPe, RP0] */
> -	dev_priv->rps.min_freq = dev_priv->rps.efficient_freq;
> +	dev_priv->rps.min_freq = cherryview_rps_min_freq(dev_priv);
>  	DRM_DEBUG_DRIVER("min GPU freq: %d MHz (%u)\n",
>  			 intel_gpu_freq(dev_priv, dev_priv->rps.min_freq),
>  			 dev_priv->rps.min_freq);
> -- 
> 1.9.1
Ville Syrjälä Aug. 12, 2016, 6:37 a.m. UTC | #5
On Fri, Aug 12, 2016 at 09:35:00AM +0300, Ville Syrjälä wrote:
> On Fri, Aug 12, 2016 at 04:52:15PM +0530, deepak.s@linux.intel.com wrote:
> > From: Deepak S <deepak.s@linux.intel.com>
> > 
> > With latest Punit FW, vgg input voltag drop falling to minimum is fixed.
> > So reverting the WA patch & moving to turbo freq opreation range to [RPn -> RP0]
> > 
> > This reverts commit 5b7c91b78b1ce6663e0f1f037f6cb4d7c9537d44.
> > 
> > commit 5b7c91b78b1ce6663e0f1f037f6cb4d7c9537d44
> > Author: Deepak S <deepak.s@linux.intel.com>
> > Date:   Sat May 9 18:15:46 2015 +0530
> > 
> >     drm/i915/chv: Set min freq to efficient frequency on chv
> > 
> > v2: Fix inconsistent return type. (Chris)
> > 
> > Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Signed-off-by: Deepak S <deepak.s@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_pm.c | 21 +++++++++++++++++++--
> >  1 file changed, 19 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> > index 81ab119..7844bf5 100644
> > --- a/drivers/gpu/drm/i915/intel_pm.c
> > +++ b/drivers/gpu/drm/i915/intel_pm.c
> > @@ -5579,6 +5579,24 @@ static int cherryview_rps_guar_freq(struct drm_i915_private *dev_priv)
> >  	return rp1;
> >  }
> >  
> > +static u32 cherryview_rps_min_freq(struct drm_i915_private *dev_priv)
> > +{
> > +	struct pci_device *pdev = dev_priv->drm.pdev;
> > +	u32 val, rpn;
> > +
> > +	if (pdev->revision >= 0x20) {
> > +		val = vlv_punit_read(dev_priv, FB_GFX_FMIN_AT_VMIN_FUSE);
> > +		rpn = ((val >> FB_GFX_FMIN_AT_VMIN_FUSE_SHIFT) &
> > +		       FB_GFX_FREQ_FUSE_MASK);
> > +	} else { /* For pre-production hardware */
> > +		val = vlv_punit_read(dev_priv, PUNIT_GPU_STATUS_REG);
> > +		rpn = ((val >> PUNIT_GPU_STATIS_GFX_MIN_FREQ_SHIFT) &
> > +		       PUNIT_GPU_STATUS_GFX_MIN_FREQ_MASK);
> 
> Please drop the pre-production hw case. We got rid of all pre-production
> junk long ago.

Oh and maybe add a note to the commit message explaining why it's not a
1:1 revert. You can refer to commit 5b5929cbe3f7 ("drm/i915/chv: remove
pre-production hardware workarounds") as the reason for the discrepancy.

> 
> > +	}
> > +
> > +	return rpn;
> > +}
> > +
> >  static int valleyview_rps_guar_freq(struct drm_i915_private *dev_priv)
> >  {
> >  	u32 val, rp1;
> > @@ -5818,8 +5836,7 @@ static void cherryview_init_gt_powersave(struct drm_i915_private *dev_priv)
> >  			 intel_gpu_freq(dev_priv, dev_priv->rps.rp1_freq),
> >  			 dev_priv->rps.rp1_freq);
> >  
> > -	/* PUnit validated range is only [RPe, RP0] */
> > -	dev_priv->rps.min_freq = dev_priv->rps.efficient_freq;
> > +	dev_priv->rps.min_freq = cherryview_rps_min_freq(dev_priv);
> >  	DRM_DEBUG_DRIVER("min GPU freq: %d MHz (%u)\n",
> >  			 intel_gpu_freq(dev_priv, dev_priv->rps.min_freq),
> >  			 dev_priv->rps.min_freq);
> > -- 
> > 1.9.1
> 
> -- 
> Ville Syrjälä
> Intel OTC
kbuild test robot Aug. 12, 2016, 7 a.m. UTC | #6
Hi Deepak,

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on v4.8-rc1 next-20160811]
[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/deepak-s-linux-intel-com/Revert-drm-i915-chv-Set-min-freq-to-efficient-frequency-on-chv/20160812-135320
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-i0-201632 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.3-14) 4.9.3
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

   drivers/gpu/drm/i915/intel_pm.c: In function 'cherryview_rps_min_freq':
>> drivers/gpu/drm/i915/intel_pm.c:5610:28: warning: initialization from incompatible pointer type
     struct pci_device *pdev = dev_priv->drm.pdev;
                               ^
>> drivers/gpu/drm/i915/intel_pm.c:5613:10: error: dereferencing pointer to incomplete type
     if (pdev->revision >= 0x20) {
             ^

vim +5613 drivers/gpu/drm/i915/intel_pm.c

  5604	
  5605		return rp1;
  5606	}
  5607	
  5608	static u32 cherryview_rps_min_freq(struct drm_i915_private *dev_priv)
  5609	{
> 5610		struct pci_device *pdev = dev_priv->drm.pdev;
  5611		u32 val, rpn;
  5612	
> 5613		if (pdev->revision >= 0x20) {
  5614			val = vlv_punit_read(dev_priv, FB_GFX_FMIN_AT_VMIN_FUSE);
  5615			rpn = ((val >> FB_GFX_FMIN_AT_VMIN_FUSE_SHIFT) &
  5616			       FB_GFX_FREQ_FUSE_MASK);

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
deepak.s@linux.intel.com Aug. 12, 2016, 7:35 a.m. UTC | #7
On 12/08/16 11:53 AM, Chris Wilson wrote:
> On Fri, Aug 12, 2016 at 02:12:42PM +0800, kbuild test robot wrote:
>> Hi Deepak,
>>
>> [auto build test ERROR on drm-intel/for-linux-next]
>> [also build test ERROR on v4.8-rc1 next-20160811]
>> [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/deepak-s-linux-intel-com/Revert-drm-i915-chv-Set-min-freq-to-efficient-frequency-on-chv/20160812-135320
>> base:   git://anongit.freedesktop.org/drm-intel for-linux-next
>> config: x86_64-randconfig-x012-201632 (attached as .config)
>> compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
>> reproduce:
>>          # save the attached .config to linux build tree
>>          make ARCH=x86_64
>>
>> All errors (new ones prefixed by >>):
>>
>>     drivers/gpu/drm/i915/intel_pm.c: In function 'cherryview_rps_min_freq':
>>>> drivers/gpu/drm/i915/intel_pm.c:5610:28: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
>>       struct pci_device *pdev = dev_priv->drm.pdev;
> My bad, it's struct pci_dev.
> -Chris
Oops sorry. I made the changes and tested the code. But forgot to amend 
and send it :(
Let me re-send the code.

Patch
diff mbox

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 81ab119..7844bf5 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -5579,6 +5579,24 @@  static int cherryview_rps_guar_freq(struct drm_i915_private *dev_priv)
 	return rp1;
 }
 
+static u32 cherryview_rps_min_freq(struct drm_i915_private *dev_priv)
+{
+	struct pci_device *pdev = dev_priv->drm.pdev;
+	u32 val, rpn;
+
+	if (pdev->revision >= 0x20) {
+		val = vlv_punit_read(dev_priv, FB_GFX_FMIN_AT_VMIN_FUSE);
+		rpn = ((val >> FB_GFX_FMIN_AT_VMIN_FUSE_SHIFT) &
+		       FB_GFX_FREQ_FUSE_MASK);
+	} else { /* For pre-production hardware */
+		val = vlv_punit_read(dev_priv, PUNIT_GPU_STATUS_REG);
+		rpn = ((val >> PUNIT_GPU_STATIS_GFX_MIN_FREQ_SHIFT) &
+		       PUNIT_GPU_STATUS_GFX_MIN_FREQ_MASK);
+	}
+
+	return rpn;
+}
+
 static int valleyview_rps_guar_freq(struct drm_i915_private *dev_priv)
 {
 	u32 val, rp1;
@@ -5818,8 +5836,7 @@  static void cherryview_init_gt_powersave(struct drm_i915_private *dev_priv)
 			 intel_gpu_freq(dev_priv, dev_priv->rps.rp1_freq),
 			 dev_priv->rps.rp1_freq);
 
-	/* PUnit validated range is only [RPe, RP0] */
-	dev_priv->rps.min_freq = dev_priv->rps.efficient_freq;
+	dev_priv->rps.min_freq = cherryview_rps_min_freq(dev_priv);
 	DRM_DEBUG_DRIVER("min GPU freq: %d MHz (%u)\n",
 			 intel_gpu_freq(dev_priv, dev_priv->rps.min_freq),
 			 dev_priv->rps.min_freq);