diff mbox

[v2] drm/i915: Use wait_for_register in lpt_reset_fdi_mphy()

Message ID 20170410102200.209356-1-michal.wajdeczko@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Michal Wajdeczko April 10, 2017, 10:22 a.m. UTC
There is no need to use macros as we can use generic function.
And we can save ~2000 bytes in driver footprint.

v2: drop ret var, add 10ms fallback (Chris)

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_display.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

Comments

Chris Wilson April 10, 2017, 11:41 a.m. UTC | #1
On Mon, Apr 10, 2017 at 10:22:00AM +0000, Michal Wajdeczko wrote:
> There is no need to use macros as we can use generic function.
> And we can save ~2000 bytes in driver footprint.
> 
> v2: drop ret var, add 10ms fallback (Chris)
> 
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
Chris Wilson April 10, 2017, 12:56 p.m. UTC | #2
On Mon, Apr 10, 2017 at 12:41:30PM +0100, Chris Wilson wrote:
> On Mon, Apr 10, 2017 at 10:22:00AM +0000, Michal Wajdeczko wrote:
> > There is no need to use macros as we can use generic function.
> > And we can save ~2000 bytes in driver footprint.
> > 
> > v2: drop ret var, add 10ms fallback (Chris)
> > 
> > Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> > Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
> > Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>

Hmm, forgot the convesion from I915_READ to I915_READ_FW. That should be
safe here as this gen doesn't have the concurrent cacheline issue, iirc?
-Chris
Ville Syrjälä April 10, 2017, 1:34 p.m. UTC | #3
On Mon, Apr 10, 2017 at 01:56:31PM +0100, Chris Wilson wrote:
> On Mon, Apr 10, 2017 at 12:41:30PM +0100, Chris Wilson wrote:
> > On Mon, Apr 10, 2017 at 10:22:00AM +0000, Michal Wajdeczko wrote:
> > > There is no need to use macros as we can use generic function.
> > > And we can save ~2000 bytes in driver footprint.
> > > 
> > > v2: drop ret var, add 10ms fallback (Chris)
> > > 
> > > Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> > > Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
> > > Cc: Chris Wilson <chris@chris-wilson.co.uk>
> > Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> 
> Hmm, forgot the convesion from I915_READ to I915_READ_FW. That should be
> safe here as this gen doesn't have the concurrent cacheline issue, iirc?

Isn't HSW exactly the platform where it happens very easily?
Chris Wilson April 10, 2017, 1:50 p.m. UTC | #4
On Mon, Apr 10, 2017 at 04:34:30PM +0300, Ville Syrjälä wrote:
> On Mon, Apr 10, 2017 at 01:56:31PM +0100, Chris Wilson wrote:
> > On Mon, Apr 10, 2017 at 12:41:30PM +0100, Chris Wilson wrote:
> > > On Mon, Apr 10, 2017 at 10:22:00AM +0000, Michal Wajdeczko wrote:
> > > > There is no need to use macros as we can use generic function.
> > > > And we can save ~2000 bytes in driver footprint.
> > > > 
> > > > v2: drop ret var, add 10ms fallback (Chris)
> > > > 
> > > > Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> > > > Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
> > > > Cc: Chris Wilson <chris@chris-wilson.co.uk>
> > > Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> > 
> > Hmm, forgot the convesion from I915_READ to I915_READ_FW. That should be
> > safe here as this gen doesn't have the concurrent cacheline issue, iirc?
> 
> Isn't HSW exactly the platform where it happens very easily?

I thought lpt was later, or rather I just assume that any codename I
don't recognise is postmodern.
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index b6b40cd..eeb828c 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -7703,16 +7703,21 @@  static void lpt_reset_fdi_mphy(struct drm_i915_private *dev_priv)
 	tmp |= FDI_MPHY_IOSFSB_RESET_CTL;
 	I915_WRITE(SOUTH_CHICKEN2, tmp);
 
-	if (wait_for_us(I915_READ(SOUTH_CHICKEN2) &
-			FDI_MPHY_IOSFSB_RESET_STATUS, 100))
+	if (__intel_wait_for_register_fw(dev_priv,
+					 SOUTH_CHICKEN2,
+					 FDI_MPHY_IOSFSB_RESET_STATUS,
+					 FDI_MPHY_IOSFSB_RESET_STATUS,
+					 100, 10, &tmp))
 		DRM_ERROR("FDI mPHY reset assert timeout\n");
 
-	tmp = I915_READ(SOUTH_CHICKEN2);
 	tmp &= ~FDI_MPHY_IOSFSB_RESET_CTL;
 	I915_WRITE(SOUTH_CHICKEN2, tmp);
 
-	if (wait_for_us((I915_READ(SOUTH_CHICKEN2) &
-			 FDI_MPHY_IOSFSB_RESET_STATUS) == 0, 100))
+	if (__intel_wait_for_register_fw(dev_priv,
+					 SOUTH_CHICKEN2,
+					 FDI_MPHY_IOSFSB_RESET_STATUS,
+					 0,
+					 100, 10, NULL))
 		DRM_ERROR("FDI mPHY reset de-assert timeout\n");
 }