drm/i915: User POSTING_READ and I915_READ_NOTRACE in lcpll code
Subsystems (2)
PATCH 1/1 drm/i915: User POSTING_READ and I915_READ_NOTRACE in lcpll code
If we don't use the return value of a mmio read our coding style is to use the POSTING_READ macro. This avoids cluttering the mmio traces.
Similarly for busy loops to wait for a bit to flip we use the _NOTRACE variant to avoid filling up the tracebuffers with gunk. Spotted while reading some follow-up patches from Paulo.
While at it add the missing posting read in the lcpll enable function that Paulo spotted.
--- drivers/gpu/drm/i915/intel_display.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_display.c +6 -5
@@ -5999,7 +5999,7 @@ void hsw_disable_lcpll(struct drm_i915_private *dev_priv,I915_WRITE (LCPLL_CTL , val);POSTING_READ (LCPLL_CTL ); -if (wait_for ((I915_READ (LCPLL_CTL ) &LCPLL_PLL_LOCK ) ==0 ,1 )) +if (wait_for ((I915_READ_NOTRACE (LCPLL_CTL ) &LCPLL_PLL_LOCK ) ==0 ,1 ))DRM_ERROR ("LCPLL still locked\n" ); val =I915_READ (D_COMP );
@@ -6008,7 +6008,7 @@ void hsw_disable_lcpll(struct drm_i915_private *dev_priv,POSTING_READ (D_COMP );ndelay (100 ); -if (wait_for ((I915_READ (D_COMP ) &D_COMP_RCOMP_IN_PROGRESS ) ==0 ,1 )) +if (wait_for ((I915_READ_NOTRACE (D_COMP ) &D_COMP_RCOMP_IN_PROGRESS ) ==0 ,1 ))DRM_ERROR ("D_COMP RCOMP still in progress\n" );if (allow_power_down) {
@@ -6036,19 +6036,20 @@ void hsw_restore_lcpll(struct drm_i915_private *dev_priv)if (val &LCPLL_POWER_DOWN_ALLOW ) { val &= ~LCPLL_POWER_DOWN_ALLOW ;I915_WRITE (LCPLL_CTL , val); +POSTING_READ (LCPLL_CTL ); } val =I915_READ (D_COMP ); val |=D_COMP_COMP_FORCE ; val &= ~D_COMP_COMP_DISABLE ;I915_WRITE (D_COMP , val); -I915_READ (D_COMP ); +POSTING_READ (D_COMP ); val =I915_READ (LCPLL_CTL ); val &= ~LCPLL_PLL_DISABLE ;I915_WRITE (LCPLL_CTL , val); -if (wait_for (I915_READ (LCPLL_CTL ) &LCPLL_PLL_LOCK ,5 )) +if (wait_for (I915_READ_NOTRACE (LCPLL_CTL ) &LCPLL_PLL_LOCK ,5 ))DRM_ERROR ("LCPLL not locked yet\n" );if (val &LCPLL_CD_SOURCE_FCLK ) {
@@ -6056,7 +6057,7 @@ void hsw_restore_lcpll(struct drm_i915_private *dev_priv) val &= ~LCPLL_CD_SOURCE_FCLK ;I915_WRITE (LCPLL_CTL , val); -if (wait_for_atomic_us ((I915_READ (LCPLL_CTL ) & +if (wait_for_atomic_us ((I915_READ_NOTRACE (LCPLL_CTL ) &LCPLL_CD_SOURCE_FCLK_DONE ) ==0 ,1 ))DRM_ERROR ("Switching back to LCPLL failed\n" ); }
Signature · 1 line
1.8.4.rc3
2013/8/21 Daniel Vetter <[email protected]>:
Quoted 7 lines
If we don't use the return value of a mmio read our coding style is to use the
POSTING_READmacro. This avoids cluttering the mmio traces.Similarly for busy loops to wait for a bit to flip we use the
_NOTRACEvariant to avoid filling up the tracebuffers with gunk. Spotted while reading some follow-up patches from Paulo.
Quoted 5 lines
While at it add the missing posting read in the lcpll enable function that Paulo spotted.
Cc Paulo Zanoni <[email protected]>Signed-off-by Daniel Vetter <[email protected]>
I'm pretty sure I added many other wait_for calls without the _NOTRACE in the past...
Quoted 61 lines
--- drivers/gpu/drm/i915/intel_display.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)drivers/gpu/drm/i915/intel_display.c +6
-6@@ -5999,7 +5999,7 @@ void hsw_disable_lcpll(struct drm_i915_private *dev_priv,I915_WRITE (LCPLL_CTL , val);POSTING_READ (LCPLL_CTL ); -if (wait_for ((I915_READ (LCPLL_CTL ) &LCPLL_PLL_LOCK ) ==0 ,1 )) +if (wait_for ((I915_READ_NOTRACE (LCPLL_CTL ) &LCPLL_PLL_LOCK ) ==0 ,1 ))DRM_ERROR ("LCPLL still locked\n" ); val =I915_READ (D_COMP );@@ -6008,7 +6008,7 @@ void hsw_disable_lcpll(struct drm_i915_private *dev_priv,POSTING_READ (D_COMP );ndelay (100 ); -if (wait_for ((I915_READ (D_COMP ) &D_COMP_RCOMP_IN_PROGRESS ) ==0 ,1 )) +if (wait_for ((I915_READ_NOTRACE (D_COMP ) &D_COMP_RCOMP_IN_PROGRESS ) ==0 ,1 ))DRM_ERROR ("D_COMP RCOMP still in progress\n" );if (allow_power_down) {@@ -6036,19 +6036,20 @@ void hsw_restore_lcpll(struct drm_i915_private *dev_priv)if (val &LCPLL_POWER_DOWN_ALLOW ) { val &= ~LCPLL_POWER_DOWN_ALLOW ;I915_WRITE (LCPLL_CTL , val); +POSTING_READ (LCPLL_CTL ); } val =I915_READ (D_COMP ); val |=D_COMP_COMP_FORCE ; val &= ~D_COMP_COMP_DISABLE ;I915_WRITE (D_COMP , val); -I915_READ (D_COMP ); +POSTING_READ (D_COMP ); val =I915_READ (LCPLL_CTL ); val &= ~LCPLL_PLL_DISABLE ;I915_WRITE (LCPLL_CTL , val); -if (wait_for (I915_READ (LCPLL_CTL ) &LCPLL_PLL_LOCK ,5 )) +if (wait_for (I915_READ_NOTRACE (LCPLL_CTL ) &LCPLL_PLL_LOCK ,5 ))DRM_ERROR ("LCPLL not locked yet\n" );if (val &LCPLL_CD_SOURCE_FCLK ) {@@ -6056,7 +6057,7 @@ void hsw_restore_lcpll(struct drm_i915_private *dev_priv) val &= ~LCPLL_CD_SOURCE_FCLK ;I915_WRITE (LCPLL_CTL , val); -if (wait_for_atomic_us ((I915_READ (LCPLL_CTL ) & +if (wait_for_atomic_us ((I915_READ_NOTRACE (LCPLL_CTL ) &LCPLL_CD_SOURCE_FCLK_DONE ) ==0 ,1 ))DRM_ERROR ("Switching back to LCPLL failed\n" ); } --1.8.4.rc3
Signature · 1 line
Paulo Zanoni
Quoted 11 lines · Paulo Zanoni
2013/8/21 Daniel Vetter <[email protected]>:
Quoted 10 lines
If we don't use the return value of a mmio read our coding style is to use the
POSTING_READmacro. This avoids cluttering the mmio traces.Similarly for busy loops to wait for a bit to flip we use the
_NOTRACEvariant to avoid filling up the tracebuffers with gunk. Spotted while reading some follow-up patches from Paulo.While at it add the missing posting read in the lcpll enable function that Paulo spotted.
Quoted 7 lines
Quoted 2 lines
Cc Paulo Zanoni <[email protected]>Signed-off-by Daniel Vetter <[email protected]>Reviewed-by Paulo Zanoni <[email protected]>I'm pretty sure I added many other
wait_forcalls without the_NOTRACEin the past...
Hm, you're right and I even missed one wait_for loop without _NOTRACE in the lcpll code. On further though we only use _NOTRACE consistently in the mmio vfuncs for forcewake and the gt fifo stuff. Which makes sense since those are just the details of how to write a register in the gt. But the actual delay loops in the modeset code are probably rather interesting, so I now think we should keep them ;-)
I'll resend with just the posting read stuff.
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 1/1 drm/i915: Use POSTING_READ in lcpll code
If we don't use the return value of a mmio read our coding style is to use the POSTING_READ macro. This avoids cluttering the mmio traces.
While at it add the missing posting read in the lcpll enable function that Paulo spotted.
v2: Drop the _NOTRACE changes, tracing such wait_for loops in the modeset code might actually be rather useful!
--- drivers/gpu/drm/i915/intel_display.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +2 -1
@@ -6036,13 +6036,14 @@ void hsw_restore_lcpll(struct drm_i915_private *dev_priv)if (val &LCPLL_POWER_DOWN_ALLOW ) { val &= ~LCPLL_POWER_DOWN_ALLOW ;I915_WRITE (LCPLL_CTL , val); +POSTING_READ (LCPLL_CTL ); } val =I915_READ (D_COMP ); val |=D_COMP_COMP_FORCE ; val &= ~D_COMP_COMP_DISABLE ;I915_WRITE (D_COMP , val); -I915_READ (D_COMP ); +POSTING_READ (D_COMP ); val =I915_READ (LCPLL_CTL ); val &= ~LCPLL_PLL_DISABLE ;
Signature · 1 line
1.8.4.rc3
Re: [PATCH] drm/i915: Use POSTING_READ in lcpll code
2013/8/21 Daniel Vetter <[email protected]>:
Quoted 11 lines
If we don't use the return value of a mmio read our coding style is to use the
POSTING_READmacro. This avoids cluttering the mmio traces.While at it add the missing posting read in the lcpll enable function that Paulo spotted.
v2: Drop the
_NOTRACEchanges, tracing suchwait_forloops in the modeset code might actually be rather useful!Cc Paulo Zanoni <[email protected]>Signed-off-by Daniel Vetter <[email protected]>
Quoted 27 lines
--- drivers/gpu/drm/i915/intel_display.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/intel_display.c +2
-2@@ -6036,13 +6036,14 @@ void hsw_restore_lcpll(struct drm_i915_private *dev_priv)if (val &LCPLL_POWER_DOWN_ALLOW ) { val &= ~LCPLL_POWER_DOWN_ALLOW ;I915_WRITE (LCPLL_CTL , val); +POSTING_READ (LCPLL_CTL ); } val =I915_READ (D_COMP ); val |=D_COMP_COMP_FORCE ; val &= ~D_COMP_COMP_DISABLE ;I915_WRITE (D_COMP , val); -I915_READ (D_COMP ); +POSTING_READ (D_COMP ); val =I915_READ (LCPLL_CTL ); val &= ~LCPLL_PLL_DISABLE ; --1.8.4.rc3
Signature · 1 line
Paulo Zanoni
Daniel Vetter
AppliedRe: [PATCH] drm/i915: Use POSTING_READ in lcpll code
Quoted 7 lines · Paulo Zanoni
2013/8/21 Daniel Vetter <[email protected]>:
Quoted 6 lines
If we don't use the return value of a mmio read our coding style is to use the
POSTING_READmacro. This avoids cluttering the mmio traces.While at it add the missing posting read in the lcpll enable function that Paulo spotted.
Quoted 7 lines
Quoted 5 lines
v2: Drop the
_NOTRACEchanges, tracing suchwait_forloops in the modeset code might actually be rather useful!Cc Paulo Zanoni <[email protected]>Signed-off-by Daniel Vetter <[email protected]>Reviewed-by Paulo Zanoni <[email protected]>
Queued for -next, thanks for the review.
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch